@argos-ci/storybook 5.1.0 → 5.2.0

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.
@@ -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
- ctx;
223
+ vitest;
224
224
  config;
225
225
  constructor(config) {
226
226
  this.config = config;
227
227
  }
228
- onInit(ctx) {
229
- this.ctx = ctx;
228
+ onInit(vitest) {
229
+ this.vitest = vitest;
230
230
  }
231
+ // Compatibility for Vitest v3
231
232
  async onFinished() {
232
- if (this.ctx.config.watch) {
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("@vitest/browser/context");
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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vitest from 'vitest';
2
- import { MetadataConfig, ArgosScreenshotOptions as ArgosScreenshotOptions$1, Attachment } from '@argos-ci/playwright';
2
+ import { MetadataConfig, ArgosScreenshotOptions as ArgosScreenshotOptions$1, ArgosAttachment } from '@argos-ci/playwright';
3
3
  import { Page, Frame, ViewportSize } from 'playwright';
4
4
 
5
5
  type StorybookGlobals = Record<string, any>;
@@ -36,7 +36,7 @@ type ArgosScreenshotCommandArgs = [
36
36
 
37
37
  declare module "vitest/browser" {
38
38
  interface BrowserCommands {
39
- argosScreenshot: (...args: ArgosScreenshotCommandArgs) => Promise<Attachment[]>;
39
+ argosScreenshot: (...args: ArgosScreenshotCommandArgs) => Promise<ArgosAttachment[]>;
40
40
  }
41
41
  }
42
42
  /**
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("@vitest/browser/context");
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("@vitest/browser/context");
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("@vitest/browser/context");
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.0",
4
+ "version": "5.2.0",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -50,12 +50,12 @@
50
50
  "node": ">=20.0.0"
51
51
  },
52
52
  "dependencies": {
53
- "@argos-ci/playwright": "6.2.0",
54
- "@argos-ci/util": "3.1.1"
53
+ "@argos-ci/playwright": "6.3.0",
54
+ "@argos-ci/util": "3.2.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@argos-ci/cli": "3.2.0",
58
- "@argos-ci/core": "4.4.0",
57
+ "@argos-ci/cli": "3.2.1",
58
+ "@argos-ci/core": "4.5.0",
59
59
  "@argos-ci/util": "workspace:*",
60
60
  "@storybook/addon-docs": "^10.0.1",
61
61
  "@storybook/addon-links": "^10.0.1",
@@ -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": "7b770d9d0c621980319bd5a195413f96c54d5752"
102
+ "gitHead": "fb54cf311b705f214041f18443352577be01e822"
103
103
  }