Skip to content

Commit

Permalink
Merge pull request #29817 from storybookjs/replace-glob-with-tinyglobby
Browse files Browse the repository at this point in the history
Addon Test: Replace `glob` with `tinyglobby`
  • Loading branch information
ghengeveld authored Dec 5, 2024
2 parents d908610 + d57d02e commit a197110
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
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 @@ -6623,7 +6623,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 @@ -6634,6 +6633,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 @@ -15759,7 +15759,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 @@ -23193,6 +23193,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 @@ -27704,6 +27711,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

0 comments on commit a197110

Please sign in to comment.