Skip to content

Commit

Permalink
Merge pull request #2219 from storybooks/ndelangen/fix-yarn-testscript
Browse files Browse the repository at this point in the history
FIX `yarn test` & selecting only core
  • Loading branch information
danielduan authored Nov 2, 2017
2 parents c2df1a1 + 238338f commit 526f9e9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const program = require('commander');
const childProcess = require('child_process');
const chalk = require('chalk');
const log = require('npmlog');
const path = require('path');

log.heading = 'storybook';
const prefix = 'test';
Expand All @@ -18,6 +19,7 @@ const spawn = command => {
if (out.status !== 0) {
process.exit(out.status);
}

return out;
};

Expand All @@ -43,7 +45,7 @@ const tasks = {
name: `Core & React & Vue ${chalk.gray('(core)')}`,
defaultValue: true,
option: '--core',
projectLocation: './',
projectLocation: path.join(__dirname, '..'),
}),
'react-native-vanilla': createProject({
name: `React-Native example ${chalk.gray('(react-native-vanilla)')}`,
Expand Down Expand Up @@ -110,6 +112,7 @@ Object.keys(tasks).forEach(key => {
});

let selection;

if (
!Object.keys(tasks)
.map(key => tasks[key].value)
Expand Down Expand Up @@ -153,10 +156,14 @@ if (

selection
.then(list => {
const command = `jest --projects ${getProjects(list).join(' ')} ${getExtraParams(list).join(
' '
)}`;
console.log('command: ', command);
if (list.length === 0) {
log.warn(prefix, 'Nothing to test');
} else {
spawn(`jest --projects ${getProjects(list).join(' ')} ${getExtraParams(list).join(' ')}`);
spawn(command);
process.stdout.write('\x07');
}
})
Expand Down

0 comments on commit 526f9e9

Please sign in to comment.