How to use yeoman-test - 10 common examples

To help you get started, we’ve selected a few yeoman-test examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github binduwavell / generator-alfresco / test / test-model-2-1-1.js View on Github external
it('create with invalid version', function () {
    return helpers.run(path.join(__dirname, '../generators/model'))
      .cd(osTempDir)
      .withOptions({
        'model-name': 'invalidVersionModel',
        'model-version': 'asd',
      })
      .toPromise()
      .then(dir => {
        // console.log(fs.readdirSync(path.join(osTempDir, 'repo-amp/src/main/amp/config/alfresco/module/repo-amp/model/generated')));
        assert.noFile([
          'repo-amp/src/main/amp/config/alfresco/module/repo-amp/model/generated/invalidVersionModel.xml',
          'repo-amp/src/main/amp/config/alfresco/module/repo-amp/context/generated/invalidversion-model-context.xml',
          'repo-amp/src/main/amp/config/alfresco/module/repo-amp/messages/generated/invalidVersionModel.properties',
        ].map(relativePath => path.join(osTempDir, relativePath)));
      });
  });
github 10up / generator-wp-make / test / lib / base.js View on Github external
it( 'registers methods with the run loop', function () {
			// Create a dummy instance with the Yeoman helper.
			const app = helpers.createGenerator(
				'dummy:app',
				[[MakeBase, 'dummy:app']]
			);
			// The queue annoying and not well mockable.
			// So instead we'll just dig into the object and check it...
			const queues = app.env.runLoop.__queues__;
			const initQueue = queues.initializing.__queue__;
			const promptQueue = queues.prompting.__queue__;
			const configQueue = queues.configuring.__queue__;
			const writeQueue = queues.writing.__queue__;
			const endQueue = queues.end.__queue__;
			// Check to make sure the once flags are in the queues.
			// Does a deccent job of ensuring the function is actually
			// registered with the environments run loop. Not perfect, but
			// better than nothing.
			assert.includeMembers(
github strongloop / loopback-next / packages / cli / smoke-test / openapi / code-gen-utils.js View on Github external
async function createAppProject(appName) {
  // The root directory of the application project
  // loopback-next/sandbox/
  const sandbox = path.join(rootDir, 'sandbox', appName);
  const pkgName = `@loopback/${appName}`;
  const props = {
    name: pkgName,
    description: 'My sandbox app for LoopBack 4',
    outdir: sandbox,
  };

  await helpers
    .run(appGenerator)
    .inDir(sandbox)
    // Mark it private to prevent accidental npm publication
    .withOptions({private: true})
    .withPrompts(props);

  process.chdir(rootDir);
  await lernaBootstrap(pkgName);

  return sandbox;
}
github DefinitelyTyped / DefinitelyTyped / types / yeoman-test / yeoman-test-tests.ts View on Github external
declare const generator: Generator;
declare function before(done: (...args: any[]) => void): void;

// helpers.setUpTestDirectory()
before(helpers.setUpTestDirectory('dir'));

// helpers.gruntfile()
before(done => helpers.gruntfile({foo: 'bar'}, done));

// helpers.testDirectory()
helpers.testDirectory(path.join(__dirname, './temp'), () => {
	fs.writeFileSync('testfile', 'Roses are red.');
});

// helpers.mockPrompt()
helpers.mockPrompt(generator, {foo: 'bar'});

// helpers.restorePrompt()
helpers.restorePrompt(generator);

// helpers.mockLocalConfig()
helpers.mockLocalConfig(generator, {foo: 'bar'});

// helpers.createDummyGenerator()
const dummyGenerator = helpers.createDummyGenerator();

// helpers.createGenerator()
const angularGenerator = helpers.createGenerator('angular:app', [
	'../../app',
	'../../common',
	'../../controller',
	'../../main',
github DefinitelyTyped / DefinitelyTyped / types / yeoman-test / yeoman-test-tests.ts View on Github external
import * as path from 'path';
import * as helpers from 'yeoman-test';
import Generator = require('yeoman-generator');

declare const env: any;
declare const generator: Generator;
declare function before(done: (...args: any[]) => void): void;

// helpers.setUpTestDirectory()
before(helpers.setUpTestDirectory('dir'));

// helpers.gruntfile()
before(done => helpers.gruntfile({foo: 'bar'}, done));

// helpers.testDirectory()
helpers.testDirectory(path.join(__dirname, './temp'), () => {
	fs.writeFileSync('testfile', 'Roses are red.');
});

// helpers.mockPrompt()
helpers.mockPrompt(generator, {foo: 'bar'});

// helpers.restorePrompt()
helpers.restorePrompt(generator);

// helpers.mockLocalConfig()
helpers.mockLocalConfig(generator, {foo: 'bar'});

// helpers.createDummyGenerator()
const dummyGenerator = helpers.createDummyGenerator();

// helpers.createGenerator()
github yeoman / generator / test / install.js View on Github external
beforeEach(() => {
    this.env = yeoman.createEnv([], {}, new TestAdapter());
    const Dummy = class extends Base {
      exec() {}
    };
    this.env.registerStub(Dummy, 'dummy');
    this.dummy = this.env.create('dummy');

    // Keep track of all commands executed by spawnCommand.
    this.spawnCommandStub = sinon.stub(this.dummy, 'spawnCommand');
    this.spawnCommandStub.returns(asyncStub);
  });
github DefinitelyTyped / DefinitelyTyped / types / yeoman-test / yeoman-test-tests.ts View on Github external
// helpers.testDirectory()
helpers.testDirectory(path.join(__dirname, './temp'), () => {
	fs.writeFileSync('testfile', 'Roses are red.');
});

// helpers.mockPrompt()
helpers.mockPrompt(generator, {foo: 'bar'});

// helpers.restorePrompt()
helpers.restorePrompt(generator);

// helpers.mockLocalConfig()
helpers.mockLocalConfig(generator, {foo: 'bar'});

// helpers.createDummyGenerator()
const dummyGenerator = helpers.createDummyGenerator();

// helpers.createGenerator()
const angularGenerator = helpers.createGenerator('angular:app', [
	'../../app',
	'../../common',
	'../../controller',
	'../../main',
	[helpers.createDummyGenerator(), 'testacular:app']
]);

// helpers.registerDependencies()
helpers.registerDependencies(env, ['dependency']);

// helpers.run()
helpers.run(path.join(__dirname, '../app'))
	.withOptions({foo: 'bar'})
github yeoman / generator / test / base.js View on Github external
describe('Base', () => {
  beforeEach(helpers.setUpTestDirectory(tmpdir));

  beforeEach(function() {
    this.env = yeoman.createEnv([], { 'skip-install': true }, new TestAdapter());
    makeDir.sync(resolveddir);
    this.Dummy = class extends Base {};
    this.Dummy.prototype.exec = sinon.spy();

    this.dummy = new this.Dummy(['bar', 'baz', 'bom'], {
      foo: false,
      something: 'else',
      // Mandatory options, created by the `env#create()` helper
      resolved: resolveddir,
      namespace: 'dummy',
      env: this.env,
      'skip-install': true
    });
github DefinitelyTyped / DefinitelyTyped / types / yeoman-test / yeoman-test-tests.ts View on Github external
import * as fs from 'fs';
import * as path from 'path';
import * as helpers from 'yeoman-test';
import Generator = require('yeoman-generator');

declare const env: any;
declare const generator: Generator;
declare function before(done: (...args: any[]) => void): void;

// helpers.setUpTestDirectory()
before(helpers.setUpTestDirectory('dir'));

// helpers.gruntfile()
before(done => helpers.gruntfile({foo: 'bar'}, done));

// helpers.testDirectory()
helpers.testDirectory(path.join(__dirname, './temp'), () => {
	fs.writeFileSync('testfile', 'Roses are red.');
});

// helpers.mockPrompt()
helpers.mockPrompt(generator, {foo: 'bar'});

// helpers.restorePrompt()
helpers.restorePrompt(generator);

// helpers.mockLocalConfig()
github DefinitelyTyped / DefinitelyTyped / types / yeoman-test / yeoman-test-tests.ts View on Github external
// helpers.gruntfile()
before(done => helpers.gruntfile({foo: 'bar'}, done));

// helpers.testDirectory()
helpers.testDirectory(path.join(__dirname, './temp'), () => {
	fs.writeFileSync('testfile', 'Roses are red.');
});

// helpers.mockPrompt()
helpers.mockPrompt(generator, {foo: 'bar'});

// helpers.restorePrompt()
helpers.restorePrompt(generator);

// helpers.mockLocalConfig()
helpers.mockLocalConfig(generator, {foo: 'bar'});

// helpers.createDummyGenerator()
const dummyGenerator = helpers.createDummyGenerator();

// helpers.createGenerator()
const angularGenerator = helpers.createGenerator('angular:app', [
	'../../app',
	'../../common',
	'../../controller',
	'../../main',
	[helpers.createDummyGenerator(), 'testacular:app']
]);

// helpers.registerDependencies()
helpers.registerDependencies(env, ['dependency']);