happo 6.0.0-beta.5 → 6.0.0-beta.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/cli/{cancelJob-BTQFKZIA.js → cancelJob-ZSTC24AN.js} +3 -3
- package/dist/cli/{chunk-Q6MYY7SZ.js → chunk-33S3P2UT.js} +4 -4
- package/dist/cli/{chunk-Q6MYY7SZ.js.map → chunk-33S3P2UT.js.map} +2 -2
- package/dist/cli/{chunk-RRBBL3EW.js → chunk-HCMCNDII.js} +2 -2
- package/dist/cli/{chunk-RQIPXFYO.js → chunk-MQN57GVD.js} +4 -9
- package/dist/cli/{chunk-RQIPXFYO.js.map → chunk-MQN57GVD.js.map} +2 -2
- package/dist/cli/createAsyncComparison-Y3V5JEEI.js +9 -0
- package/dist/cli/{createAsyncReport-IROUZ4HE.js → createAsyncReport-MUPQH5YG.js} +3 -3
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +156 -85
- package/dist/cli/index.js.map +2 -2
- package/dist/cli/package-CZSERZWI.js +7 -0
- package/dist/cli/{prepareSnapRequests-ULZ2RJ6S.js → prepareSnapRequests-KXP2GCXB.js} +163 -62
- package/dist/cli/prepareSnapRequests-KXP2GCXB.js.map +7 -0
- package/dist/cli/{startJob-5B6M5C6Y.js → startJob-4EQXSOMD.js} +3 -3
- package/dist/cli/{wrapper-ISNKAWC2.js → wrapper-GHIE52PM.js} +29 -41
- package/dist/cli/wrapper-GHIE52PM.js.map +7 -0
- package/dist/config/index.d.ts +15 -10
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js.map +2 -2
- package/dist/config/loadConfig.d.ts.map +1 -1
- package/dist/cypress/index.d.ts +0 -1
- package/dist/cypress/index.d.ts.map +1 -1
- package/dist/cypress/index.js.map +2 -2
- package/dist/cypress/task.js +106 -557
- package/dist/cypress/task.js.map +4 -4
- package/dist/e2e/controller.d.ts +0 -13
- package/dist/e2e/controller.d.ts.map +1 -1
- package/dist/e2e/createAssetPackage.d.ts +3 -1
- package/dist/e2e/createAssetPackage.d.ts.map +1 -1
- package/dist/e2e/wrapper.d.ts +3 -3
- package/dist/e2e/wrapper.d.ts.map +1 -1
- package/dist/environment/index.d.ts +18 -2
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/network/createAsyncComparison.d.ts +1 -1
- package/dist/network/createAsyncComparison.d.ts.map +1 -1
- package/dist/network/postGitHubComment.d.ts +1 -2
- package/dist/network/postGitHubComment.d.ts.map +1 -1
- package/dist/network/startServer.d.ts +3 -1
- package/dist/network/startServer.d.ts.map +1 -1
- package/dist/playwright/index.js +106 -557
- package/dist/playwright/index.js.map +4 -4
- package/dist/storybook/index.d.ts.map +1 -1
- package/dist/storybook/index.js +1 -4
- package/dist/storybook/index.js.map +2 -2
- package/dist/utils/Logger.d.ts.map +1 -1
- package/dist/utils/deterministicArchive.d.ts.map +1 -1
- package/dist/utils/validateArchive.d.ts +2 -3
- package/dist/utils/validateArchive.d.ts.map +1 -1
- package/package.json +3 -8
- package/dist/cli/chunk-GG2PHBJN.js +0 -103
- package/dist/cli/chunk-GG2PHBJN.js.map +0 -7
- package/dist/cli/createAsyncComparison-IWILXO74.js +0 -9
- package/dist/cli/package-Z7RTWGGQ.js +0 -7
- package/dist/cli/prepareSnapRequests-ULZ2RJ6S.js.map +0 -7
- package/dist/cli/wrapper-ISNKAWC2.js.map +0 -7
- /package/dist/cli/{cancelJob-BTQFKZIA.js.map → cancelJob-ZSTC24AN.js.map} +0 -0
- /package/dist/cli/{chunk-RRBBL3EW.js.map → chunk-HCMCNDII.js.map} +0 -0
- /package/dist/cli/{createAsyncComparison-IWILXO74.js.map → createAsyncComparison-Y3V5JEEI.js.map} +0 -0
- /package/dist/cli/{createAsyncReport-IROUZ4HE.js.map → createAsyncReport-MUPQH5YG.js.map} +0 -0
- /package/dist/cli/{package-Z7RTWGGQ.js.map → package-CZSERZWI.js.map} +0 -0
- /package/dist/cli/{startJob-5B6M5C6Y.js.map → startJob-4EQXSOMD.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeHappoAPIRequest
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-HCMCNDII.js";
|
|
4
|
+
import "./chunk-MQN57GVD.js";
|
|
5
5
|
|
|
6
6
|
// src/network/cancelJob.ts
|
|
7
7
|
async function cancelJob(status, config, { beforeSha, afterSha, link, message }, logger) {
|
|
@@ -24,4 +24,4 @@ async function cancelJob(status, config, { beforeSha, afterSha, link, message },
|
|
|
24
24
|
export {
|
|
25
25
|
cancelJob as default
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=cancelJob-
|
|
27
|
+
//# sourceMappingURL=cancelJob-ZSTC24AN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeHappoAPIRequest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HCMCNDII.js";
|
|
4
4
|
|
|
5
5
|
// src/network/createAsyncComparison.ts
|
|
6
6
|
function assertResultIsCreateAsyncComparisonResult(result) {
|
|
@@ -22,7 +22,7 @@ async function createAsyncComparison(config, {
|
|
|
22
22
|
afterSha,
|
|
23
23
|
link,
|
|
24
24
|
message,
|
|
25
|
-
|
|
25
|
+
authorEmail,
|
|
26
26
|
notify,
|
|
27
27
|
fallbackShas
|
|
28
28
|
}, logger) {
|
|
@@ -38,7 +38,7 @@ async function createAsyncComparison(config, {
|
|
|
38
38
|
body: {
|
|
39
39
|
link,
|
|
40
40
|
message,
|
|
41
|
-
author,
|
|
41
|
+
author: authorEmail,
|
|
42
42
|
project: config.project,
|
|
43
43
|
isAsync: true,
|
|
44
44
|
notify,
|
|
@@ -56,4 +56,4 @@ async function createAsyncComparison(config, {
|
|
|
56
56
|
export {
|
|
57
57
|
createAsyncComparison
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-33S3P2UT.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/network/createAsyncComparison.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ConfigWithDefaults } from '../config/index.ts';\nimport type { EnvironmentResult } from '../environment/index.ts';\nimport type { Logger } from '../isomorphic/types.ts';\nimport makeHappoAPIRequest from './makeHappoAPIRequest.ts';\n\ninterface CreateAsyncComparisonResult {\n id: number;\n statusImageUrl: string;\n compareUrl: string;\n}\n\nfunction assertResultIsCreateAsyncComparisonResult(\n result: unknown,\n): asserts result is CreateAsyncComparisonResult {\n if (typeof result !== 'object' || result === null) {\n throw new TypeError('Result is not an object');\n }\n\n if (!('id' in result) || typeof result.id !== 'number') {\n throw new TypeError('Result is missing id');\n }\n\n if (!('statusImageUrl' in result) || typeof result.statusImageUrl !== 'string') {\n throw new TypeError('Result is missing statusImageUrl');\n }\n\n if (!('compareUrl' in result) || typeof result.compareUrl !== 'string') {\n throw new TypeError('Result is missing compareUrl');\n }\n}\n\n/**\n * Create an async comparison between two SHAs\n *\n * @see https://happo.io/docs/api#compareReports\n */\nexport default async function createAsyncComparison(\n config: ConfigWithDefaults,\n {\n beforeSha,\n afterSha,\n link,\n message,\n
|
|
5
|
-
"mappings": ";;;;;AAWA,SAAS,0CACP,QAC+C;AAC/C,MAAI,OAAO,WAAW,YAAY,WAAW,MAAM;AACjD,UAAM,IAAI,UAAU,yBAAyB;AAAA,EAC/C;AAEA,MAAI,EAAE,QAAQ,WAAW,OAAO,OAAO,OAAO,UAAU;AACtD,UAAM,IAAI,UAAU,sBAAsB;AAAA,EAC5C;AAEA,MAAI,EAAE,oBAAoB,WAAW,OAAO,OAAO,mBAAmB,UAAU;AAC9E,UAAM,IAAI,UAAU,kCAAkC;AAAA,EACxD;AAEA,MAAI,EAAE,gBAAgB,WAAW,OAAO,OAAO,eAAe,UAAU;AACtE,UAAM,IAAI,UAAU,8BAA8B;AAAA,EACpD;AACF;AAOA,eAAO,sBACL,QACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,QACsC;AACtC,MAAI,cAAc,UAAU;AAC1B,UAAM,IAAI;AAAA,MACR,qEAAqE,SAAS,cAAc,QAAQ;AAAA,IACtG;AAAA,EACF;AAEA,QAAM,SAAS,MAAM;AAAA,IACnB;AAAA,MACE,MAAM,gBAAgB,SAAS,YAAY,QAAQ;AAAA,MACnD,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import type { ConfigWithDefaults } from '../config/index.ts';\nimport type { EnvironmentResult } from '../environment/index.ts';\nimport type { Logger } from '../isomorphic/types.ts';\nimport makeHappoAPIRequest from './makeHappoAPIRequest.ts';\n\ninterface CreateAsyncComparisonResult {\n id: number;\n statusImageUrl: string;\n compareUrl: string;\n}\n\nfunction assertResultIsCreateAsyncComparisonResult(\n result: unknown,\n): asserts result is CreateAsyncComparisonResult {\n if (typeof result !== 'object' || result === null) {\n throw new TypeError('Result is not an object');\n }\n\n if (!('id' in result) || typeof result.id !== 'number') {\n throw new TypeError('Result is missing id');\n }\n\n if (!('statusImageUrl' in result) || typeof result.statusImageUrl !== 'string') {\n throw new TypeError('Result is missing statusImageUrl');\n }\n\n if (!('compareUrl' in result) || typeof result.compareUrl !== 'string') {\n throw new TypeError('Result is missing compareUrl');\n }\n}\n\n/**\n * Create an async comparison between two SHAs\n *\n * @see https://happo.io/docs/api#compareReports\n */\nexport default async function createAsyncComparison(\n config: ConfigWithDefaults,\n {\n beforeSha,\n afterSha,\n link,\n message,\n authorEmail,\n notify,\n fallbackShas,\n }: EnvironmentResult,\n logger: Logger,\n): Promise<CreateAsyncComparisonResult> {\n if (beforeSha === afterSha) {\n throw new Error(\n `Cannot create an async comparison between the same SHA (beforeSha=${beforeSha}, afterSha=${afterSha})`,\n );\n }\n\n const result = await makeHappoAPIRequest(\n {\n path: `/api/reports/${beforeSha}/compare/${afterSha}`,\n method: 'POST',\n body: {\n link,\n message,\n author: authorEmail,\n project: config.project,\n isAsync: true,\n notify,\n fallbackShas,\n },\n },\n config,\n { retryCount: 3 },\n logger,\n );\n\n assertResultIsCreateAsyncComparisonResult(result);\n\n return result;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAWA,SAAS,0CACP,QAC+C;AAC/C,MAAI,OAAO,WAAW,YAAY,WAAW,MAAM;AACjD,UAAM,IAAI,UAAU,yBAAyB;AAAA,EAC/C;AAEA,MAAI,EAAE,QAAQ,WAAW,OAAO,OAAO,OAAO,UAAU;AACtD,UAAM,IAAI,UAAU,sBAAsB;AAAA,EAC5C;AAEA,MAAI,EAAE,oBAAoB,WAAW,OAAO,OAAO,mBAAmB,UAAU;AAC9E,UAAM,IAAI,UAAU,kCAAkC;AAAA,EACxD;AAEA,MAAI,EAAE,gBAAgB,WAAW,OAAO,OAAO,eAAe,UAAU;AACtE,UAAM,IAAI,UAAU,8BAA8B;AAAA,EACpD;AACF;AAOA,eAAO,sBACL,QACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,QACsC;AACtC,MAAI,cAAc,UAAU;AAC1B,UAAM,IAAI;AAAA,MACR,qEAAqE,SAAS,cAAc,QAAQ;AAAA,IACtG;AAAA,EACF;AAEA,QAAM,SAAS,MAAM;AAAA,IACnB;AAAA,MACE,MAAM,gBAAgB,SAAS,YAAY,QAAQ;AAAA,MACnD,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA,QAAQ;AAAA,QACR,SAAS,OAAO;AAAA,QAChB,SAAS;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,IACA,EAAE,YAAY,EAAE;AAAA,IAChB;AAAA,EACF;AAEA,4CAA0C,MAAM;AAEhD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MQN57GVD.js";
|
|
4
4
|
|
|
5
5
|
// src/network/makeHappoAPIRequest.ts
|
|
6
6
|
import { SignJWT } from "jose";
|
|
@@ -138,4 +138,4 @@ async function makeHappoAPIRequest({ url, path, method = "GET", formData, body }
|
|
|
138
138
|
export {
|
|
139
139
|
makeHappoAPIRequest
|
|
140
140
|
};
|
|
141
|
-
//# sourceMappingURL=chunk-
|
|
141
|
+
//# sourceMappingURL=chunk-HCMCNDII.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "happo",
|
|
4
|
-
version: "6.0.0-beta.
|
|
4
|
+
version: "6.0.0-beta.7",
|
|
5
5
|
description: "Visual regression testing and accessibility testing",
|
|
6
6
|
license: "MIT",
|
|
7
7
|
repository: {
|
|
@@ -107,8 +107,6 @@ var package_default = {
|
|
|
107
107
|
"@reporters/github": "^1.11.0",
|
|
108
108
|
"@storybook/builder-vite": "^10.0.1",
|
|
109
109
|
"@storybook/react-vite": "^10.0.1",
|
|
110
|
-
"@types/adm-zip": "^0.5.7",
|
|
111
|
-
"@types/archiver": "^7.0.0",
|
|
112
110
|
"@types/async-retry": "^1.4.9",
|
|
113
111
|
"@types/base64-stream": "^1.0.5",
|
|
114
112
|
"@types/jsdom": "^27.0.0",
|
|
@@ -118,7 +116,6 @@ var package_default = {
|
|
|
118
116
|
"@types/react": "^19.2.0",
|
|
119
117
|
"@types/react-dom": "^19.2.0",
|
|
120
118
|
"@types/serve-handler": "^6.1.4",
|
|
121
|
-
"adm-zip": "^0.5.16",
|
|
122
119
|
cypress: "^15.5.0",
|
|
123
120
|
esbuild: "^0.25.10",
|
|
124
121
|
eslint: "^9.36.0",
|
|
@@ -140,16 +137,14 @@ var package_default = {
|
|
|
140
137
|
"typescript-eslint": "^8.44.1"
|
|
141
138
|
},
|
|
142
139
|
dependencies: {
|
|
143
|
-
archiver: "^7.0.1",
|
|
144
140
|
"async-retry": "^1.3.3",
|
|
145
141
|
"base64-stream": "^1.0.0",
|
|
146
142
|
empathic: "^2.0.0",
|
|
147
|
-
|
|
143
|
+
fflate: "^0.8.2",
|
|
148
144
|
jose: "^6.1.0",
|
|
149
145
|
"mime-types": "^3.0.1",
|
|
150
146
|
"p-all": "^5.0.1",
|
|
151
|
-
srcset: "^5.0.2"
|
|
152
|
-
"supports-color": "^10.2.2"
|
|
147
|
+
srcset: "^5.0.2"
|
|
153
148
|
},
|
|
154
149
|
keywords: [
|
|
155
150
|
"accessibility",
|
|
@@ -170,4 +165,4 @@ var package_default = {
|
|
|
170
165
|
export {
|
|
171
166
|
package_default
|
|
172
167
|
};
|
|
173
|
-
//# sourceMappingURL=chunk-
|
|
168
|
+
//# sourceMappingURL=chunk-MQN57GVD.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../package.json"],
|
|
4
|
-
"sourcesContent": ["{\n \"name\": \"happo\",\n \"version\": \"6.0.0-beta.
|
|
5
|
-
"mappings": ";AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,EACX,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,UAAY;AAAA,EACZ,KAAO;AAAA,IACL,OAAS;AAAA,EACX;AAAA,EACA,MAAQ;AAAA,EACR,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,SAAW;AAAA,IACb;AAAA,IACA,aAAa;AAAA,MACX,OAAS;AAAA,MACT,SAAW;AAAA,IACb;AAAA,IACA,kBAAkB;AAA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;AAAA,IACrB,2BAA2B;AAAA,IAC3B,yBAAyB;AAAA,IACzB,
|
|
4
|
+
"sourcesContent": ["{\n \"name\": \"happo\",\n \"version\": \"6.0.0-beta.7\",\n \"description\": \"Visual regression testing and accessibility testing\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/happo/happo.git\"\n },\n \"bugs\": \"https://github.com/happo/happo/issues\",\n \"homepage\": \"https://happo.io\",\n \"bin\": {\n \"happo\": \"dist/cli/index.js\"\n },\n \"type\": \"module\",\n \"main\": \"./dist/config/index.js\",\n \"types\": \"./dist/config/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/config/index.d.ts\",\n \"default\": \"./dist/config/index.js\"\n },\n \"./cypress\": {\n \"types\": \"./dist/cypress/index.d.ts\",\n \"default\": \"./dist/cypress/index.js\"\n },\n \"./cypress/task\": {\n \"types\": \"./dist/cypress/task.d.ts\",\n \"default\": \"./dist/cypress/task.js\"\n },\n \"./playwright\": {\n \"types\": \"./dist/playwright/index.d.ts\",\n \"default\": \"./dist/playwright/index.js\"\n },\n \"./custom\": {\n \"types\": \"./dist/custom/index.d.ts\",\n \"default\": \"./dist/custom/index.js\"\n },\n \"./storybook/addon\": {\n \"types\": \"./dist/storybook/browser/addon.d.ts\",\n \"default\": \"./dist/storybook/browser/addon.js\"\n },\n \"./storybook/decorator\": {\n \"types\": \"./dist/storybook/browser/decorator.d.ts\",\n \"default\": \"./dist/storybook/browser/decorator.js\"\n },\n \"./storybook/preset\": {\n \"types\": \"./dist/storybook/preset.d.ts\",\n \"default\": \"./dist/storybook/preset.js\"\n },\n \"./storybook/register\": {\n \"types\": \"./dist/storybook/browser/register.d.ts\",\n \"default\": \"./dist/storybook/browser/register.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"all\": \"node ./scripts/allchecks.ts\",\n \"build\": \"pnpm build:types && pnpm build:dist\",\n \"build:custom\": \"esbuild src/custom/__happo__/index.ts --bundle --format=iife --global-name=happoCustom --outfile=tmp/happo-custom/bundle.js --platform=browser --target=esnext\",\n \"build:dist\": \"./scripts/build.ts\",\n \"build:types\": \"pnpm tsc --pretty\",\n \"build:watch\": \"tsc --build --watch\",\n \"clean\": \"rm -rf dist tmp/tsc tmp/happo-custom\",\n \"lint\": \"eslint .\",\n \"prepublishOnly\": \"pnpm clean && pnpm build\",\n \"storybook:dev\": \"storybook dev --config-dir src/storybook/__tests__/storybook-app -p ${PORT:-6007}\",\n \"test\": \"node --env-file-if-exists=.env.local ./scripts/test.ts\",\n \"test:custom\": \"pnpm build:dist && pnpm build:custom && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.custom.config.ts\",\n \"test:cypress\": \"pnpm build:dist && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.cypress.config.ts e2e -- cypress run -C src/cypress/__cypress__/cypress.config.ts\",\n \"test:cypress:open\": \"cypress open -C src/cypress/__cypress__/cypress.config.ts\",\n \"test:playwright\": \"pnpm build:dist && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.playwright.config.ts e2e -- playwright test\",\n \"test:storybook\": \"pnpm build:dist && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.storybook.config.ts\",\n \"test:pages\": \"pnpm build:dist && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.pages.config.ts\",\n \"tsc\": \"tsc --build tsconfig.json\"\n },\n \"browserslist\": {\n \"node\": [\n \"node 22\"\n ],\n \"browser\": [\n \"last 2 Chrome major versions\",\n \"last 2 Firefox major versions\",\n \"last 2 Safari major versions\",\n \"last 2 Edge major versions\"\n ],\n \"isomorphic\": [\n \"node 22\",\n \"last 2 Chrome major versions\",\n \"last 2 Firefox major versions\",\n \"last 2 Safari major versions\",\n \"last 2 Edge major versions\"\n ]\n },\n \"prettier\": {\n \"printWidth\": 85,\n \"singleQuote\": true,\n \"trailingComma\": \"all\",\n \"arrowParens\": \"always\"\n },\n \"devDependencies\": {\n \"@eslint/js\": \"^9.36.0\",\n \"@playwright/test\": \"^1.55.1\",\n \"@reporters/github\": \"^1.11.0\",\n \"@storybook/builder-vite\": \"^10.0.1\",\n \"@storybook/react-vite\": \"^10.0.1\",\n \"@types/async-retry\": \"^1.4.9\",\n \"@types/base64-stream\": \"^1.0.5\",\n \"@types/jsdom\": \"^27.0.0\",\n \"@types/mime-types\": \"^3.0.1\",\n \"@types/multiparty\": \"^4.2.1\",\n \"@types/node\": \"^24.9.1\",\n \"@types/react\": \"^19.2.0\",\n \"@types/react-dom\": \"^19.2.0\",\n \"@types/serve-handler\": \"^6.1.4\",\n \"cypress\": \"^15.5.0\",\n \"esbuild\": \"^0.25.10\",\n \"eslint\": \"^9.36.0\",\n \"eslint-config-prettier\": \"^10.1.8\",\n \"eslint-plugin-compat\": \"^6.0.2\",\n \"eslint-plugin-depend\": \"^1.3.1\",\n \"eslint-plugin-simple-import-sort\": \"^12.1.1\",\n \"eslint-plugin-unicorn\": \"^62.0.0\",\n \"jiti\": \"^2.6.0\",\n \"jsdom\": \"^27.0.0\",\n \"multiparty\": \"^4.2.3\",\n \"prettier\": \"^3.6.2\",\n \"react\": \"^19.2.0\",\n \"react-dom\": \"^19.2.0\",\n \"react-error-boundary\": \"^6.0.0\",\n \"serve-handler\": \"^6.1.6\",\n \"storybook\": \"^10.0.1\",\n \"typescript\": \"^5.9.2\",\n \"typescript-eslint\": \"^8.44.1\"\n },\n \"dependencies\": {\n \"async-retry\": \"^1.3.3\",\n \"base64-stream\": \"^1.0.0\",\n \"empathic\": \"^2.0.0\",\n \"fflate\": \"^0.8.2\",\n \"jose\": \"^6.1.0\",\n \"mime-types\": \"^3.0.1\",\n \"p-all\": \"^5.0.1\",\n \"srcset\": \"^5.0.2\"\n },\n \"keywords\": [\n \"accessibility\",\n \"cypress\",\n \"playwright\",\n \"regression\",\n \"storybook\",\n \"testing\",\n \"ui\",\n \"visual regression\",\n \"visual\"\n ],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ACT,QAAU;AAAA,EACZ;AAAA,EACA,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeHappoAPIRequest
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-HCMCNDII.js";
|
|
4
|
+
import "./chunk-MQN57GVD.js";
|
|
5
5
|
|
|
6
6
|
// src/network/createAsyncReport.ts
|
|
7
7
|
function assertResultIsCreateAsyncReportResult(result) {
|
|
@@ -37,4 +37,4 @@ async function createAsyncReport(snapRequestIds, config, { afterSha, link, messa
|
|
|
37
37
|
export {
|
|
38
38
|
createAsyncReport as default
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=createAsyncReport-
|
|
40
|
+
//# sourceMappingURL=createAsyncReport-MUPQH5YG.js.map
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAgJrD,wBAAsB,IAAI,CACxB,OAAO,GAAE,KAAK,CAAC,MAAM,CAAgB,EACrC,MAAM,GAAE,MAAgB,GACvB,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
|
package/dist/cli/index.js
CHANGED
|
@@ -45,6 +45,7 @@ async function loadConfigFile(configFilePath) {
|
|
|
45
45
|
for (const target of allTargets) {
|
|
46
46
|
target.viewport = target.viewport || "1024x768";
|
|
47
47
|
target.freezeAnimations = target.freezeAnimations || "last-frame";
|
|
48
|
+
target.prefersReducedMotion = target.prefersReducedMotion ?? true;
|
|
48
49
|
}
|
|
49
50
|
return {
|
|
50
51
|
endpoint: "https://happo.io",
|
|
@@ -59,30 +60,25 @@ import { spawnSync } from "node:child_process";
|
|
|
59
60
|
import crypto, { randomBytes } from "node:crypto";
|
|
60
61
|
import { readFileSync } from "node:fs";
|
|
61
62
|
var envKeys = [
|
|
63
|
+
"BUILD_REPOSITORY_URI",
|
|
64
|
+
"BUILD_SOURCEVERSION",
|
|
62
65
|
"CIRCLE_PROJECT_REPONAME",
|
|
63
66
|
"CIRCLE_PROJECT_USERNAME",
|
|
64
67
|
"CIRCLE_SHA1",
|
|
65
68
|
"CI_PULL_REQUEST",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"HAPPO_CURRENT_SHA",
|
|
69
|
+
"GITHUB_EVENT_PATH",
|
|
70
|
+
"GITHUB_SERVER_URL",
|
|
71
|
+
"GITHUB_SHA",
|
|
70
72
|
"HAPPO_DEBUG",
|
|
71
|
-
"HAPPO_GITHUB_BASE",
|
|
72
|
-
"HAPPO_PREVIOUS_SHA",
|
|
73
|
-
"HAPPO_FALLBACK_SHAS",
|
|
74
|
-
"HAPPO_FALLBACK_SHAS_COUNT",
|
|
75
|
-
"TRAVIS_COMMIT",
|
|
76
|
-
"TRAVIS_PULL_REQUEST",
|
|
77
|
-
"TRAVIS_PULL_REQUEST_SHA",
|
|
78
|
-
"TRAVIS_REPO_SLUG",
|
|
79
|
-
"TRAVIS_COMMIT_RANGE",
|
|
80
|
-
"BUILD_SOURCEVERSION",
|
|
81
|
-
"BUILD_REPOSITORY_URI",
|
|
82
73
|
"SYSTEM_PULLREQUEST_PULLREQUESTID",
|
|
83
74
|
"SYSTEM_PULLREQUEST_SOURCEBRANCH",
|
|
75
|
+
"SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI",
|
|
84
76
|
"SYSTEM_PULLREQUEST_TARGETBRANCH",
|
|
85
|
-
"
|
|
77
|
+
"TRAVIS_COMMIT",
|
|
78
|
+
"TRAVIS_COMMIT_RANGE",
|
|
79
|
+
"TRAVIS_PULL_REQUEST",
|
|
80
|
+
"TRAVIS_PULL_REQUEST_SHA",
|
|
81
|
+
"TRAVIS_REPO_SLUG"
|
|
86
82
|
];
|
|
87
83
|
async function resolveGithubEvent(GITHUB_EVENT_PATH) {
|
|
88
84
|
try {
|
|
@@ -96,28 +92,43 @@ async function resolveGithubEvent(GITHUB_EVENT_PATH) {
|
|
|
96
92
|
);
|
|
97
93
|
}
|
|
98
94
|
}
|
|
99
|
-
async function resolveLink(env) {
|
|
95
|
+
async function resolveLink(cliArgs, env) {
|
|
96
|
+
if (cliArgs.link) {
|
|
97
|
+
let parsed;
|
|
98
|
+
try {
|
|
99
|
+
parsed = new URL(cliArgs.link);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
throw new TypeError(
|
|
102
|
+
`link must be a valid http/https URL. Invalid URL: '${cliArgs.link}'`,
|
|
103
|
+
{ cause: e }
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
107
|
+
throw new TypeError(
|
|
108
|
+
`link must be a valid http/https URL. Invalid protocol: '${parsed.protocol}' (from '${cliArgs.link}')`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
return cliArgs.link;
|
|
112
|
+
}
|
|
100
113
|
const {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
GITHUB_BASE,
|
|
105
|
-
TRAVIS_REPO_SLUG,
|
|
106
|
-
TRAVIS_PULL_REQUEST,
|
|
107
|
-
TRAVIS_COMMIT,
|
|
108
|
-
CIRCLE_PROJECT_USERNAME,
|
|
114
|
+
BUILD_REPOSITORY_URI,
|
|
115
|
+
BUILD_SOURCEVERSION,
|
|
116
|
+
// https://circleci.com/docs/reference/variables/
|
|
109
117
|
CIRCLE_PROJECT_REPONAME,
|
|
118
|
+
CIRCLE_PROJECT_USERNAME,
|
|
119
|
+
CIRCLE_PULL_REQUEST,
|
|
110
120
|
CIRCLE_SHA1,
|
|
121
|
+
CI_PULL_REQUEST,
|
|
122
|
+
// https://docs.github.com/en/actions/reference/workflows-and-actions/variables#default-environment-variables
|
|
111
123
|
GITHUB_EVENT_PATH,
|
|
112
124
|
GITHUB_SHA,
|
|
113
125
|
SYSTEM_PULLREQUEST_PULLREQUESTID,
|
|
114
126
|
SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI,
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
// https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
|
|
128
|
+
TRAVIS_COMMIT,
|
|
129
|
+
TRAVIS_PULL_REQUEST,
|
|
130
|
+
TRAVIS_REPO_SLUG
|
|
117
131
|
} = env;
|
|
118
|
-
if (HAPPO_CHANGE_URL) {
|
|
119
|
-
return HAPPO_CHANGE_URL;
|
|
120
|
-
}
|
|
121
132
|
if (CI_PULL_REQUEST) {
|
|
122
133
|
return CI_PULL_REQUEST;
|
|
123
134
|
}
|
|
@@ -148,23 +159,26 @@ async function resolveLink(env) {
|
|
|
148
159
|
""
|
|
149
160
|
);
|
|
150
161
|
}
|
|
151
|
-
const githubBase =
|
|
162
|
+
const githubBase = "https://github.com";
|
|
152
163
|
if (TRAVIS_REPO_SLUG && TRAVIS_PULL_REQUEST) {
|
|
153
164
|
return `${githubBase}/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST}`;
|
|
154
165
|
}
|
|
155
166
|
if (TRAVIS_REPO_SLUG && TRAVIS_COMMIT) {
|
|
156
167
|
return `${githubBase}/${TRAVIS_REPO_SLUG}/commit/${TRAVIS_COMMIT}`;
|
|
157
168
|
}
|
|
169
|
+
if (CIRCLE_PULL_REQUEST) {
|
|
170
|
+
return CIRCLE_PULL_REQUEST;
|
|
171
|
+
}
|
|
158
172
|
if (CIRCLE_PROJECT_USERNAME && CIRCLE_PROJECT_REPONAME && CIRCLE_SHA1) {
|
|
159
173
|
return `${githubBase}/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commit/${CIRCLE_SHA1}`;
|
|
160
174
|
}
|
|
161
175
|
return void 0;
|
|
162
176
|
}
|
|
163
|
-
async function resolveAuthorEmail(env) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return HAPPO_AUTHOR;
|
|
177
|
+
async function resolveAuthorEmail(cliArgs, env) {
|
|
178
|
+
if (cliArgs.authorEmail) {
|
|
179
|
+
return cliArgs.authorEmail;
|
|
167
180
|
}
|
|
181
|
+
const { GITHUB_EVENT_PATH } = env;
|
|
168
182
|
if (GITHUB_EVENT_PATH) {
|
|
169
183
|
}
|
|
170
184
|
const res = spawnSync("git", ["show", "-s", "--format=%ae"], {
|
|
@@ -175,11 +189,11 @@ async function resolveAuthorEmail(env) {
|
|
|
175
189
|
}
|
|
176
190
|
return res.stdout.trim();
|
|
177
191
|
}
|
|
178
|
-
async function resolveMessage(env, afterSha) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return HAPPO_MESSAGE;
|
|
192
|
+
async function resolveMessage(cliArgs, env, afterSha) {
|
|
193
|
+
if (cliArgs.message) {
|
|
194
|
+
return cliArgs.message;
|
|
182
195
|
}
|
|
196
|
+
const { GITHUB_EVENT_PATH } = env;
|
|
183
197
|
if (GITHUB_EVENT_PATH) {
|
|
184
198
|
const ghEvent = await resolveGithubEvent(GITHUB_EVENT_PATH);
|
|
185
199
|
if (ghEvent.pull_request) {
|
|
@@ -208,7 +222,7 @@ function resolveShaFromTagMatcher(tagMatcher) {
|
|
|
208
222
|
);
|
|
209
223
|
if (res.status !== 0) {
|
|
210
224
|
throw new Error(
|
|
211
|
-
`Failed to list git tags when matching against
|
|
225
|
+
`Failed to list git tags when matching against --beforeShaTagMatcher '${tagMatcher}'. Error: ${res.stderr}`
|
|
212
226
|
);
|
|
213
227
|
}
|
|
214
228
|
const rawAllTags = res.stdout.trim();
|
|
@@ -230,24 +244,17 @@ function resolveShaFromTagMatcher(tagMatcher) {
|
|
|
230
244
|
}
|
|
231
245
|
return commitRes.stdout.trim();
|
|
232
246
|
}
|
|
233
|
-
async function resolveBeforeSha(env, afterSha) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
HAPPO_BEFORE_SHA_TAG_MATCHER,
|
|
237
|
-
HAPPO_BASE_BRANCH,
|
|
238
|
-
TRAVIS_COMMIT_RANGE,
|
|
239
|
-
GITHUB_EVENT_PATH,
|
|
240
|
-
SYSTEM_PULLREQUEST_TARGETBRANCH
|
|
241
|
-
} = env;
|
|
242
|
-
if (HAPPO_PREVIOUS_SHA) {
|
|
243
|
-
return HAPPO_PREVIOUS_SHA;
|
|
247
|
+
async function resolveBeforeSha(cliArgs, env, afterSha) {
|
|
248
|
+
if (cliArgs.beforeSha) {
|
|
249
|
+
return cliArgs.beforeSha;
|
|
244
250
|
}
|
|
245
|
-
if (
|
|
246
|
-
const resolvedSha = resolveShaFromTagMatcher(
|
|
251
|
+
if (cliArgs.beforeShaTagMatcher) {
|
|
252
|
+
const resolvedSha = resolveShaFromTagMatcher(cliArgs.beforeShaTagMatcher);
|
|
247
253
|
if (resolvedSha) {
|
|
248
254
|
return resolvedSha;
|
|
249
255
|
}
|
|
250
256
|
}
|
|
257
|
+
const { TRAVIS_COMMIT_RANGE, GITHUB_EVENT_PATH, SYSTEM_PULLREQUEST_TARGETBRANCH } = env;
|
|
251
258
|
if (GITHUB_EVENT_PATH) {
|
|
252
259
|
const ghEvent = await resolveGithubEvent(GITHUB_EVENT_PATH);
|
|
253
260
|
if (ghEvent.pull_request) {
|
|
@@ -269,7 +276,7 @@ async function resolveBeforeSha(env, afterSha) {
|
|
|
269
276
|
SYSTEM_PULLREQUEST_TARGETBRANCH.split("/").toReversed()[0]
|
|
270
277
|
].join("/");
|
|
271
278
|
}
|
|
272
|
-
const baseBranch =
|
|
279
|
+
const baseBranch = cliArgs.baseBranch || baseAzureBranch || "origin/main";
|
|
273
280
|
const res = spawnSync("git", ["merge-base", baseBranch, afterSha], {
|
|
274
281
|
encoding: "utf8"
|
|
275
282
|
});
|
|
@@ -320,9 +327,11 @@ function getHeadShaWithLocalChanges() {
|
|
|
320
327
|
const headShaWithLocalChanges = crypto.createHash("sha256").update(headSha).update(allChanges).digest("hex").slice(0, 40);
|
|
321
328
|
return { headSha, headShaWithLocalChanges };
|
|
322
329
|
}
|
|
323
|
-
async function resolveAfterSha(env) {
|
|
330
|
+
async function resolveAfterSha(cliArgs, env) {
|
|
331
|
+
if (cliArgs.afterSha) {
|
|
332
|
+
return cliArgs.afterSha;
|
|
333
|
+
}
|
|
324
334
|
const {
|
|
325
|
-
HAPPO_CURRENT_SHA,
|
|
326
335
|
CIRCLE_SHA1,
|
|
327
336
|
TRAVIS_PULL_REQUEST_SHA,
|
|
328
337
|
TRAVIS_COMMIT,
|
|
@@ -331,7 +340,7 @@ async function resolveAfterSha(env) {
|
|
|
331
340
|
BUILD_SOURCEVERSION,
|
|
332
341
|
SYSTEM_PULLREQUEST_SOURCEBRANCH
|
|
333
342
|
} = env;
|
|
334
|
-
const sha =
|
|
343
|
+
const sha = CIRCLE_SHA1 || TRAVIS_PULL_REQUEST_SHA || TRAVIS_COMMIT;
|
|
335
344
|
if (sha) {
|
|
336
345
|
return sha;
|
|
337
346
|
}
|
|
@@ -367,10 +376,15 @@ async function resolveAfterSha(env) {
|
|
|
367
376
|
}
|
|
368
377
|
return getHeadShaWithLocalChanges();
|
|
369
378
|
}
|
|
370
|
-
function resolveFallbackShas(
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
379
|
+
function resolveFallbackShas(cliArgs, beforeSha) {
|
|
380
|
+
if (cliArgs.fallbackShas) {
|
|
381
|
+
return cliArgs.fallbackShas.split(/[,\s]+/).filter(Boolean);
|
|
382
|
+
}
|
|
383
|
+
const fallbackShasCount = cliArgs.fallbackShasCount ? Number.parseInt(cliArgs.fallbackShasCount, 10) : 50;
|
|
384
|
+
if (Number.isNaN(fallbackShasCount)) {
|
|
385
|
+
throw new TypeError(
|
|
386
|
+
`fallbackShasCount must be a number. Invalid value: '${cliArgs.fallbackShasCount}'`
|
|
387
|
+
);
|
|
374
388
|
}
|
|
375
389
|
const res = spawnSync(
|
|
376
390
|
"git",
|
|
@@ -378,7 +392,7 @@ function resolveFallbackShas(env, beforeSha) {
|
|
|
378
392
|
"log",
|
|
379
393
|
"--format=%H",
|
|
380
394
|
"--first-parent",
|
|
381
|
-
`--max-count=${
|
|
395
|
+
`--max-count=${fallbackShasCount}`,
|
|
382
396
|
`${beforeSha}^`
|
|
383
397
|
],
|
|
384
398
|
{
|
|
@@ -397,29 +411,30 @@ function getRawEnv(env) {
|
|
|
397
411
|
}
|
|
398
412
|
return res;
|
|
399
413
|
}
|
|
400
|
-
async function resolveEnvironment(env = process.env) {
|
|
414
|
+
async function resolveEnvironment(cliArgs, env = process.env) {
|
|
401
415
|
const debugMode = !!env.HAPPO_DEBUG;
|
|
402
|
-
const afterSha = await resolveAfterSha(env);
|
|
416
|
+
const afterSha = await resolveAfterSha(cliArgs, env);
|
|
403
417
|
const realAfterSha = typeof afterSha === "string" ? afterSha : afterSha.headSha;
|
|
404
418
|
const afterShaWithLocalChanges = typeof afterSha === "string" ? afterSha : afterSha.headShaWithLocalChanges;
|
|
405
|
-
const [beforeSha, link,
|
|
406
|
-
resolveBeforeSha(env, realAfterSha),
|
|
407
|
-
resolveLink(env),
|
|
408
|
-
resolveAuthorEmail(env),
|
|
419
|
+
const [beforeSha, link, authorEmail, message] = await Promise.all([
|
|
420
|
+
resolveBeforeSha(cliArgs, env, realAfterSha),
|
|
421
|
+
resolveLink(cliArgs, env),
|
|
422
|
+
resolveAuthorEmail(cliArgs, env),
|
|
409
423
|
// Resolve message with the SHA that includes local changes
|
|
410
|
-
resolveMessage(env, afterShaWithLocalChanges)
|
|
424
|
+
resolveMessage(cliArgs, env, afterShaWithLocalChanges)
|
|
411
425
|
]);
|
|
412
426
|
const nonNullBeforeSha = beforeSha || afterShaWithLocalChanges;
|
|
413
427
|
const result = {
|
|
414
428
|
link,
|
|
415
|
-
|
|
429
|
+
authorEmail,
|
|
416
430
|
message,
|
|
417
431
|
beforeSha: nonNullBeforeSha,
|
|
418
432
|
afterSha: afterShaWithLocalChanges,
|
|
419
|
-
nonce:
|
|
433
|
+
nonce: cliArgs.nonce,
|
|
420
434
|
debugMode,
|
|
421
|
-
notify:
|
|
422
|
-
fallbackShas: resolveFallbackShas(
|
|
435
|
+
notify: cliArgs.notify,
|
|
436
|
+
fallbackShas: resolveFallbackShas(cliArgs, nonNullBeforeSha),
|
|
437
|
+
githubToken: cliArgs.githubToken
|
|
423
438
|
};
|
|
424
439
|
if (debugMode) {
|
|
425
440
|
console.log("[HAPPO] Raw environment", getRawEnv(env));
|
|
@@ -430,7 +445,7 @@ async function resolveEnvironment(env = process.env) {
|
|
|
430
445
|
|
|
431
446
|
// src/cli/index.ts
|
|
432
447
|
async function getVersion() {
|
|
433
|
-
const packageJson = await import("./package-
|
|
448
|
+
const packageJson = await import("./package-CZSERZWI.js");
|
|
434
449
|
return packageJson.default.version;
|
|
435
450
|
}
|
|
436
451
|
function parseDashdashCommandParts(rawArgs) {
|
|
@@ -455,6 +470,39 @@ function parseRawArgs(rawArgs) {
|
|
|
455
470
|
config: {
|
|
456
471
|
type: "string",
|
|
457
472
|
short: "c"
|
|
473
|
+
},
|
|
474
|
+
baseBranch: {
|
|
475
|
+
type: "string"
|
|
476
|
+
},
|
|
477
|
+
link: {
|
|
478
|
+
type: "string"
|
|
479
|
+
},
|
|
480
|
+
message: {
|
|
481
|
+
type: "string"
|
|
482
|
+
},
|
|
483
|
+
authorEmail: {
|
|
484
|
+
type: "string"
|
|
485
|
+
},
|
|
486
|
+
afterSha: {
|
|
487
|
+
type: "string"
|
|
488
|
+
},
|
|
489
|
+
beforeSha: {
|
|
490
|
+
type: "string"
|
|
491
|
+
},
|
|
492
|
+
fallbackShas: {
|
|
493
|
+
type: "string"
|
|
494
|
+
},
|
|
495
|
+
fallbackShasCount: {
|
|
496
|
+
type: "string"
|
|
497
|
+
},
|
|
498
|
+
notify: {
|
|
499
|
+
type: "string"
|
|
500
|
+
},
|
|
501
|
+
nonce: {
|
|
502
|
+
type: "string"
|
|
503
|
+
},
|
|
504
|
+
githubToken: {
|
|
505
|
+
type: "string"
|
|
458
506
|
}
|
|
459
507
|
},
|
|
460
508
|
allowPositionals: true
|
|
@@ -472,17 +520,40 @@ Commands:
|
|
|
472
520
|
finalize Finalize happo report for Cypress/Playwright tests running in parallel
|
|
473
521
|
|
|
474
522
|
Options:
|
|
475
|
-
--config
|
|
476
|
-
--version
|
|
477
|
-
--help
|
|
523
|
+
--config Path to happo config file
|
|
524
|
+
--version Show version number
|
|
525
|
+
--help Show help text
|
|
526
|
+
--baseBranch <branch> Base branch to use for comparison (default: 'origin/main')
|
|
527
|
+
--link <url> URL to contextualize the comparison (default: auto-detected from CI environment)
|
|
528
|
+
--message <message> Message to associate with the comparison (default: auto-detected from CI environment)
|
|
529
|
+
--authorEmail <email> Email address of the author of the comparison (default: auto-detected from CI environment)
|
|
530
|
+
--afterSha <sha> "After" SHA to use for comparison (default: auto-detected from CI environment, or HEAD SHA if not set)
|
|
531
|
+
--beforeSha <sha> "Before" SHA to use for comparison (default: auto-detected from CI environment)
|
|
532
|
+
--beforeShaTagMatcher <matcher> git tag matcher to use for "before" SHA resolution
|
|
533
|
+
--fallbackShas <shas> Space-, newline- or comma-separated list of fallback shas for compare calls (default: auto-detected from CI environment)
|
|
534
|
+
--fallbackShasCount <count> Number of fallback shas to use for compare calls (default: 50)
|
|
535
|
+
--notify <emails> One or more (comma-separated) email addresses to notify with results
|
|
536
|
+
--nonce <nonce> Nonce to use for Cypress/Playwright comparison
|
|
537
|
+
--githubToken <token> GitHub token to use for posting Happo statuses as comments. Use in combination with the \`githubApiUrl\` configuration option. (default: auto-detected from environment)
|
|
478
538
|
|
|
479
539
|
Examples:
|
|
480
540
|
happo
|
|
541
|
+
|
|
481
542
|
happo --config path/to/happo.config.ts
|
|
543
|
+
happo --baseBranch origin/long-lived-branch
|
|
544
|
+
happo --link https://github.com/happo/happo/pull/123
|
|
545
|
+
happo --message "Add new feature"
|
|
546
|
+
happo --notify me@example.com,you@example.com
|
|
547
|
+
happo --nonce my-unique-nonce
|
|
548
|
+
happo --githubToken {{ secrets.GITHUB_TOKEN }}
|
|
549
|
+
|
|
482
550
|
happo --version
|
|
483
551
|
happo --help
|
|
552
|
+
|
|
484
553
|
happo -- playwright test
|
|
554
|
+
|
|
485
555
|
happo finalize
|
|
556
|
+
happo finalize --nonce my-unique-nonce
|
|
486
557
|
`;
|
|
487
558
|
function makeAbsolute(configFilePath) {
|
|
488
559
|
if (configFilePath.startsWith(".")) {
|
|
@@ -502,7 +573,7 @@ async function main(rawArgs = process.argv, logger = console) {
|
|
|
502
573
|
}
|
|
503
574
|
const configFilePath = makeAbsolute(args.values.config || findConfigFile());
|
|
504
575
|
const config = await loadConfigFile(configFilePath);
|
|
505
|
-
const environment = await resolveEnvironment();
|
|
576
|
+
const environment = await resolveEnvironment(args.values);
|
|
506
577
|
const command = args.positionals[0];
|
|
507
578
|
if (args.dashdashCommandParts) {
|
|
508
579
|
await handleE2ECommand(
|
|
@@ -530,10 +601,10 @@ async function main(rawArgs = process.argv, logger = console) {
|
|
|
530
601
|
async function handleDefaultCommand(config, environment, logger) {
|
|
531
602
|
logger.log("Running happo tests...");
|
|
532
603
|
const [startJob, createAsyncComparison, createAsyncReport, prepareSnapRequests] = await Promise.all([
|
|
533
|
-
(await import("./startJob-
|
|
534
|
-
(await import("./createAsyncComparison-
|
|
535
|
-
(await import("./createAsyncReport-
|
|
536
|
-
(await import("./prepareSnapRequests-
|
|
604
|
+
(await import("./startJob-4EQXSOMD.js")).default,
|
|
605
|
+
(await import("./createAsyncComparison-Y3V5JEEI.js")).default,
|
|
606
|
+
(await import("./createAsyncReport-MUPQH5YG.js")).default,
|
|
607
|
+
(await import("./prepareSnapRequests-KXP2GCXB.js")).default
|
|
537
608
|
]);
|
|
538
609
|
await startJob(config, environment, logger);
|
|
539
610
|
try {
|
|
@@ -555,7 +626,7 @@ async function handleDefaultCommand(config, environment, logger) {
|
|
|
555
626
|
}
|
|
556
627
|
} catch (e) {
|
|
557
628
|
logger.error(e instanceof Error ? e.message : String(e), e);
|
|
558
|
-
const cancelJob = (await import("./cancelJob-
|
|
629
|
+
const cancelJob = (await import("./cancelJob-ZSTC24AN.js")).default;
|
|
559
630
|
await cancelJob("failure", config, environment, logger);
|
|
560
631
|
process.exitCode = 1;
|
|
561
632
|
return;
|
|
@@ -566,7 +637,7 @@ async function handleFinalizeCommand(config, environment, logger) {
|
|
|
566
637
|
logger.log("Config:", config);
|
|
567
638
|
logger.log("Environment:", environment);
|
|
568
639
|
try {
|
|
569
|
-
const finalizeAll = (await import("./wrapper-
|
|
640
|
+
const finalizeAll = (await import("./wrapper-GHIE52PM.js")).finalizeAll;
|
|
570
641
|
await finalizeAll({ happoConfig: config, environment, logger });
|
|
571
642
|
} catch (e) {
|
|
572
643
|
logger.error(e instanceof Error ? e.message : String(e), e);
|
|
@@ -595,7 +666,7 @@ async function handleE2ECommand(config, environment, dashdashCommandParts, confi
|
|
|
595
666
|
logger.log("Config:", config);
|
|
596
667
|
logger.log("Environment:", environment);
|
|
597
668
|
logger.log("Dashdash command parts:", dashdashCommandParts);
|
|
598
|
-
const runWithWrapper = (await import("./wrapper-
|
|
669
|
+
const runWithWrapper = (await import("./wrapper-GHIE52PM.js")).default;
|
|
599
670
|
const exitCode = await runWithWrapper(
|
|
600
671
|
dashdashCommandParts,
|
|
601
672
|
config,
|