Skip to content

Commit

Permalink
test: 修复单测卡死的问题 (#3084)
Browse files Browse the repository at this point in the history
* test: 测试单测
  • Loading branch information
lijinke666 authored Jan 23, 2025
1 parent f1af632 commit 9b2863c
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 364 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test-s2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
# jest-electron 需要 macOS 环境, 但是 免费用户 并发有限制, 容易排队 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
# runs-on: macos-latest # (目前 macos-latest 对应的是 Big Sur 11, macos-12 对应 Monterey 12)
# macOS 3-core CPU, 其他 2-core CPU
# > macos-14 会导致 CI 的测试卡死, 没有任何报错!!!
runs-on: macos-14
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
Expand Down Expand Up @@ -43,6 +42,8 @@ jobs:
- name: Test
run: |
pnpm --filter @antv/s2 test:ci-coverage
env:
DEBUG: jest*

- name: Upload test coverage
uses: codecov/codecov-action@v3
Expand Down
3 changes: 2 additions & 1 deletion jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
'hd-adapter/index.ts',
'packages/s2-vue',
],
testPathIgnorePatterns: ['benchmark'],
coverageReporters: ['text', 'clover', 'html'],
transformIgnorePatterns: [],
testRegex: '/__tests__/*.*(-|\\.)spec\\.(tsx|ts|js|vue)?$',
Expand Down Expand Up @@ -58,5 +59,5 @@ module.exports = {
/* ignore module query: foo.less?a=1 -> foo.less */
'(.+)\\.(.+)\\?(.*)$': '$1.$2',
},
testTimeout: 30000,
testTimeout: 100000,
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
"@size-limit/esbuild": "^11.1.4",
"@size-limit/esbuild-why": "^11.1.4",
"@size-limit/file": "^11.1.4",
"@swc/core": "^1.5.24",
"@swc/jest": "^0.2.36",
"@swc/core": "^1.10.9",
"@swc/jest": "^0.2.37",
"@types/jest": "^27.5.2",
"@types/lodash": "4.17.4",
"@types/node": "^20.14.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder 1`] = `
Object {
"height": 562,
"stroke": CSSRGB {
"alpha": 1,
"b": 253,
"colorSpace": "rgb",
"g": 233,
"isNone": false,
"r": 224,
},
"strokeOpacity": 1,
"strokeWidth": 1,
"width": 799,
"x": 0,
"y": 32,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder 2`] = `
Object {
"fill": "",
"height": 41,
Expand All @@ -36,49 +17,7 @@ Object {
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder 3`] = `
Object {
"fill": CSSRGB {
"alpha": 1,
"b": 0,
"colorSpace": "rgb",
"g": 0,
"isNone": false,
"r": 0,
},
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
"fontSize": 12,
"fontStyle": "normal",
"fontVariant": "normal",
"fontWeight": "normal",
"lineWidth": 1,
"opacity": 1,
"text": "暂无数据",
"x": 375,
"y": 357.5,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col height 1`] = `
Object {
"height": 272,
"stroke": CSSRGB {
"alpha": 1,
"b": 253,
"colorSpace": "rgb",
"g": 233,
"isNone": false,
"r": 224,
},
"strokeOpacity": 1,
"strokeWidth": 1,
"width": 599,
"x": 0,
"y": 202,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col height 2`] = `
Object {
"fill": "",
"height": 41,
Expand All @@ -95,49 +34,7 @@ Object {
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col height 3`] = `
Object {
"fill": CSSRGB {
"alpha": 1,
"b": 0,
"colorSpace": "rgb",
"g": 0,
"isNone": false,
"r": 0,
},
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
"fontSize": 12,
"fontStyle": "normal",
"fontVariant": "normal",
"fontWeight": "normal",
"lineWidth": 1,
"opacity": 1,
"text": "暂无数据",
"x": 275,
"y": 382.5,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col width 1`] = `
Object {
"height": 442,
"stroke": CSSRGB {
"alpha": 1,
"b": 253,
"colorSpace": "rgb",
"g": 233,
"isNone": false,
"r": 224,
},
"strokeOpacity": 1,
"strokeWidth": 1,
"width": 510,
"x": 0,
"y": 32,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col width 2`] = `
Object {
"fill": "",
"height": 41,
Expand All @@ -154,49 +51,7 @@ Object {
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom col width 3`] = `
Object {
"fill": CSSRGB {
"alpha": 1,
"b": 0,
"colorSpace": "rgb",
"g": 0,
"isNone": false,
"r": 0,
},
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
"fontSize": 12,
"fontStyle": "normal",
"fontVariant": "normal",
"fontWeight": "normal",
"lineWidth": 1,
"opacity": 1,
"text": "暂无数据",
"x": 230.5,
"y": 297.5,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description 1`] = `
Object {
"height": 562,
"stroke": CSSRGB {
"alpha": 1,
"b": 253,
"colorSpace": "rgb",
"g": 233,
"isNone": false,
"r": 224,
},
"strokeOpacity": 1,
"strokeWidth": 1,
"width": 799,
"x": 0,
"y": 32,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description 2`] = `
Object {
"fill": "",
"height": 41,
Expand All @@ -213,49 +68,7 @@ Object {
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description 3`] = `
Object {
"fill": CSSRGB {
"alpha": 1,
"b": 0,
"colorSpace": "rgb",
"g": 0,
"isNone": false,
"r": 0,
},
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
"fontSize": 12,
"fontStyle": "normal",
"fontVariant": "normal",
"fontWeight": "normal",
"lineWidth": 1,
"opacity": 1,
"text": "暂无数据",
"x": 375,
"y": 357.5,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description style 1`] = `
Object {
"height": 562,
"stroke": CSSRGB {
"alpha": 1,
"b": 253,
"colorSpace": "rgb",
"g": 233,
"isNone": false,
"r": 224,
},
"strokeOpacity": 1,
"strokeWidth": 1,
"width": 799,
"x": 0,
"y": 32,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description style 2`] = `
Object {
"fill": "green",
"height": 100,
Expand All @@ -272,49 +85,7 @@ Object {
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder by custom icon and description style 3`] = `
Object {
"fill": CSSRGB {
"alpha": 1,
"b": 0,
"colorSpace": "rgb",
"g": 0,
"isNone": false,
"r": 255,
},
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
"fontSize": 20,
"fontStyle": "normal",
"fontVariant": "normal",
"fontWeight": "normal",
"lineWidth": 1,
"opacity": 1,
"text": "暂无数据",
"x": 359,
"y": 443,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder for en_US lang 1`] = `
Object {
"height": 562,
"stroke": CSSRGB {
"alpha": 1,
"b": 253,
"colorSpace": "rgb",
"g": 233,
"isNone": false,
"r": 224,
},
"strokeOpacity": 1,
"strokeWidth": 1,
"width": 799,
"x": 0,
"y": 32,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder for en_US lang 2`] = `
Object {
"fill": "",
"height": 41,
Expand All @@ -331,49 +102,7 @@ Object {
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder for en_US lang 3`] = `
Object {
"fill": CSSRGB {
"alpha": 1,
"b": 0,
"colorSpace": "rgb",
"g": 0,
"isNone": false,
"r": 0,
},
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
"fontSize": 12,
"fontStyle": "normal",
"fontVariant": "normal",
"fontWeight": "normal",
"lineWidth": 1,
"opacity": 1,
"text": "No Data",
"x": 376.5,
"y": 357.5,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder if contains horizontal scrollbar 1`] = `
Object {
"height": 562,
"stroke": CSSRGB {
"alpha": 1,
"b": 253,
"colorSpace": "rgb",
"g": 233,
"isNone": false,
"r": 224,
},
"strokeOpacity": 1,
"strokeWidth": 1,
"width": 799,
"x": 0,
"y": 32,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder if contains horizontal scrollbar 2`] = `
Object {
"fill": "",
"height": 41,
Expand All @@ -389,26 +118,3 @@ Object {
"y": 292.5,
}
`;

exports[`TableSheet normal spec Empty Placeholder should render empty placeholder if contains horizontal scrollbar 3`] = `
Object {
"fill": CSSRGB {
"alpha": 1,
"b": 0,
"colorSpace": "rgb",
"g": 0,
"isNone": false,
"r": 0,
},
"fontFamily": "Roboto, PingFangSC, Microsoft YaHei, Arial, sans-serif",
"fontSize": 12,
"fontStyle": "normal",
"fontVariant": "normal",
"fontWeight": "normal",
"lineWidth": 1,
"opacity": 1,
"text": "暂无数据",
"x": 375,
"y": 357.5,
}
`;
Loading

0 comments on commit 9b2863c

Please sign in to comment.