Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcc committed Dec 3, 2024
1 parent 79163f7 commit 1e1cb00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions __tests__/integration/utils/toMatchDOMSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function toMatchDOMSnapshot(
name: string,
options: ToMatchDOMSnapshotOptions = {},
): Promise<{ message: () => string; pass: boolean }> {
const { selector, fileFormat = 'svg', keepSVGElementId = true } = options;
const { selector, fileFormat = 'svg', keepSVGElementId = false } = options;
const namePath = path.join(dir, name);
const actualPath = path.join(dir, `${name}-actual.${fileFormat}`);
const expectedPath = path.join(dir, `${name}.${fileFormat}`);
Expand Down Expand Up @@ -74,7 +74,9 @@ export async function toMatchDOMSnapshot(
encoding: 'utf8',
flag: 'r',
});
if (isSVGEqual(actual, expected)) {
console.log(11111, actual);
// console.log(11111, expected);
if (isSVGEqual(actual, expected, keepSVGElementId)) {
if (fs.existsSync(actualPath)) fs.unlinkSync(actualPath);
return {
message: () => `match ${namePath}`,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"size": "limit-size",
"lint": "eslint ./src ./__tests__ && prettier ./src ./__tests__ --check ",
"fix": "eslint ./src ./__tests__ --fix && prettier ./src ./__tests__ --write ",
"test": "cross-env TZ=Asia/Shanghai jest __tests__",
"test": "cross-env TZ=Asia/Shanghai jest __tests__/integration/api-chart-emit-item-tooltip.spec.ts",
"test:unit": "cross-env TZ=Asia/Shanghai jest __tests__/unit/",
"test:integration": "cross-env TZ=Asia/Shanghai jest __tests__/integration/",
"preview": "vite preview",
Expand Down

0 comments on commit 1e1cb00

Please sign in to comment.