Skip to content

Commit b0003f4

Browse files
committed
fix: jest
1 parent fed032d commit b0003f4

File tree

8 files changed

+254
-114
lines changed

8 files changed

+254
-114
lines changed

babel.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
presets: [
3+
['@babel/preset-env', { targets: { node: 'current' } }],
4+
],
5+
plugins: [
6+
["babel-plugin-styled-components", { displayName: true }]
7+
]
8+
};

jest.config.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import type { Config } from 'jest';
2+
3+
const config: Config = {
4+
preset: "ts-jest",
5+
moduleNameMapper: {
6+
"\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/ui/lib/fileMock.js",
7+
"\\.(css|less)$": "<rootDir>/ui/lib/fileMock.js"
8+
},
9+
transform: {
10+
"\\.tsx?$": "ts-jest",
11+
"\\.jsx?$": [
12+
"babel-jest",
13+
{
14+
"configFile": "./babel.config.js"
15+
}
16+
]
17+
},
18+
transformIgnorePatterns: [
19+
"/node_modules/(?!(yaml)/)"
20+
],
21+
setupFilesAfterEnv: [
22+
"<rootDir>/setup-jest.ts"
23+
],
24+
modulePathIgnorePatterns: [
25+
"<rootDir>/dist/"
26+
],
27+
testEnvironment: "jsdom"
28+
};
29+
30+
export default config;

package.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,6 @@
8282
"styled-components": "^5.3.0",
8383
"yaml": "^2.2.2"
8484
},
85-
"jest": {
86-
"preset": "ts-jest",
87-
"moduleNameMapper": {
88-
"\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/ui/lib/fileMock.js",
89-
"\\.(css|less)$": "<rootDir>/ui/lib/fileMock.js"
90-
},
91-
"setupFilesAfterEnv": [
92-
"<rootDir>/setup-jest.ts"
93-
],
94-
"modulePathIgnorePatterns": [
95-
"<rootDir>/dist/"
96-
],
97-
"testEnvironment": "jsdom"
98-
},
9985
"devDependencies": {
10086
"@babel/core": "^7.26.0",
10187
"@babel/preset-env": "^7.26.0",
@@ -116,6 +102,7 @@
116102
"@types/styled-components": "^5.1.9",
117103
"@typescript-eslint/eslint-plugin": "^6.6.0",
118104
"@typescript-eslint/parser": "^6.6.0",
105+
"babel-jest": "^29.7.0",
119106
"babel-plugin-styled-components": "^2.1.4",
120107
"buffer": "^5.7.1",
121108
"eslint": "^8.48.0",
@@ -131,6 +118,7 @@
131118
"process": "^0.11.10",
132119
"react-test-renderer": "^17.0.2",
133120
"ts-jest": "^29.2.5",
121+
"ts-node": "^10.9.2",
134122
"typescript": "^5.2.2",
135123
"yarn-audit-fix": "^10.0.1"
136124
},

ui/components/DataTable/__tests__/__snapshots__/DataTable.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ exports[`DataTable snapshots renders 1`] = `
429429
</button>
430430
<div
431431
style={
432-
Object {
432+
{
433433
"width": "16px",
434434
}
435435
}
@@ -471,7 +471,7 @@ exports[`DataTable snapshots renders 1`] = `
471471
</button>
472472
<div
473473
style={
474-
Object {
474+
{
475475
"width": "16px",
476476
}
477477
}
@@ -513,7 +513,7 @@ exports[`DataTable snapshots renders 1`] = `
513513
</button>
514514
<div
515515
style={
516-
Object {
516+
{
517517
"width": "16px",
518518
}
519519
}

ui/components/Sync/__tests__/__snapshots__/SyncActions.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ exports[`SyncActions snapshots non-suspended 1`] = `
705705
</span>
706706
<span
707707
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1lw54ax-MuiTypography-root"
708-
style={Object {}}
708+
style={{}}
709709
>
710710
with Source
711711
</span>
@@ -771,7 +771,7 @@ exports[`SyncActions snapshots non-suspended 1`] = `
771771
</span>
772772
<span
773773
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1lw54ax-MuiTypography-root"
774-
style={Object {}}
774+
style={{}}
775775
>
776776
without Source
777777
</span>
@@ -1254,7 +1254,7 @@ exports[`SyncActions snapshots suspended 1`] = `
12541254
</span>
12551255
<span
12561256
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label Mui-disabled css-1lw54ax-MuiTypography-root"
1257-
style={Object {}}
1257+
style={{}}
12581258
>
12591259
with Source
12601260
</span>
@@ -1321,7 +1321,7 @@ exports[`SyncActions snapshots suspended 1`] = `
13211321
</span>
13221322
<span
13231323
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label Mui-disabled css-1lw54ax-MuiTypography-root"
1324-
style={Object {}}
1324+
style={{}}
13251325
>
13261326
without Source
13271327
</span>

ui/components/Sync/__tests__/__snapshots__/SyncControls.test.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ exports[`SyncControls snapshots allButtonsDisabled 1`] = `
311311
</span>
312312
<span
313313
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label Mui-disabled css-1lw54ax-MuiTypography-root"
314-
style={Object {}}
314+
style={{}}
315315
>
316316
with Source
317317
</span>
@@ -378,7 +378,7 @@ exports[`SyncControls snapshots allButtonsDisabled 1`] = `
378378
</span>
379379
<span
380380
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label Mui-disabled css-1lw54ax-MuiTypography-root"
381-
style={Object {}}
381+
style={{}}
382382
>
383383
without Source
384384
</span>
@@ -851,7 +851,7 @@ exports[`SyncControls snapshots hasTooltipSuffix 1`] = `
851851
</span>
852852
<span
853853
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1lw54ax-MuiTypography-root"
854-
style={Object {}}
854+
style={{}}
855855
>
856856
with Source
857857
</span>
@@ -917,7 +917,7 @@ exports[`SyncControls snapshots hasTooltipSuffix 1`] = `
917917
</span>
918918
<span
919919
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1lw54ax-MuiTypography-root"
920-
style={Object {}}
920+
style={{}}
921921
>
922922
without Source
923923
</span>
@@ -1341,7 +1341,7 @@ exports[`SyncControls snapshots hideSuspend 1`] = `
13411341
</span>
13421342
<span
13431343
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1lw54ax-MuiTypography-root"
1344-
style={Object {}}
1344+
style={{}}
13451345
>
13461346
with Source
13471347
</span>
@@ -1407,7 +1407,7 @@ exports[`SyncControls snapshots hideSuspend 1`] = `
14071407
</span>
14081408
<span
14091409
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1lw54ax-MuiTypography-root"
1410-
style={Object {}}
1410+
style={{}}
14111411
>
14121412
without Source
14131413
</span>
@@ -2158,7 +2158,7 @@ exports[`SyncControls snapshots non-suspended 1`] = `
21582158
</span>
21592159
<span
21602160
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1lw54ax-MuiTypography-root"
2161-
style={Object {}}
2161+
style={{}}
21622162
>
21632163
with Source
21642164
</span>
@@ -2224,7 +2224,7 @@ exports[`SyncControls snapshots non-suspended 1`] = `
22242224
</span>
22252225
<span
22262226
className="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1lw54ax-MuiTypography-root"
2227-
style={Object {}}
2227+
style={{}}
22282228
>
22292229
without Source
22302230
</span>

ui/components/__tests__/__snapshots__/YamlView.test.tsx.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ exports[`YamlView snapshots renders 1`] = `
172172
<div
173173
onClick={[Function]}
174174
style={
175-
Object {
175+
{
176176
"cursor": "pointer",
177177
}
178178
}
@@ -203,7 +203,7 @@ exports[`YamlView snapshots renders 1`] = `
203203
<div
204204
onClick={[Function]}
205205
style={
206-
Object {
206+
{
207207
"cursor": "pointer",
208208
}
209209
}
@@ -227,7 +227,7 @@ exports[`YamlView snapshots renders 1`] = `
227227
</div>
228228
<pre
229229
style={
230-
Object {
230+
{
231231
"MozHyphens": "none",
232232
"MozTabSize": "4",
233233
"OTabSize": "4",
@@ -255,23 +255,23 @@ exports[`YamlView snapshots renders 1`] = `
255255
>
256256
<code
257257
style={
258-
Object {
258+
{
259259
"whiteSpace": "pre",
260260
"wordBreak": "break-word",
261261
}
262262
}
263263
>
264264
<span
265265
style={
266-
Object {
266+
{
267267
"textWrap": "wrap",
268268
}
269269
}
270270
>
271271
<span
272272
className="linenumber react-syntax-highlighter-line-number"
273273
style={
274-
Object {
274+
{
275275
"color": "slategray",
276276
"display": "inline-block",
277277
"minWidth": "1.25em",
@@ -284,7 +284,7 @@ exports[`YamlView snapshots renders 1`] = `
284284
1
285285
</span>
286286
<span
287-
style={Object {}}
287+
style={{}}
288288
>
289289
yaml\\nyaml\\nyaml\\n
290290
</span>

0 commit comments

Comments
 (0)