Skip to content

Commit 1677e09

Browse files
authored
feat(scripts): drop test command BREAKING (#5745)
talend-scripts test doesn't exists anymore. Please migrate to vitest
1 parent 6181519 commit 1677e09

39 files changed

Lines changed: 318 additions & 2469 deletions

.changeset/hungry-animals-dig.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@talend/scripts-core': major
3+
---
4+
5+
Drop test command (jest). You should migrate to vitest

.github/copilot-instructions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ ComponentName/
184184

185185
### Framework & Setup
186186

187-
- **Jest** as test runner (config via `@talend/scripts-config-jest`)
187+
- **Vitest** as test runner
188188
- **@testing-library/react** for component rendering and queries
189189
- **jest-axe** for automated accessibility checks
190-
- **jest-serializer-html** for snapshot serialization
191-
- **jsdom** test environment (`jest-environment-jsdom-global`)
192190
- Timezone forced to `UTC` (`TZ=UTC`)
193191

194192
### Test File Conventions

packages/a11y/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"@vitest/coverage-v8": "^4.0.18",
5050
"date-fns": "^3.6.0",
5151
"eslint": "^10.0.3",
52-
"jest-in-case": "^1.0.2",
5352
"react": "^18.3.1",
5453
"react-dom": "^18.3.1",
5554
"vitest": "^4.0.18"

packages/a11y/src/Gesture/withDynamicListGesture.test.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Component } from 'react';
33
import React from 'react';
44
import { render, screen } from '@testing-library/react';
55
import userEvent from '@testing-library/user-event';
6-
import cases from 'jest-in-case';
76

87
import { WithDynamicListGesture } from './withDynamicListGesture';
98

@@ -71,7 +70,7 @@ describe('List Gesture HOC', () => {
7170
expect(screen.getByTestId(`item-${expectedActiveIndex}`)).toHaveFocus();
7271
}
7372

74-
cases('focus', testFocus, [
73+
it.each([
7574
{
7675
name: 'should focus previous item on up keydown',
7776
elementIndex: 22,
@@ -108,5 +107,5 @@ describe('List Gesture HOC', () => {
108107
expectedActiveIndex: 27,
109108
key: 'PageDown',
110109
},
111-
]);
110+
])('$name', testFocus);
112111
});

packages/a11y/src/Gesture/withListGesture.test.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { render, screen } from '@testing-library/react';
33
import userEvent from '@testing-library/user-event';
4-
import cases from 'jest-in-case';
54

65
import List from '../__mocks__/list';
76
import { withListGesture } from './withListGesture';
@@ -40,7 +39,7 @@ describe('List Gesture HOC', () => {
4039
* - item-2
4140
* - item-3
4241
*/
43-
cases('focus', testFocus, [
42+
it.each([
4443
{
4544
name: 'should focus next item on down keydown',
4645
elementPosition: 0,
@@ -67,5 +66,5 @@ describe('List Gesture HOC', () => {
6766
key: 'ArrowUp',
6867
loop: true,
6968
},
70-
]);
69+
])('$name', testFocus);
7170
});

packages/a11y/src/Gesture/withTreeGesture.test.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import React from 'react';
33
import { render, screen } from '@testing-library/react';
44
import userEvent from '@testing-library/user-event';
5-
import cases from 'jest-in-case';
65

76
import Tree from '../__mocks__/tree';
87
import { withTreeGesture } from './withTreeGesture';
@@ -165,7 +164,7 @@ describe('TreeGesture HOC', () => {
165164
expect(screen.getByText(expectedActivePosition)).toHaveFocus();
166165
}
167166

168-
cases('focus', testFocus, [
167+
it.each([
169168
{
170169
name: 'should focus its parent on left keydown',
171170
elementPosition: 'Eleven',
@@ -202,5 +201,5 @@ describe('TreeGesture HOC', () => {
202201
expectedActivePosition: 'Three',
203202
key: 'End',
204203
},
205-
]);
204+
])('$name', testFocus);
206205
});

packages/cmf/__tests__/selectors/collections.test.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Map, List } from 'immutable';
2-
import cases from 'jest-in-case';
32
import selectors from '../../src/selectors';
43

54
describe('selectors.collections', () => {
@@ -65,14 +64,8 @@ const state = {
6564
},
6665
};
6766

68-
cases(
69-
'find(state, pathDescriptor, resourceId)',
70-
opts => {
71-
expect(
72-
selectors.collections.findListItem(opts.state, opts.pathDescriptor, opts.resourceId),
73-
).toBe(opts.result);
74-
},
75-
[
67+
describe('find(state, pathDescriptor, resourceId)', () => {
68+
it.each([
7669
{
7770
name: 'work if collection path is a string',
7871
state,
@@ -94,17 +87,15 @@ cases(
9487
resourceId: 'notFound',
9588
result: undefined,
9689
},
97-
],
98-
);
90+
])('$name', opts => {
91+
expect(
92+
selectors.collections.findListItem(opts.state, opts.pathDescriptor, opts.resourceId),
93+
).toBe(opts.result);
94+
});
95+
});
9996

100-
cases(
101-
'selectors.collections.findListItem(state, pathDescriptor, resourceId)',
102-
opts => {
103-
expect(() => {
104-
selectors.collections.findListItem(opts.state, opts.pathDescriptor, opts.resourceId);
105-
}).toThrow(opts.result);
106-
},
107-
[
97+
describe('selectors.collections.findListItem(state, pathDescriptor, resourceId)', () => {
98+
it.each([
10899
{
109100
name: 'throw if collection path is not a List',
110101
state,
@@ -121,5 +112,9 @@ got Map { "id": Map { "id": "id" } }`,
121112
result: `Type mismatch: notFound does not resolve as an instance of Immutable.List,
122113
got undefined`,
123114
},
124-
],
125-
);
115+
])('$name', opts => {
116+
expect(() => {
117+
selectors.collections.findListItem(opts.state, opts.pathDescriptor, opts.resourceId);
118+
}).toThrow(opts.result);
119+
});
120+
});

packages/cmf/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"@talend/scripts-config-react-webpack": "^17.1.0",
7373
"@testing-library/react": "^14.3.1",
7474
"eslint": "^10.0.3",
75-
"jest-in-case": "^1.0.2",
7675
"node-fetch": "^2.7.0",
7776
"react": "^18.3.1",
7877
"react-dom": "^18.3.1",

packages/components/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
"cross-env": "^7.0.3",
108108
"eslint": "^10.0.3",
109109
"i18next": "^23.16.8",
110-
"jest-in-case": "^1.0.2",
111110
"jsdom": "^26.1.0",
112111
"prop-types": "^15.8.1",
113112
"react": "^18.3.1",
Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import cases from 'jest-in-case';
2-
31
import { getTimeFormat, timeToStr } from './time-extraction';
42

53
describe('time-extraction', () => {
@@ -22,31 +20,27 @@ describe('time-extraction', () => {
2220
});
2321
});
2422
describe('timeToStr', () => {
25-
cases(
26-
'should convert time object to string',
27-
({ time, useSeconds, expectedStr }) => {
28-
expect(timeToStr(time, useSeconds)).toBe(expectedStr);
23+
it.each([
24+
{
25+
name: 'when useSeconds is false',
26+
time: { hours: '12', minutes: '30', seconds: '00' },
27+
useSeconds: false,
28+
expectedStr: '12:30',
29+
},
30+
{
31+
name: 'when useSeconds is true',
32+
time: { hours: '12', minutes: '30', seconds: '00' },
33+
useSeconds: true,
34+
expectedStr: '12:30:00',
2935
},
30-
[
31-
{
32-
name: 'when useSeconds is false',
33-
time: { hours: '12', minutes: '30', seconds: '00' },
34-
useSeconds: false,
35-
expectedStr: '12:30',
36-
},
37-
{
38-
name: 'when useSeconds is true',
39-
time: { hours: '12', minutes: '30', seconds: '00' },
40-
useSeconds: true,
41-
expectedStr: '12:30:00',
42-
},
43-
{
44-
name: 'when hours, minutes, seconds are numbers',
45-
time: { hours: 23, minutes: 59, seconds: 0 },
46-
useSeconds: false,
47-
expectedStr: '23:59',
48-
},
49-
],
50-
);
36+
{
37+
name: 'when hours, minutes, seconds are numbers',
38+
time: { hours: 23, minutes: 59, seconds: 0 },
39+
useSeconds: false,
40+
expectedStr: '23:59',
41+
},
42+
])('should convert time object to string - $name', ({ time, useSeconds, expectedStr }) => {
43+
expect(timeToStr(time, useSeconds)).toBe(expectedStr);
44+
});
5145
});
5246
});

0 commit comments

Comments
 (0)