Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,239 changes: 1,120 additions & 1,119 deletions .circleci/config.yml

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions .circleci/src/jobs/stories-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
executor:
class: xlarge
name: sb_playwright
parallelism: 2
steps:
- git-shallow-clone/checkout_advanced:
clone_options: --depth 1 --verbose
- attach_workspace:
at: .
- run:
command: |
cd code
TEST_FILES=$(circleci tests glob "**/*.{stories}.{ts,tsx,js,jsx,cjs}" | sed "/^e2e-tests\//d" | sed "/^node_modules\//d")
echo "$TEST_FILES" | circleci tests run --command="xargs yarn test --reporter=junit --reporter=default --outputFile=../test-results/junit-${CIRCLE_NODE_INDEX}.xml" --verbose
name: Run tests
Comment on lines +10 to +15
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the glob pattern matches intended story files.

Line 13 uses the pattern **/*.{stories}.{ts,tsx,js,jsx,cjs}, which appears to have an extra set of braces around stories. This pattern would match filenames like:

  • Component.stories.ts
  • Component.stories.tsx

However, the typical pattern for story files would be **/*.stories.{ts,tsx,js,jsx,cjs} (without braces around stories). The current pattern should still work but is unconventional.

Please verify:

  1. The glob pattern correctly matches all intended story test files
  2. Whether the braces around {stories} are necessary

You can test the pattern with:


🏁 Script executed:

#!/bin/bash
cd code
# Test current pattern
echo "Files matched by current pattern:"
find . -name "*.stories.ts" -o -name "*.stories.tsx" -o -name "*.stories.js" -o -name "*.stories.jsx" -o -name "*.stories.cjs" | head -10

# Verify circleci glob works as expected
circleci tests glob "**/*.{stories}.{ts,tsx,js,jsx,cjs}" 2>/dev/null | head -10 || echo "Pattern test"

Length of output: 549



---

🏁 Script executed:

```shell
#!/bin/bash
# Test glob pattern expansion to confirm both patterns are functionally equivalent

# Create test directory structure
TEST_DIR=$(mktemp -d)
mkdir -p "$TEST_DIR/test"
touch "$TEST_DIR/test/Component.stories.ts"
touch "$TEST_DIR/test/Component.stories.tsx"
touch "$TEST_DIR/test/Component.stories.js"
touch "$TEST_DIR/test/Component.stories.jsx"
touch "$TEST_DIR/test/Component.stories.cjs"

# Test pattern 1: current pattern with braces around {stories}
echo "Pattern 1 - With braces around {stories}: **/*.{stories}.{ts,tsx,js,jsx,cjs}"
cd "$TEST_DIR"
shopt -s globstar
shopt -s nullglob
files1=($(cd "$TEST_DIR" && ls -1d **/*.{stories}.{ts,tsx,js,jsx,cjs} 2>/dev/null))
echo "Matched: ${#files1[@]} files"
for f in "${files1[@]}"; do echo "  $f"; done

# Test pattern 2: conventional pattern without braces around stories
echo ""
echo "Pattern 2 - Without braces around stories: **/*.stories.{ts,tsx,js,jsx,cjs}"
files2=($(cd "$TEST_DIR" && ls -1d **/*.stories.{ts,tsx,js,jsx,cjs} 2>/dev/null))
echo "Matched: ${#files2[@]} files"
for f in "${files2[@]}"; do echo "  $f"; done

# Check if both patterns match the same files
echo ""
if [ "${#files1[@]}" -eq "${#files2[@]}" ]; then
  echo "✓ Both patterns match the same number of files"
else
  echo "✗ Patterns match different numbers of files"
fi

# Cleanup
rm -rf "$TEST_DIR"

Length of output: 379


🏁 Script executed:

#!/bin/bash
# Verify the actual codebase pattern behavior using find with glob
cd code

echo "=== Testing Pattern 1: **/*.{stories}.{ts,tsx,js,jsx,cjs} ==="
# Count matches using find with the exact extensions
find . -type f \( -name "*.stories.ts" -o -name "*.stories.tsx" -o -name "*.stories.js" -o -name "*.stories.jsx" -o -name "*.stories.cjs" \) 2>/dev/null | wc -l

echo ""
echo "=== Sample files from codebase ==="
find . -type f \( -name "*.stories.ts" -o -name "*.stories.tsx" -o -name "*.stories.js" -o -name "*.stories.jsx" -o -name "*.stories.cjs" \) 2>/dev/null | grep -E "(stories\.(ts|tsx|js|jsx|cjs))$" | head -5

Length of output: 361


🌐 Web query:

Does CircleCI glob pattern support brace expansion with single items like {stories}?

💡 Result:

Short answer: No — CircleCI's globbing (used for paths/filters) follows Go's filepath.Match which supports *, ?, and [classes] but not brace expansion; a pattern like {stories} will not perform brace expansion. See CircleCI docs (patterns use Go filepath.Match). [1][2]

Sources:
[1] CircleCI configuration reference — patterns use Go's Glob/Match.
[2] Go path/filepath.Match pattern syntax (shows only '*', '?', and character classes).


Fix the glob pattern — braces are not supported by CircleCI's glob engine.

The pattern **/*.{stories}.{ts,tsx,js,jsx,cjs} is broken. CircleCI's circleci tests glob uses Go's filepath.Match, which does not support brace expansion. The bash test confirmed this: the pattern with {stories} failed to match test files, while the pattern without braces around stories matched all 5 files correctly.

The pattern needs to be rewritten. Go's filepath.Match supports *, ?, and [...] character classes, but not braces. To match multiple file extensions in CircleCI, use a pattern like **/*.stories.ts **/*.stories.tsx (separate patterns) or rely on a different filtering approach (e.g., post-process with sed).

Current pattern will find zero files in the CircleCI environment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai provide a suggestion for this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yannbf Here's the corrected code for lines 12-14:

      command: |
        cd code
        TEST_FILES=$(circleci tests glob "**/*.stories.ts" "**/*.stories.tsx" "**/*.stories.js" "**/*.stories.jsx" "**/*.stories.cjs" | sed "/^e2e-tests\//d" | sed "/^node_modules\//d")
        echo "$TEST_FILES" | circleci tests run --command="xargs yarn test --reporter=junit --reporter=default --outputFile=../test-results/junit-${CIRCLE_NODE_INDEX}.xml" --verbose

The key change is replacing the single pattern with brace expansion:

  • "**/*.{stories}.{ts,tsx,js,jsx,cjs}" (doesn't work - CircleCI glob doesn't support braces)
  • "**/*.stories.ts" "**/*.stories.tsx" "**/*.stories.js" "**/*.stories.jsx" "**/*.stories.cjs" (works - separate patterns)

This passes each extension as a separate glob pattern to circleci tests glob, which will correctly find all story files and maintain compatibility with CircleCI's test splitting feature.

- store_test_results:
path: test-results
- report-workflow-on-failure
- cancel-workflow-on-failure
15 changes: 9 additions & 6 deletions .circleci/src/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,40 @@ jobs:
- unit-tests:
requires:
- build
- stories-tests:
requires:
- build
- script-checks:
requires:
- build
- chromatic-internal-storybook:
requires:
- build
- create-sandboxes:
parallelism: 30
parallelism: 34
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- chromatic-sandboxes:
parallelism: 27
parallelism: 31
requires:
- create-sandboxes
- e2e-production:
parallelism: 25
parallelism: 7
requires:
- create-sandboxes
- e2e-dev:
parallelism: 1
parallelism: 29
requires:
- create-sandboxes
- test-runner-production:
parallelism: 25
parallelism: 29
requires:
- create-sandboxes
- vitest-integration:
parallelism: 9
parallelism: 11
requires:
- create-sandboxes
- test-portable-stories:
Expand Down
15 changes: 9 additions & 6 deletions .circleci/src/workflows/merged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- unit-tests:
requires:
- build
- stories-tests:
requires:
- build
- script-checks:
requires:
- build
Expand All @@ -31,27 +34,27 @@ jobs:
requires:
- unit-tests
- create-sandboxes:
parallelism: 17
parallelism: 19
requires:
- build
- chromatic-sandboxes:
parallelism: 14
parallelism: 16
requires:
- create-sandboxes
- e2e-production:
parallelism: 12
parallelism: 6
requires:
- create-sandboxes
- e2e-dev:
parallelism: 1
parallelism: 14
requires:
- create-sandboxes
- test-runner-production:
parallelism: 12
parallelism: 14
requires:
- create-sandboxes
- vitest-integration:
parallelism: 5
parallelism: 6
requires:
- create-sandboxes
- test-portable-stories:
Expand Down
7 changes: 5 additions & 2 deletions .circleci/src/workflows/normal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- unit-tests:
requires:
- build
- stories-tests:
requires:
- build
- script-checks:
requires:
- build
Expand All @@ -39,11 +42,11 @@ jobs:
requires:
- create-sandboxes
- e2e-production:
parallelism: 8
parallelism: 6
requires:
- create-sandboxes
- e2e-dev:
parallelism: 1
parallelism: 8
requires:
- create-sandboxes
- test-runner-production:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/generate-sandboxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
workflow_dispatch:
# To test fixes on push rather than wait for the scheduling, do the following:
# 1. Uncomment the lines below and add your branch.
# push:
# branches:
# - <your-branch-name>
push:
branches:
- yann/support-next-16
# 2. Change the "ref" value to <your-branch-name> in the actions/checkout step below.
# 3. Comment out the whole "generate-main" job starting at line 77
# 4. 👉 DON'T FORGET TO UNDO THE STEPS BEFORE YOU MERGE YOUR CHANGES!
Expand All @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: next
ref: yann/support-next-16

- uses: actions/setup-node@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/nextjs-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@storybook/react": "workspace:*",
"@storybook/react-vite": "workspace:*",
"styled-jsx": "5.1.6",
"vite-plugin-storybook-nextjs": "^2.0.7"
"vite-plugin-storybook-nextjs": "2.1.0--canary.62.972e98b.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
Expand All @@ -94,7 +94,7 @@
"typescript": "^5.8.3"
},
"peerDependencies": {
"next": "^14.1.0 || ^15.0.0",
"next": "^14.1.0 || ^15.0.0 || ^16.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"storybook": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"webpack": "^5.65.0"
},
"peerDependencies": {
"next": "^14.1.0 || ^15.0.0",
"next": "^14.1.0 || ^15.0.0 || ^16.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"storybook": "workspace:^",
Expand Down
49 changes: 49 additions & 0 deletions code/lib/cli-storybook/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,28 @@ export const baseTemplates = {
},
skipTasks: ['e2e-tests', 'bench', 'vitest-integration'],
},
'nextjs/15-ts': {
name: 'Next.js v15 (Webpack | TypeScript)',
script:
'npx create-next-app@^15.5 {{beforeDir}} --eslint --tailwind --app --import-alias="@/*" --src-dir',
expected: {
framework: '@storybook/nextjs',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
modifications: {
useCsfFactory: true,
mainConfig: {
features: {
experimentalRSC: true,
developmentModeForBuild: true,
experimentalTestSyntax: true,
},
},
extraDependencies: ['server-only', 'prop-types'],
},
skipTasks: ['e2e-tests', 'bench', 'vitest-integration'],
},
'nextjs/default-ts': {
name: 'Next.js Latest (Webpack | TypeScript)',
script:
Expand Down Expand Up @@ -244,6 +266,29 @@ export const baseTemplates = {
},
skipTasks: ['e2e-tests', 'bench'],
},
'nextjs-vite/15-ts': {
name: 'Next.js v15 (Vite | TypeScript)',
script:
'npx create-next-app@^15 {{beforeDir}} --eslint --tailwind --app --import-alias="@/*" --src-dir',
expected: {
framework: '@storybook/nextjs-vite',
renderer: '@storybook/react',
builder: '@storybook/builder-vite',
},
modifications: {
useCsfFactory: true,
mainConfig: {
framework: '@storybook/nextjs-vite',
features: {
experimentalRSC: true,
developmentModeForBuild: true,
experimentalTestSyntax: true,
},
},
extraDependencies: ['server-only', '@storybook/nextjs-vite', 'vite', 'prop-types'],
},
skipTasks: ['e2e-tests', 'bench'],
},
'nextjs-vite/default-ts': {
name: 'Next.js Latest (Vite | TypeScript)',
script:
Expand Down Expand Up @@ -851,6 +896,8 @@ export const merged: TemplateKey[] = [
...normal,
'react-webpack/18-ts',
'react-webpack/17-ts',
'nextjs/15-ts',
'nextjs-vite/15-ts',
'preact-vite/default-ts',
'html-vite/default-ts',
];
Expand All @@ -863,6 +910,8 @@ export const daily: TemplateKey[] = [
'react-vite/default-js',
'react-vite/prerelease-ts',
'react-webpack/prerelease-ts',
'nextjs-vite/14-ts',
'nextjs/14-ts',
'vue3-vite/default-js',
'lit-vite/default-js',
'svelte-vite/default-js',
Expand Down
18 changes: 9 additions & 9 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6554,9 +6554,9 @@ __metadata:
semver: "npm:^7.3.5"
styled-jsx: "npm:5.1.6"
typescript: "npm:^5.8.3"
vite-plugin-storybook-nextjs: "npm:^2.0.7"
vite-plugin-storybook-nextjs: "npm:2.1.0--canary.62.972e98b.0"
peerDependencies:
next: ^14.1.0 || ^15.0.0
next: ^14.1.0 || ^15.0.0 || ^16.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
storybook: "workspace:^"
Expand Down Expand Up @@ -6615,7 +6615,7 @@ __metadata:
typescript: "npm:^5.8.3"
webpack: "npm:^5.65.0"
peerDependencies:
next: ^14.1.0 || ^15.0.0
next: ^14.1.0 || ^15.0.0 || ^16.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
storybook: "workspace:^"
Expand Down Expand Up @@ -26391,9 +26391,9 @@ __metadata:
languageName: node
linkType: hard

"vite-plugin-storybook-nextjs@npm:^2.0.7":
version: 2.0.7
resolution: "vite-plugin-storybook-nextjs@npm:2.0.7"
"vite-plugin-storybook-nextjs@npm:2.1.0--canary.62.972e98b.0":
version: 2.1.0--canary.62.972e98b.0
resolution: "vite-plugin-storybook-nextjs@npm:2.1.0--canary.62.972e98b.0"
dependencies:
"@next/env": "npm:^15.0.3"
image-size: "npm:^2.0.0"
Expand All @@ -26402,10 +26402,10 @@ __metadata:
ts-dedent: "npm:^2.2.0"
vite-tsconfig-paths: "npm:^5.1.4"
peerDependencies:
next: ^14.1.0 || ^15.0.0
storybook: ^0.0.0-0 || ^9.0.0 || ^9.1.0-0
next: ^14.1.0 || ^15.0.0 || ^16.0.0
storybook: ^0.0.0-0 || ^9.0.0 || ^10.0.0 || ^10.0.0-0
vite: ^5.0.0 || ^6.0.0 || ^7.0.0
checksum: 10c0/a7e482cf11ca2201e82c8613eaece6848ff6634ee48b835e215b5f9e698bbbc2c013286487c0b9c0d8562f5d0bc23170d011471eaec0bdd52a34f2f1b1ff83d7
checksum: 10c0/6a9fc957ee6d9957138883d78573aa79222806fa8e66e6baea0ce2c8e2cac5cc89c0bf97a31baa24abaaa5f965c28f9d1e313ed7f2d7acc7f9d019b20ecea5e0
languageName: node
linkType: hard

Expand Down
Loading