fix: supply arg to execute conditionally

This commit is contained in:
jamesgeorge007 2020-10-28 18:10:13 +05:30
parent 983e4c16e7
commit 8d5f1e0eaf
2 changed files with 3 additions and 3 deletions

View File

@ -26,12 +26,12 @@ describe('sb init', () => {
// Install all the dependencies in a single run
console.log('Running bootstrap');
run(['yarn install', '--non-interactive', '--silent', '--pure-lockfile'], { cwd: rootPath });
run(['yarn', 'install', '--non-interactive', '--silent', '--pure-lockfile'], { cwd: rootPath }, false);
// Check that storybook starts without errors
dirs.forEach(dir => {
console.log(`Running smoke test in ${dir}`)
const { status } = run(['yarn', 'storybook', '--smoke-test', '--quiet'], { cwd: path.join(runDirPath, dir) });
const { status } = run(['yarn', 'storybook', '--smoke-test', '--quiet'], { cwd: path.join(runDirPath, dir) }, false);
expect(status).toBe(0);
});
});

View File

@ -55,7 +55,7 @@ const copyDirSync = (source, target) => {
* @param {Boolean} [cli=true] - invoke the binary
* @returns {Object}
*/
const run = (args, options = {}, cli = true) => spawnSync('node', cli ? [CLI_PATH].concat(args) : args, options);
const run = (args, options = {}, cli = true) => spawnSync(cli ? 'node' : args[0], cli ? [CLI_PATH].concat(args) : args.slice(1), options);
module.exports = {
copyDirSync,