Skip to content

Commit

Permalink
Merge branch 'next' of github.com:storybookjs/storybook into next
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Jun 1, 2020
2 parents 9f6fddb + c9fb748 commit 29a13f6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
4 changes: 4 additions & 0 deletions lib/cli/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ export function installDependencies(
installArgs.push('-D');
}

if (options.useYarn) {
installArgs.push('--ignore-workspace-root-check');
}

const dependencyResult = spawnSync(spawnCommand, installArgs, {
stdio: 'inherit',
});
Expand Down
10 changes: 10 additions & 0 deletions scripts/run-e2e-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,13 @@ export const yarn2Cra: Parameters = {
`yarn dlx create-react-app@{{version}} {{name}}-v{{version}}`,
].join(' && '),
};

export const reactInYarnWorkspace: Parameters = {
name: 'reactInYarnWorkspace',
version: 'latest',
generator: [
'cd {{name}}-v{{version}}',
'echo "{ \\"name\\": \\"workspace-root\\", \\"private\\": true, \\"workspaces\\": [] }" > package.json',
`yarn add react react-dom --silent -W`,
].join(' && '),
};
25 changes: 15 additions & 10 deletions scripts/run-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const initStorybook = async ({ cwd, autoDetect = true, name }: Options) => {
logger.info(`🎨 Initializing Storybook with @storybook/cli`);
try {
const type = autoDetect ? '' : `--type ${name}`;
await exec(`npx -p @storybook/cli sb init --skip-install --yes ${type}`, { cwd });
await exec(`npx -p @storybook/cli sb init --yes ${type}`, { cwd });
} catch (e) {
logger.error(`🚨 Storybook initialization failed`);
throw e;
Expand Down Expand Up @@ -187,10 +187,10 @@ const runTests = async ({ name, version, ...rest }: Parameters) => {
await generate({ ...options, cwd: siblingDir });
logger.log();

await initStorybook(options);
await setResolutions(options);
logger.log();

await setResolutions(options);
await initStorybook(options);
logger.log();

await addRequiredDeps(options);
Expand Down Expand Up @@ -274,13 +274,18 @@ if (frameworkArgs.length > 0) {
const perform = () => {
const limit = pLimit(1);
const narrowedConfigs = Object.values(e2eConfigs);
const [a, b] = [+process.env.CIRCLE_NODE_INDEX || 0, +process.env.CIRCLE_NODE_TOTAL || 1];
const step = Math.ceil(narrowedConfigs.length / b);
const offset = step * a;

const list = narrowedConfigs.slice().splice(offset, step);

logger.info(`📑 Assigning jobs ${list.map((c) => c.name).join(', ')} to node ${a} (on ${b})`);
const nodeIndex = +process.env.CIRCLE_NODE_INDEX || 0;
const numberOfNodes = +process.env.CIRCLE_NODE_TOTAL || 1;

const list = narrowedConfigs.filter((_, index) => {
return index % numberOfNodes === nodeIndex;
});

logger.info(
`📑 Assigning jobs ${list
.map((c) => c.name)
.join(', ')} to node ${nodeIndex} (on ${numberOfNodes})`
);

return Promise.all(list.map((config) => limit(() => runE2E(config))));
};
Expand Down

0 comments on commit 29a13f6

Please sign in to comment.