generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 12
Add end-to-end tests and improve unit test quality #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
36a9e1d
add e2e tests
JReinhold 310f3a1
improve e2e scripting
JReinhold c153b93
add tests for mcp index
JReinhold f3a467f
add preset tests
JReinhold d67a038
add telemetry tests
JReinhold c807fe7
simplify tool test mocks
JReinhold 61baa0f
simplify mcp-handler tests, improve disableTelemetry handling
JReinhold e01da53
add tests for manifest availability
JReinhold 1d4fbfd
exclude evals from coverage
JReinhold 1cc6bbd
cleanup
JReinhold 23daa64
changeset
JReinhold 54d5157
Merge branch 'next' of https://github.com/storybookjs/mcp into improv…
JReinhold ba47326
fix preset registering handlers instead of middlewares
JReinhold 35859a4
update tests to match changes in base branch
JReinhold f38a3bf
cleanup
JReinhold 85c6076
await sb process kill
JReinhold 02e2914
globally mock storybook deps
JReinhold 6f01bc6
clean lock file
JReinhold 4d1c0c2
Merge branch 'next' of https://github.com/storybookjs/mcp into improv…
JReinhold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@storybook/addon-mcp': patch | ||
| --- | ||
|
|
||
| improve handling of disableTelemetry option |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import { describe, it } from 'vitest'; | ||
| import { x } from 'tinyexec'; | ||
|
|
||
| const PACKAGES_TO_CHECK = [ | ||
| '@storybook/addon-docs', | ||
| '@storybook/react-vite', | ||
| 'storybook', | ||
| ]; | ||
|
|
||
| describe('Storybook Dependencies', () => { | ||
| it('should be using latest versions from registry', async () => { | ||
| const outdated: Array<{ pkg: string; current: string; latest: string }> = | ||
| []; | ||
|
|
||
| for (const pkg of PACKAGES_TO_CHECK) { | ||
| // Get local version | ||
| const listResult = await x('pnpm', ['list', pkg, '--json'], { | ||
| nodeOptions: { cwd: process.cwd() }, | ||
| }); | ||
| const listData = JSON.parse(listResult.stdout); | ||
| const currentVersion = | ||
| listData[0]?.devDependencies?.[pkg]?.version || | ||
| listData[0]?.dependencies?.[pkg]?.version; | ||
|
|
||
| if (!currentVersion) { | ||
| continue; | ||
| } | ||
|
|
||
| // Get registry version for @next tag | ||
| const viewResult = await x('pnpm', ['view', `${pkg}@next`, 'version'], { | ||
| nodeOptions: { cwd: process.cwd() }, | ||
| }); | ||
| const latestVersion = viewResult.stdout.trim(); | ||
|
|
||
| // Compare versions | ||
| if (currentVersion !== latestVersion) { | ||
| outdated.push({ pkg, current: currentVersion, latest: latestVersion }); | ||
| } | ||
| } | ||
|
|
||
| // If there are outdated packages, fail the test with instructions | ||
| if (outdated.length > 0) { | ||
| const outdatedList = outdated | ||
| .map(({ pkg, current, latest }) => ` - ${pkg}: ${current} → ${latest}`) | ||
| .join('\n'); | ||
|
|
||
| const currentVersion = outdated[0]!.current.replace(/\./g, '\\.'); | ||
| const latestVersion = outdated[0]!.latest; | ||
|
|
||
| throw new Error( | ||
| `Storybook dependencies are outdated. Update the catalog in pnpm-workspace.yaml:\n\n sed -i '' 's/${currentVersion}/${latestVersion}/g' pnpm-workspace.yaml && pnpm install\n\nOutdated packages:\n${outdatedList}`, | ||
| ); | ||
| } | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.