Skip to content
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

Addon Test: Replace glob with tinyglobby #29817

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 changes: 1 addition & 1 deletion code/addons/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
"execa": "^8.0.1",
"find-up": "^7.0.0",
"formik": "^2.2.9",
"glob": "^10.0.0",
"istanbul-lib-report": "^3.0.1",
"pathe": "^1.1.2",
"picocolors": "^1.1.0",
Expand All @@ -112,6 +111,7 @@
"semver": "^7.6.3",
"slash": "^5.0.0",
"strip-ansi": "^7.1.0",
"tinyglobby": "^0.2.10",
"ts-dedent": "^2.2.0",
"typescript": "^5.3.2",
"vitest": "^2.1.3"
Expand Down
9 changes: 2 additions & 7 deletions code/addons/test/src/vitest-plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import { readConfig, vitestTransform } from 'storybook/internal/csf-tools';
import { MainFileMissingError } from 'storybook/internal/server-errors';
import type { DocsOptions, StoriesEntry } from 'storybook/internal/types';

// eslint-disable-next-line depend/ban-dependencies
import { escape } from 'glob';
import { join, resolve } from 'pathe';
import { convertPathToPattern } from 'tinyglobby';

import type { InternalOptions, UserOptions } from './types';

Expand Down Expand Up @@ -121,11 +120,7 @@ export const storybookTest = (options?: UserOptions): Plugin => {
config.test ??= {};

config.test.include ??= [];
config.test.include.push(
// Escape magic characters in paths because they shouldn't be treated as glob patterns
// Paths are resolved using `pathe` to convert Windows paths to POSIX paths first
...storiesFiles.map((path) => escape(resolve(path)))
);
config.test.include.push(...storiesFiles.map((path) => convertPathToPattern(path)));

config.test.exclude ??= [];
config.test.exclude.push('**/*.mdx');
Expand Down
21 changes: 19 additions & 2 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6602,7 +6602,6 @@ __metadata:
execa: "npm:^8.0.1"
find-up: "npm:^7.0.0"
formik: "npm:^2.2.9"
glob: "npm:^10.0.0"
istanbul-lib-report: "npm:^3.0.1"
pathe: "npm:^1.1.2"
picocolors: "npm:^1.1.0"
Expand All @@ -6613,6 +6612,7 @@ __metadata:
semver: "npm:^7.6.3"
slash: "npm:^5.0.0"
strip-ansi: "npm:^7.1.0"
tinyglobby: "npm:^0.2.10"
ts-dedent: "npm:^2.2.0"
typescript: "npm:^5.3.2"
vitest: "npm:^2.1.3"
Expand Down Expand Up @@ -15875,7 +15875,7 @@ __metadata:
languageName: node
linkType: hard

"fdir@npm:^6.2.0":
"fdir@npm:^6.2.0, fdir@npm:^6.4.2":
version: 6.4.2
resolution: "fdir@npm:6.4.2"
peerDependencies:
Expand Down Expand Up @@ -23340,6 +23340,13 @@ __metadata:
languageName: node
linkType: hard

"picomatch@npm:^4.0.2":
version: 4.0.2
resolution: "picomatch@npm:4.0.2"
checksum: 10c0/7c51f3ad2bb42c776f49ebf964c644958158be30d0a510efd5a395e8d49cb5acfed5b82c0c5b365523ce18e6ab85013c9ebe574f60305892ec3fa8eee8304ccc
languageName: node
linkType: hard

"picoquery@npm:^1.4.0":
version: 1.4.0
resolution: "picoquery@npm:1.4.0"
Expand Down Expand Up @@ -27838,6 +27845,16 @@ __metadata:
languageName: node
linkType: hard

"tinyglobby@npm:^0.2.10":
version: 0.2.10
resolution: "tinyglobby@npm:0.2.10"
dependencies:
fdir: "npm:^6.4.2"
picomatch: "npm:^4.0.2"
checksum: 10c0/ce946135d39b8c0e394e488ad59f4092e8c4ecd675ef1bcd4585c47de1b325e61ec6adfbfbe20c3c2bfa6fd674c5b06de2a2e65c433f752ae170aff11793e5ef
languageName: node
linkType: hard

"tinypool@npm:^1.0.0":
version: 1.0.0
resolution: "tinypool@npm:1.0.0"
Expand Down
Loading