@forgebook/testing 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/storyFiles.d.ts
CHANGED
|
@@ -11,8 +11,7 @@ export type StoryFilesOptions = {
|
|
|
11
11
|
readonly patterns: readonly string[];
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
* The story files the patterns match, as the source's keys (
|
|
15
|
-
* leading `../` moved into it, `./src/x.stories.tsx`), sorted.
|
|
14
|
+
* The story files the patterns match, as the source's keys (`./x` or `../x`, relative to `root`), sorted.
|
|
16
15
|
*
|
|
17
16
|
* @param options - where the files are.
|
|
18
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storyFiles.d.ts","sourceRoot":"","sources":["../../src/storyFiles.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAMlF,yCAAyC;AACzC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kGAAkG;IAClG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qHAAqH;IACrH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"storyFiles.d.ts","sourceRoot":"","sources":["../../src/storyFiles.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAMlF,yCAAyC;AACzC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kGAAkG;IAClG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qHAAqH;IACrH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,YAAa,iBAAiB,KAAG,MAAM,EACf,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,YAAa,iBAAiB,KAAG,WAmB1D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,YAAa,iBAAiB,UAAU,WAAW,KAAG,MAAM,EAS1F,CAAC"}
|
package/dist/src/storyFiles.js
CHANGED
|
@@ -14,20 +14,13 @@ import { join } from "node:path";
|
|
|
14
14
|
import { sourceFiles } from "forgebook/source-files";
|
|
15
15
|
import { autoTitle, patternBase } from "forgebook/vite/auto-title";
|
|
16
16
|
import { indexStoryFile } from "forgebook/vite/index-story-file";
|
|
17
|
-
import { storyFileKeys
|
|
17
|
+
import { storyFileKeys } from "forgebook/vite/story-files-module";
|
|
18
18
|
/**
|
|
19
|
-
* The
|
|
19
|
+
* The story files the patterns match, as the source's keys (`./x` or `../x`, relative to `root`), sorted.
|
|
20
20
|
*
|
|
21
21
|
* @param options - where the files are.
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
24
|
-
/**
|
|
25
|
-
* The story files the patterns match, as the source's keys (the plugin's: relative to each pattern's folder once its
|
|
26
|
-
* leading `../` moved into it, `./src/x.stories.tsx`), sorted.
|
|
27
|
-
*
|
|
28
|
-
* @param options - where the files are.
|
|
29
|
-
*/
|
|
30
|
-
export const storyFiles = (options) => [...new Set(groupsOf(options).flatMap((group) => storyFileKeys(group.root, [group.pattern])))].sort();
|
|
23
|
+
export const storyFiles = (options) => storyFileKeys(options.root, options.patterns);
|
|
31
24
|
/**
|
|
32
25
|
* A source with its index read from the disk and no loaders: enough for the story tree, the ids and the tests.
|
|
33
26
|
*
|
|
@@ -36,18 +29,15 @@ export const storyFiles = (options) => [...new Set(groupsOf(options).flatMap((gr
|
|
|
36
29
|
*/
|
|
37
30
|
export const indexedSource = (options) => {
|
|
38
31
|
const index = {};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
throw new Error(entry);
|
|
49
|
-
index[file] = entry;
|
|
50
|
-
}
|
|
32
|
+
for (const file of storyFiles(options)) {
|
|
33
|
+
// the title the plugin gives: from the first pattern that matches the file, as each pattern is one module
|
|
34
|
+
const pattern = options.patterns.find((candidate) => storyFileKeys(options.root, [candidate]).includes(file));
|
|
35
|
+
const title = pattern === undefined ? undefined : autoTitle(patternBase(pattern), file);
|
|
36
|
+
const text = readFileSync(join(options.root, file), "utf8");
|
|
37
|
+
const entry = indexStoryFile(file, text, title === undefined ? {} : { autoTitle: title });
|
|
38
|
+
if (typeof entry === "string")
|
|
39
|
+
throw new Error(entry);
|
|
40
|
+
index[file] = entry;
|
|
51
41
|
}
|
|
52
42
|
return {
|
|
53
43
|
id: options.sourceId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storyFiles.js","sourceRoot":"","sources":["../../src/storyFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"storyFiles.js","sourceRoot":"","sources":["../../src/storyFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,E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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgebook/testing",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Tests from a package's stories: each story and variant in the browser with axe, spills and overlays, screenshots, and each story rendered on the server.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@axe-core/playwright": "4.14.0",
|
|
70
70
|
"@ensiria/cli-kit": "^0.1.1",
|
|
71
|
-
"@forgebook/story-format": "0.1.
|
|
71
|
+
"@forgebook/story-format": "0.1.4"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@playwright/test": "^1.64.0",
|
|
75
75
|
"vite": "^8.0.0",
|
|
76
76
|
"vitest": "^5.0.0",
|
|
77
|
-
"forgebook": "^0.1.
|
|
77
|
+
"forgebook": "^0.1.6"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@playwright/test": "1.64.1",
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"react": "19.3.0",
|
|
84
84
|
"vite": "8.3.5",
|
|
85
85
|
"vitest": "5.0.5",
|
|
86
|
-
"@forgebook/tools": "0.0.0",
|
|
87
86
|
"@forgebook/typescript-config": "0.0.0",
|
|
88
|
-
"forgebook": "0.
|
|
87
|
+
"@forgebook/tools": "0.0.0",
|
|
88
|
+
"forgebook": "0.1.6"
|
|
89
89
|
},
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|