本文整理汇总了TypeScript中yeoman-test.run函数的典型用法代码示例。如果您正苦于以下问题:TypeScript run函数的具体用法?TypeScript run怎么用?TypeScript run使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test(testName, (done) => {
const TestGenerator = createElementGenerator('polymer-1.x');
helpers.run(TestGenerator).on('end', () => {
yoAssert.noFile(['_element.html']);
done();
});
});
示例2: test
test(testName, (done) => {
let getSemverReleaseStub: sinon.SinonStub;
let extractReleaseTarballStub: sinon.SinonStub;
const TestGenerator = createTestGenerator(
{
owner: 'Polymer',
repo: 'shop',
},
function setupGeneratorStubs(generator) {
getSemverReleaseStub =
// tslint:disable-next-line: no-any
sinon.stub((generator as any)._github, 'getSemverRelease')
.returns(Promise.resolve(semverMatchingRelease));
extractReleaseTarballStub =
// tslint:disable-next-line: no-any
sinon.stub((generator as any)._github, 'extractReleaseTarball')
.returns(Promise.resolve());
});
// tslint:disable-next-line: no-any
helpers.run(TestGenerator as any).on('end', () => {
assert.isOk(getSemverReleaseStub.calledWith('*'));
assert.isOk(extractReleaseTarballStub.calledWith(
semverMatchingRelease.tarball_url));
done();
});
});
示例3: test
test(testName, (done) => {
const testSemverRange = '^v123.456.789';
let getSemverReleaseStub: sinon.SinonStub;
let extractReleaseTarballStub: sinon.SinonStub;
const TestGenerator = createTestGenerator(
{
owner: 'Polymer',
repo: 'shop',
semverRange: testSemverRange,
},
function setupGeneratorStubs(generator) {
const {_github} = generator as unknown as {
_github:
{getSemverRelease: unknown, extractReleaseTarball: unknown}
};
getSemverReleaseStub =
// tslint:disable-next-line: no-any
sinon.stub(_github, 'getSemverRelease')
.returns(Promise.resolve(semverMatchingRelease));
extractReleaseTarballStub =
// tslint:disable-next-line: no-any
sinon.stub(_github, 'extractReleaseTarball')
.returns(Promise.resolve());
});
// tslint:disable-next-line: no-any
helpers.run(TestGenerator as any).on('end', () => {
assert.isOk(getSemverReleaseStub.calledWith(testSemverRange));
assert.isOk(extractReleaseTarballStub.calledWith(
semverMatchingRelease.tarball_url));
done();
});
});
示例4: createApplicationGenerator
(done) => {
const TestGenerator = createApplicationGenerator('polymer-1.x');
helpers.run(TestGenerator).on('end', () => {
yoAssert.noFile(['src/_element/_element.html']);
done();
});
});
示例5:
(resolve, reject): void => {
this.runContext = helpers
.run(path.join(__dirname, `../../../generators/${name}`), {
tmpdir: false
})
.inDir(scratchDir)
.withArguments(args)
.withPrompts(prompt)
.on(
"ready",
// We don't want to import any source statically, so can't import
// type BaseGenerator
// @ts-ignore
(generator): void => {
// .yo-rc.json is in topdir and yeoman-test silently resets
// cwd to topdir (because of sinonjs masking the warning)
// so override the reset
generator.destinationRoot(scratchDir);
// Also override the reset for every single subgen
// @ts-ignore
generator._composedWith.forEach(
// We don't want to import any source statically, so can't import
// type BaseGenerator
// @ts-ignore
(gen): void => {
gen.destinationRoot(scratchDir);
}
);
}
)
.on("end", resolve)
.on("error", reject)
.toPromise();
}
示例6: skipOnWindows
skipOnWindows('test the Polymer 1.x "element" template', async () => {
const dir =
await runGenerator(createElementGenerator('polymer-1.x'))
.withPrompts({name: 'my-element'}) // Mock the prompt answers
.toPromise();
await runCommand(binPath, ['install'], {cwd: dir});
await runCommand(binPath, ['lint'], {cwd: dir});
await runCommand(binPath, ['test'], {cwd: dir});
});
示例7: suiteSetup
suiteSetup(async () => {
const TSPGenerator = createGithubGenerator({
owner: 'Polymer',
repo: 'tools-sample-projects',
githubToken,
});
tspDir = await runGenerator(TSPGenerator).toPromise();
});