Skip to content

Commit 9b2863c

Browse files
authored
test: 修复单测卡死的问题 (#3084)
* test: 测试单测
1 parent f1af632 commit 9b2863c

File tree

8 files changed

+69
-364
lines changed

8 files changed

+69
-364
lines changed

.github/workflows/test-s2.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
# jest-electron 需要 macOS 环境, 但是 免费用户 并发有限制, 容易排队 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
1212
# runs-on: macos-latest # (目前 macos-latest 对应的是 Big Sur 11, macos-12 对应 Monterey 12)
1313
# macOS 3-core CPU, 其他 2-core CPU
14-
# > macos-14 会导致 CI 的测试卡死, 没有任何报错!!!
1514
runs-on: macos-14
1615
if: "!contains(github.event.head_commit.message, '[skip ci]')"
1716
strategy:
@@ -43,6 +42,8 @@ jobs:
4342
- name: Test
4443
run: |
4544
pnpm --filter @antv/s2 test:ci-coverage
45+
env:
46+
DEBUG: jest*
4647

4748
- name: Upload test coverage
4849
uses: codecov/codecov-action@v3

jest.config.base.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = {
2424
'hd-adapter/index.ts',
2525
'packages/s2-vue',
2626
],
27+
testPathIgnorePatterns: ['benchmark'],
2728
coverageReporters: ['text', 'clover', 'html'],
2829
transformIgnorePatterns: [],
2930
testRegex: '/__tests__/*.*(-|\\.)spec\\.(tsx|ts|js|vue)?$',
@@ -58,5 +59,5 @@ module.exports = {
5859
/* ignore module query: foo.less?a=1 -> foo.less */
5960
'(.+)\\.(.+)\\?(.*)$': '$1.$2',
6061
},
61-
testTimeout: 30000,
62+
testTimeout: 100000,
6263
};

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@
123123
"@size-limit/esbuild": "^11.1.4",
124124
"@size-limit/esbuild-why": "^11.1.4",
125125
"@size-limit/file": "^11.1.4",
126-
"@swc/core": "^1.5.24",
127-
"@swc/jest": "^0.2.36",
126+
"@swc/core": "^1.10.9",
127+
"@swc/jest": "^0.2.37",
128128
"@types/jest": "^27.5.2",
129129
"@types/lodash": "4.17.4",
130130
"@types/node": "^20.14.0",
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder 1`] = `
4-
Object {
5-
"height": 562,
6-
"stroke": CSSRGB {
7-
"alpha": 1,
8-
"b": 253,
9-
"colorSpace": "rgb",
10-
"g": 233,
11-
"isNone": false,
12-
"r": 224,
13-
},
14-
"strokeOpacity": 1,
15-
"strokeWidth": 1,
16-
"width": 799,
17-
"x": 0,
18-
"y": 32,
19-
}
20-
`;
21-
22-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder 2`] = `
234
Object {
245
"fill": "",
256
"height": 41,
@@ -36,49 +17,7 @@ Object {
3617
}
3718
`;
3819

39-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder 3`] = `
40-
Object {
41-
"fill": CSSRGB {
42-
"alpha": 1,
43-
"b": 0,
44-
"colorSpace": "rgb",
45-
"g": 0,
46-
"isNone": false,
47-
"r": 0,
48-
},
49-
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
50-
"fontSize": 12,
51-
"fontStyle": "normal",
52-
"fontVariant": "normal",
53-
"fontWeight": "normal",
54-
"lineWidth": 1,
55-
"opacity": 1,
56-
"text": "暂无数据",
57-
"x": 375,
58-
"y": 357.5,
59-
}
60-
`;
61-
6220
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col height 1`] = `
63-
Object {
64-
"height": 272,
65-
"stroke": CSSRGB {
66-
"alpha": 1,
67-
"b": 253,
68-
"colorSpace": "rgb",
69-
"g": 233,
70-
"isNone": false,
71-
"r": 224,
72-
},
73-
"strokeOpacity": 1,
74-
"strokeWidth": 1,
75-
"width": 599,
76-
"x": 0,
77-
"y": 202,
78-
}
79-
`;
80-
81-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col height 2`] = `
8221
Object {
8322
"fill": "",
8423
"height": 41,
@@ -95,49 +34,7 @@ Object {
9534
}
9635
`;
9736

98-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col height 3`] = `
99-
Object {
100-
"fill": CSSRGB {
101-
"alpha": 1,
102-
"b": 0,
103-
"colorSpace": "rgb",
104-
"g": 0,
105-
"isNone": false,
106-
"r": 0,
107-
},
108-
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
109-
"fontSize": 12,
110-
"fontStyle": "normal",
111-
"fontVariant": "normal",
112-
"fontWeight": "normal",
113-
"lineWidth": 1,
114-
"opacity": 1,
115-
"text": "暂无数据",
116-
"x": 275,
117-
"y": 382.5,
118-
}
119-
`;
120-
12137
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col width 1`] = `
122-
Object {
123-
"height": 442,
124-
"stroke": CSSRGB {
125-
"alpha": 1,
126-
"b": 253,
127-
"colorSpace": "rgb",
128-
"g": 233,
129-
"isNone": false,
130-
"r": 224,
131-
},
132-
"strokeOpacity": 1,
133-
"strokeWidth": 1,
134-
"width": 510,
135-
"x": 0,
136-
"y": 32,
137-
}
138-
`;
139-
140-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col width 2`] = `
14138
Object {
14239
"fill": "",
14340
"height": 41,
@@ -154,49 +51,7 @@ Object {
15451
}
15552
`;
15653

157-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col width 3`] = `
158-
Object {
159-
"fill": CSSRGB {
160-
"alpha": 1,
161-
"b": 0,
162-
"colorSpace": "rgb",
163-
"g": 0,
164-
"isNone": false,
165-
"r": 0,
166-
},
167-
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
168-
"fontSize": 12,
169-
"fontStyle": "normal",
170-
"fontVariant": "normal",
171-
"fontWeight": "normal",
172-
"lineWidth": 1,
173-
"opacity": 1,
174-
"text": "暂无数据",
175-
"x": 230.5,
176-
"y": 297.5,
177-
}
178-
`;
179-
18054
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description 1`] = `
181-
Object {
182-
"height": 562,
183-
"stroke": CSSRGB {
184-
"alpha": 1,
185-
"b": 253,
186-
"colorSpace": "rgb",
187-
"g": 233,
188-
"isNone": false,
189-
"r": 224,
190-
},
191-
"strokeOpacity": 1,
192-
"strokeWidth": 1,
193-
"width": 799,
194-
"x": 0,
195-
"y": 32,
196-
}
197-
`;
198-
199-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description 2`] = `
20055
Object {
20156
"fill": "",
20257
"height": 41,
@@ -213,49 +68,7 @@ Object {
21368
}
21469
`;
21570

216-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description 3`] = `
217-
Object {
218-
"fill": CSSRGB {
219-
"alpha": 1,
220-
"b": 0,
221-
"colorSpace": "rgb",
222-
"g": 0,
223-
"isNone": false,
224-
"r": 0,
225-
},
226-
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
227-
"fontSize": 12,
228-
"fontStyle": "normal",
229-
"fontVariant": "normal",
230-
"fontWeight": "normal",
231-
"lineWidth": 1,
232-
"opacity": 1,
233-
"text": "暂无数据",
234-
"x": 375,
235-
"y": 357.5,
236-
}
237-
`;
238-
23971
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description style 1`] = `
240-
Object {
241-
"height": 562,
242-
"stroke": CSSRGB {
243-
"alpha": 1,
244-
"b": 253,
245-
"colorSpace": "rgb",
246-
"g": 233,
247-
"isNone": false,
248-
"r": 224,
249-
},
250-
"strokeOpacity": 1,
251-
"strokeWidth": 1,
252-
"width": 799,
253-
"x": 0,
254-
"y": 32,
255-
}
256-
`;
257-
258-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description style 2`] = `
25972
Object {
26073
"fill": "green",
26174
"height": 100,
@@ -272,49 +85,7 @@ Object {
27285
}
27386
`;
27487

275-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description style 3`] = `
276-
Object {
277-
"fill": CSSRGB {
278-
"alpha": 1,
279-
"b": 0,
280-
"colorSpace": "rgb",
281-
"g": 0,
282-
"isNone": false,
283-
"r": 255,
284-
},
285-
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
286-
"fontSize": 20,
287-
"fontStyle": "normal",
288-
"fontVariant": "normal",
289-
"fontWeight": "normal",
290-
"lineWidth": 1,
291-
"opacity": 1,
292-
"text": "暂无数据",
293-
"x": 359,
294-
"y": 443,
295-
}
296-
`;
297-
29888
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder for en_US lang 1`] = `
299-
Object {
300-
"height": 562,
301-
"stroke": CSSRGB {
302-
"alpha": 1,
303-
"b": 253,
304-
"colorSpace": "rgb",
305-
"g": 233,
306-
"isNone": false,
307-
"r": 224,
308-
},
309-
"strokeOpacity": 1,
310-
"strokeWidth": 1,
311-
"width": 799,
312-
"x": 0,
313-
"y": 32,
314-
}
315-
`;
316-
317-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder for en_US lang 2`] = `
31889
Object {
31990
"fill": "",
32091
"height": 41,
@@ -331,49 +102,7 @@ Object {
331102
}
332103
`;
333104

334-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder for en_US lang 3`] = `
335-
Object {
336-
"fill": CSSRGB {
337-
"alpha": 1,
338-
"b": 0,
339-
"colorSpace": "rgb",
340-
"g": 0,
341-
"isNone": false,
342-
"r": 0,
343-
},
344-
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
345-
"fontSize": 12,
346-
"fontStyle": "normal",
347-
"fontVariant": "normal",
348-
"fontWeight": "normal",
349-
"lineWidth": 1,
350-
"opacity": 1,
351-
"text": "No Data",
352-
"x": 376.5,
353-
"y": 357.5,
354-
}
355-
`;
356-
357105
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder if contains horizontal scrollbar 1`] = `
358-
Object {
359-
"height": 562,
360-
"stroke": CSSRGB {
361-
"alpha": 1,
362-
"b": 253,
363-
"colorSpace": "rgb",
364-
"g": 233,
365-
"isNone": false,
366-
"r": 224,
367-
},
368-
"strokeOpacity": 1,
369-
"strokeWidth": 1,
370-
"width": 799,
371-
"x": 0,
372-
"y": 32,
373-
}
374-
`;
375-
376-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder if contains horizontal scrollbar 2`] = `
377106
Object {
378107
"fill": "",
379108
"height": 41,
@@ -389,26 +118,3 @@ Object {
389118
"y": 292.5,
390119
}
391120
`;
392-
393-
exports[`TableSheet normal spec Empty Placeholder should render empty placeholder if contains horizontal scrollbar 3`] = `
394-
Object {
395-
"fill": CSSRGB {
396-
"alpha": 1,
397-
"b": 0,
398-
"colorSpace": "rgb",
399-
"g": 0,
400-
"isNone": false,
401-
"r": 0,
402-
},
403-
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
404-
"fontSize": 12,
405-
"fontStyle": "normal",
406-
"fontVariant": "normal",
407-
"fontWeight": "normal",
408-
"lineWidth": 1,
409-
"opacity": 1,
410-
"text": "暂无数据",
411-
"x": 375,
412-
"y": 357.5,
413-
}
414-
`;

0 commit comments

Comments
 (0)