@argos-ci/vitest 0.3.2 → 0.4.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.
- package/README.md +2 -2
- package/dist/index.d.mts +16 -0
- package/dist/plugin.d.mts +16 -0
- package/dist/plugin.mjs +6 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
Capture Argos screenshots directly from your [Vitest browser tests](https://vitest.dev/guide/browser/).
|
|
19
19
|
|
|
20
|
-
Visit the [Vitest SDK documentation](https://argos-ci.com/docs/
|
|
20
|
+
Visit the [Vitest SDK documentation](https://argos-ci.com/docs/reference/vitest) for guides, API and more.
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
@@ -140,6 +140,6 @@ when `uploadToArgos` is enabled.
|
|
|
140
140
|
|
|
141
141
|
## Links
|
|
142
142
|
|
|
143
|
-
- [Official SDK Docs](https://argos-ci.com/docs/
|
|
143
|
+
- [Official SDK Docs](https://argos-ci.com/docs/reference/vitest)
|
|
144
144
|
- [Quickstart](https://argos-ci.com/docs/quickstart/vitest-quickstart)
|
|
145
145
|
- [Discord](https://argos-ci.com/discord)
|
package/dist/index.d.mts
CHANGED
|
@@ -47,6 +47,22 @@ interface VitestScreenshotOptions {
|
|
|
47
47
|
* @default 0.5
|
|
48
48
|
*/
|
|
49
49
|
threshold?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Name, or list of names, to compare this screenshot against instead of its
|
|
52
|
+
* own name. A list is tried in order and the first name found in the baseline
|
|
53
|
+
* build wins, which lets a brand new screenshot fall back to an existing one
|
|
54
|
+
* rather than showing up as added.
|
|
55
|
+
*
|
|
56
|
+
* The screenshot's own name is not implicitly included: list it first to keep
|
|
57
|
+
* comparing against itself when it exists.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // Compare "home-variant-b" against itself, or against "home" if it is new.
|
|
61
|
+
* argosScreenshot("home-variant-b", {
|
|
62
|
+
* baseName: ["home-variant-b", "home"],
|
|
63
|
+
* })
|
|
64
|
+
*/
|
|
65
|
+
baseName?: string | string[];
|
|
50
66
|
/**
|
|
51
67
|
* Tag or array of tags to attach to the screenshot.
|
|
52
68
|
*/
|
package/dist/plugin.d.mts
CHANGED
|
@@ -58,6 +58,22 @@ interface VitestScreenshotOptions {
|
|
|
58
58
|
* @default 0.5
|
|
59
59
|
*/
|
|
60
60
|
threshold?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Name, or list of names, to compare this screenshot against instead of its
|
|
63
|
+
* own name. A list is tried in order and the first name found in the baseline
|
|
64
|
+
* build wins, which lets a brand new screenshot fall back to an existing one
|
|
65
|
+
* rather than showing up as added.
|
|
66
|
+
*
|
|
67
|
+
* The screenshot's own name is not implicitly included: list it first to keep
|
|
68
|
+
* comparing against itself when it exists.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Compare "home-variant-b" against itself, or against "home" if it is new.
|
|
72
|
+
* argosScreenshot("home-variant-b", {
|
|
73
|
+
* baseName: ["home-variant-b", "home"],
|
|
74
|
+
* })
|
|
75
|
+
*/
|
|
76
|
+
baseName?: string | string[];
|
|
61
77
|
/**
|
|
62
78
|
* Tag or array of tags to attach to the screenshot.
|
|
63
79
|
*/
|
package/dist/plugin.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { dirname, relative, resolve } from "node:path";
|
|
3
3
|
import { DO_NOT_USE_setMetadataConfig, argosScreenshot } from "@argos-ci/playwright";
|
|
4
4
|
import { resolveViewport } from "@argos-ci/browser";
|
|
5
|
-
import { createDirectory, getGitRepositoryPath, getMetadataPath, getScreenshotName, readVersionFromPackage, writeMetadata } from "@argos-ci/util";
|
|
5
|
+
import { createDirectory, getGitRepositoryPath, getMetadataPath, getScreenshotName, normalizeBaseNames, readVersionFromPackage, writeMetadata } from "@argos-ci/util";
|
|
6
6
|
import { writeFile } from "node:fs/promises";
|
|
7
7
|
import { getSnapshotMimeType, readConfig, upload } from "@argos-ci/core";
|
|
8
8
|
//#region src/iframe.ts
|
|
@@ -169,6 +169,7 @@ const createArgosScreenshotCommand = (pluginOptions = {}) => {
|
|
|
169
169
|
...pluginOptions,
|
|
170
170
|
...options
|
|
171
171
|
};
|
|
172
|
+
const baseNames = normalizeBaseNames(merged.baseName);
|
|
172
173
|
const fullPage = merged.fullPage ?? false;
|
|
173
174
|
const fitWidth = !fullPage;
|
|
174
175
|
const restore = await resetTesterScale(ctx);
|
|
@@ -190,7 +191,10 @@ const createArgosScreenshotCommand = (pluginOptions = {}) => {
|
|
|
190
191
|
const size = resolveViewport(viewport);
|
|
191
192
|
await setIframeViewportSize(ctx, size, { fullPage });
|
|
192
193
|
setMetadata(size);
|
|
193
|
-
const shot = await screenshotFrame(ctx, getScreenshotName(name, { viewportWidth: size.width }),
|
|
194
|
+
const shot = await screenshotFrame(ctx, getScreenshotName(name, { viewportWidth: size.width }), {
|
|
195
|
+
...merged,
|
|
196
|
+
baseName: baseNames?.map((baseName) => getScreenshotName(baseName, { viewportWidth: size.width }))
|
|
197
|
+
}, { fitWidth: false });
|
|
194
198
|
attachments.push(...shot);
|
|
195
199
|
await setIframeViewportSize(ctx, "initial", { fullPage });
|
|
196
200
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/vitest",
|
|
3
3
|
"description": "Vitest SDK for visual testing with Argos.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/argos-ci/argos-javascript.git",
|
|
10
10
|
"directory": "packages/vitest"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://argos-ci.com/docs/
|
|
12
|
+
"homepage": "https://argos-ci.com/docs/reference/vitest",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/argos-ci/argos-javascript/issues"
|
|
15
15
|
},
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@argos-ci/browser": "6.4.4",
|
|
55
|
-
"@argos-ci/core": "6.
|
|
56
|
-
"@argos-ci/playwright": "7.
|
|
57
|
-
"@argos-ci/util": "4.0
|
|
55
|
+
"@argos-ci/core": "6.7.0",
|
|
56
|
+
"@argos-ci/playwright": "7.4.0",
|
|
57
|
+
"@argos-ci/util": "4.1.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@vitest/browser": ">=4",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"check-format": "prettier --check --ignore-unknown --ignore-path=./.gitignore --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
|
|
82
82
|
"lint": "eslint ."
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "a3083087b11004e0b315e2d14f1e9179cbd56da2"
|
|
85
85
|
}
|