Skip to content

Commit a197110

Browse files
authored
Merge pull request #29817 from storybookjs/replace-glob-with-tinyglobby
Addon Test: Replace `glob` with `tinyglobby`
2 parents d908610 + d57d02e commit a197110

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

code/addons/test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"execa": "^8.0.1",
104104
"find-up": "^7.0.0",
105105
"formik": "^2.2.9",
106-
"glob": "^10.0.0",
107106
"istanbul-lib-report": "^3.0.1",
108107
"pathe": "^1.1.2",
109108
"picocolors": "^1.1.0",
@@ -112,6 +111,7 @@
112111
"semver": "^7.6.3",
113112
"slash": "^5.0.0",
114113
"strip-ansi": "^7.1.0",
114+
"tinyglobby": "^0.2.10",
115115
"ts-dedent": "^2.2.0",
116116
"typescript": "^5.3.2",
117117
"vitest": "^2.1.3"

code/addons/test/src/vitest-plugin/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import { readConfig, vitestTransform } from 'storybook/internal/csf-tools';
1212
import { MainFileMissingError } from 'storybook/internal/server-errors';
1313
import type { DocsOptions, StoriesEntry } from 'storybook/internal/types';
1414

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

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

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

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

130125
config.test.exclude ??= [];
131126
config.test.exclude.push('**/*.mdx');

code/yarn.lock

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6623,7 +6623,6 @@ __metadata:
66236623
execa: "npm:^8.0.1"
66246624
find-up: "npm:^7.0.0"
66256625
formik: "npm:^2.2.9"
6626-
glob: "npm:^10.0.0"
66276626
istanbul-lib-report: "npm:^3.0.1"
66286627
pathe: "npm:^1.1.2"
66296628
picocolors: "npm:^1.1.0"
@@ -6634,6 +6633,7 @@ __metadata:
66346633
semver: "npm:^7.6.3"
66356634
slash: "npm:^5.0.0"
66366635
strip-ansi: "npm:^7.1.0"
6636+
tinyglobby: "npm:^0.2.10"
66376637
ts-dedent: "npm:^2.2.0"
66386638
typescript: "npm:^5.3.2"
66396639
vitest: "npm:^2.1.3"
@@ -15759,7 +15759,7 @@ __metadata:
1575915759
languageName: node
1576015760
linkType: hard
1576115761

15762-
"fdir@npm:^6.2.0":
15762+
"fdir@npm:^6.2.0, fdir@npm:^6.4.2":
1576315763
version: 6.4.2
1576415764
resolution: "fdir@npm:6.4.2"
1576515765
peerDependencies:
@@ -23193,6 +23193,13 @@ __metadata:
2319323193
languageName: node
2319423194
linkType: hard
2319523195

23196+
"picomatch@npm:^4.0.2":
23197+
version: 4.0.2
23198+
resolution: "picomatch@npm:4.0.2"
23199+
checksum: 10c0/7c51f3ad2bb42c776f49ebf964c644958158be30d0a510efd5a395e8d49cb5acfed5b82c0c5b365523ce18e6ab85013c9ebe574f60305892ec3fa8eee8304ccc
23200+
languageName: node
23201+
linkType: hard
23202+
2319623203
"picoquery@npm:^1.4.0":
2319723204
version: 1.4.0
2319823205
resolution: "picoquery@npm:1.4.0"
@@ -27704,6 +27711,16 @@ __metadata:
2770427711
languageName: node
2770527712
linkType: hard
2770627713

27714+
"tinyglobby@npm:^0.2.10":
27715+
version: 0.2.10
27716+
resolution: "tinyglobby@npm:0.2.10"
27717+
dependencies:
27718+
fdir: "npm:^6.4.2"
27719+
picomatch: "npm:^4.0.2"
27720+
checksum: 10c0/ce946135d39b8c0e394e488ad59f4092e8c4ecd675ef1bcd4585c47de1b325e61ec6adfbfbe20c3c2bfa6fd674c5b06de2a2e65c433f752ae170aff11793e5ef
27721+
languageName: node
27722+
linkType: hard
27723+
2770727724
"tinypool@npm:^1.0.0":
2770827725
version: 1.0.0
2770927726
resolution: "tinypool@npm:1.0.0"

0 commit comments

Comments
 (0)