Skip to content

Commit

Permalink
fix(storybook): only add @storybook/test-runner to externalDependenci…
Browse files Browse the repository at this point in the history
…es if installed (#28060)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #26854
  • Loading branch information
xiongemi authored Sep 27, 2024
1 parent 6634693 commit 5724deb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
10 changes: 3 additions & 7 deletions packages/storybook/src/plugins/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('@nx/storybook/plugin', () => {
inputs: [
'production',
'^production',
{ externalDependencies: ['storybook', '@storybook/test-runner'] },
{ externalDependencies: ['storybook'] },
],
});
expect(
Expand Down Expand Up @@ -136,11 +136,7 @@ describe('@nx/storybook/plugin', () => {
'production',
'^production',
{
externalDependencies: [
'storybook',
'@storybook/angular',
'@storybook/test-runner',
],
externalDependencies: ['storybook', '@storybook/angular'],
},
],
});
Expand Down Expand Up @@ -200,7 +196,7 @@ describe('@nx/storybook/plugin', () => {
inputs: [
'production',
'^production',
{ externalDependencies: ['storybook', '@storybook/test-runner'] },
{ externalDependencies: ['storybook'] },
],
});
expect(
Expand Down
18 changes: 15 additions & 3 deletions packages/storybook/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ function buildTarget(
externalDependencies: [
'storybook',
'@storybook/angular',
'@storybook/test-runner',
isStorybookTestRunnerInstalled()
? '@storybook/test-runner'
: undefined,
],
},
],
Expand All @@ -203,7 +205,12 @@ function buildTarget(
? ['production', '^production']
: ['default', '^default']),
{
externalDependencies: ['storybook', '@storybook/test-runner'],
externalDependencies: [
'storybook',
isStorybookTestRunnerInstalled()
? '@storybook/test-runner'
: undefined,
],
},
],
};
Expand Down Expand Up @@ -241,7 +248,12 @@ function testTarget(projectRoot: string) {
options: { cwd: projectRoot },
inputs: [
{
externalDependencies: ['storybook', '@storybook/test-runner'],
externalDependencies: [
'storybook',
isStorybookTestRunnerInstalled()
? '@storybook/test-runner'
: undefined,
],
},
],
};
Expand Down

0 comments on commit 5724deb

Please sign in to comment.