本文整理汇总了TypeScript中denali-cli.CommandAcceptanceTest.run方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CommandAcceptanceTest.run方法的具体用法?TypeScript CommandAcceptanceTest.run怎么用?TypeScript CommandAcceptanceTest.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类denali-cli.CommandAcceptanceTest
的用法示例。
在下文中一共展示了CommandAcceptanceTest.run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('generates a blueprint', async (t) => {
let generate = new CommandAcceptanceTest('generate action foobar --skip-post-install', { name: 'generate-command' });
let generatedFilepath = path.join(generate.dir, 'app', 'actions', 'foobar.js');
await generate.run({ failOnStderr: true });
t.true(fs.existsSync(generatedFilepath), 'file should be generated');
});
示例2: async
test.beforeEach('generate an action to destroy', async (t) => {
let generate = new CommandAcceptanceTest('generate action foobar', { name: 'destroy-command' });
t.context.dir = generate.dir;
t.context.generatedFilepath = path.join(generate.dir, 'app', 'actions', 'foobar.js');
await generate.run();
t.true(fs.existsSync(t.context.generatedFilepath), 'file should be generated');
});
示例3: test
test('skips modified files', async (t) => {
let destroy = new CommandAcceptanceTest('destroy action foobar', { dir: t.context.dir, populateWithDummy: false });
fs.appendFileSync(t.context.generatedFilepath, 'foobar');
await destroy.run();
t.true(fs.existsSync(t.context.generatedFilepath), 'file should be generated');
});
示例4: test
test('prints list of configured routes', async (t) => {
let generate = new CommandAcceptanceTest('routes', { name: 'routes-command' });
let result = await generate.run({ failOnStderr: true });
t.true(result.stdout.trim().endsWith(dedent`
┌───────┬────────┐
│ URL │ ACTION │
├───────┼────────┤
│ GET / │ index │
└───────┴────────┘
`.trim()));
});
示例5: test
test('launches a server based on the dummy app in an addon', async (t) => {
let generateAddon = new CommandAcceptanceTest('addon my-denali-addon', { name: 'server-command-dummy-app', populateWithDummy: false });
await generateAddon.run({ failOnStderr: true });
linkDependency(path.join(generateAddon.dir, 'my-denali-addon'), 'denali', path.join(process.cwd(), 'node_modules', 'denali'));
let server = new CommandAcceptanceTest('server --port 3002', {
dir: path.join(generateAddon.dir, 'my-denali-addon'),
populateWithDummy: false
});
return server.spawn({
failOnStderr: true,
checkOutput(stdout, stderr) {
let started = stdout.indexOf('dummy@0.0.0 server up') > -1;
if (started) {
t.pass();
}
return started;
}
});
});