@argos-ci/storybook 5.1.0 → 5.1.1
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/vitest-plugin.js +14 -5
- package/dist/vitest-setup-file.js +1 -1
- package/dist/vitest.js +3 -3
- package/package.json +2 -2
package/dist/vitest-plugin.js
CHANGED
|
@@ -220,16 +220,21 @@ function composeName(name, suffix) {
|
|
|
220
220
|
// src/vitest-reporter.ts
|
|
221
221
|
import { upload } from "@argos-ci/core";
|
|
222
222
|
var ArgosReporter = class {
|
|
223
|
-
|
|
223
|
+
vitest;
|
|
224
224
|
config;
|
|
225
225
|
constructor(config) {
|
|
226
226
|
this.config = config;
|
|
227
227
|
}
|
|
228
|
-
onInit(
|
|
229
|
-
this.
|
|
228
|
+
onInit(vitest) {
|
|
229
|
+
this.vitest = vitest;
|
|
230
230
|
}
|
|
231
|
+
// Compatibility for Vitest v3
|
|
231
232
|
async onFinished() {
|
|
232
|
-
|
|
233
|
+
await this.onTestRunEnd();
|
|
234
|
+
}
|
|
235
|
+
// Only on Vitest v4
|
|
236
|
+
async onTestRunEnd() {
|
|
237
|
+
if (this.vitest.config.watch) {
|
|
233
238
|
return;
|
|
234
239
|
}
|
|
235
240
|
const res = await upload(this.config);
|
|
@@ -279,8 +284,12 @@ var createArgosScreenshotCommand = (pluginOptions) => {
|
|
|
279
284
|
iframe.style.width = `${size2.width}px`;
|
|
280
285
|
}
|
|
281
286
|
if (fullPage) {
|
|
287
|
+
if (!iframe.contentWindow) {
|
|
288
|
+
throw new Error(`Can't access iframe window`);
|
|
289
|
+
}
|
|
290
|
+
const viewportHeight = size2 === "default" ? iframe.contentWindow.innerHeight : size2.height;
|
|
282
291
|
iframe.style.height = "auto";
|
|
283
|
-
iframe.style.height = `${iframe.contentDocument.body.offsetHeight}px
|
|
292
|
+
iframe.style.height = viewportHeight < iframe.contentDocument.body.offsetHeight ? `${iframe.contentDocument.body.offsetHeight}px` : "100%";
|
|
284
293
|
} else if (size2 !== "default") {
|
|
285
294
|
iframe.style.height = "auto";
|
|
286
295
|
iframe.style.height = `${size2.height}px`;
|
|
@@ -10,7 +10,7 @@ function setupArgos(api) {
|
|
|
10
10
|
`@argos-ci/storybook/vitest-plugin should be used with @storybook/addon-vitest/vitest-plugin`
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
const { server } = await import("
|
|
13
|
+
const { server } = await import("vitest/browser");
|
|
14
14
|
globalThis.__ARGOS_STORYBOOK_STORY = story;
|
|
15
15
|
await server.commands.argosScreenshot({
|
|
16
16
|
mode: "automatic",
|
package/dist/vitest.js
CHANGED
|
@@ -7,7 +7,7 @@ function setupArgos(api) {
|
|
|
7
7
|
`@argos-ci/storybook/vitest-plugin should be used with @storybook/addon-vitest/vitest-plugin`
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
|
-
const { server } = await import("
|
|
10
|
+
const { server } = await import("vitest/browser");
|
|
11
11
|
globalThis.__ARGOS_STORYBOOK_STORY = story;
|
|
12
12
|
await server.commands.argosScreenshot({
|
|
13
13
|
mode: "automatic",
|
|
@@ -35,7 +35,7 @@ async function argosScreenshot(story, name) {
|
|
|
35
35
|
if (!isVitest) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
const { server } = await import("
|
|
38
|
+
const { server } = await import("vitest/browser");
|
|
39
39
|
await server.commands.argosScreenshot({
|
|
40
40
|
mode: "manual",
|
|
41
41
|
name: `${story.id}/${name}`,
|
|
@@ -48,7 +48,7 @@ async function argosScreenshot(story, name) {
|
|
|
48
48
|
}
|
|
49
49
|
async function checkIsVitestEnv() {
|
|
50
50
|
try {
|
|
51
|
-
await import("
|
|
51
|
+
await import("vitest");
|
|
52
52
|
return true;
|
|
53
53
|
} catch {
|
|
54
54
|
return false;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/storybook",
|
|
3
3
|
"description": "Visual testing for Storybook test runner.",
|
|
4
|
-
"version": "5.1.
|
|
4
|
+
"version": "5.1.1",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"check-format": "prettier --check --ignore-unknown --ignore-path=./.gitignore --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
|
|
100
100
|
"lint": "eslint ."
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "c755182c9d7aba21bf79ef6c721d909a04b4da83"
|
|
103
103
|
}
|