Skip to content

Commit 38f6ba8

Browse files
committed
ci: ecosystem ci won't test snapshot
1 parent 90d1104 commit 38f6ba8

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"test": "pnpm run test:unit && pnpm run test:integration && pnpm run test:e2e",
1818
"test:benchmark": "cd ./tests && pnpm run test:benchmark",
1919
"test:e2e": "pnpm run build:examples && cd tests && pnpm run test:e2e",
20+
"test:ecosystem-ci": "pnpm run test:unit && cross-env ECO_CI=1 pnpm run test:integration && pnpm run test:e2e",
2021
"test:integration": "cross-env NODE_OPTIONS='--experimental-vm-modules' vitest run --project integration",
2122
"test:integration:watch": "cross-env NODE_OPTIONS='--experimental-vm-modules' vitest --project integration",
2223
"test:unit": "vitest run --project unit*",

tests/setupVitestTests.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
11
import path from 'node:path';
22
import process from 'node:process';
33
import { createSnapshotSerializer } from 'path-serializer';
4-
import { beforeEach, expect } from 'vitest';
4+
import { type SnapshotSerializer, beforeEach, expect } from 'vitest';
55

66
beforeEach(() => {
77
// since our NODE_ENV injection logic is via cli, we need to
88
// delete "test" NODE_ENV to avoid affecting the default build config
99
delete process.env.NODE_ENV;
1010
});
1111

12-
expect.addSnapshotSerializer(
13-
createSnapshotSerializer({
14-
root: path.join(__dirname, '..'),
15-
features: {
16-
escapeDoubleQuotes: false,
17-
transformCLR: false,
18-
},
19-
}),
20-
);
12+
const serializer = createSnapshotSerializer({
13+
root: path.join(__dirname, '..'),
14+
features: {
15+
escapeDoubleQuotes: false,
16+
transformCLR: false,
17+
},
18+
}) satisfies SnapshotSerializer;
19+
20+
expect.addSnapshotSerializer({
21+
...serializer,
22+
});
23+
24+
if (process.env.ECO_CI) {
25+
expect.extend({
26+
toMatchSnapshot: () => ({
27+
pass: true,
28+
message: () => 'Snapshot always passes',
29+
}),
30+
toMatchInlineSnapshot: () => ({
31+
pass: true,
32+
message: () => 'Snapshot always passes',
33+
}),
34+
});
35+
}

0 commit comments

Comments
 (0)