Skip to content

Commit c515a9f

Browse files
authored
upgrade to jest 27 and jasmine-check to 1.0.0-rc (#1874)
* upgrade to jest 27 * remove deprecation for jasmine-check * fix version number
1 parent d8cc0a2 commit c515a9f

File tree

8 files changed

+2363
-2853
lines changed

8 files changed

+2363
-2853
lines changed

__tests__/Equality.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,17 @@ describe('Equality', () => {
117117
expectIs(list, listShorter);
118118
});
119119

120-
const genSimpleVal = gen.returnOneOf(['A', 1]);
120+
const genSimpleVal = gen.oneOf(['A', 1]);
121121

122122
const genVal = gen.oneOf([
123-
gen.map(List, gen.array(genSimpleVal, 0, 4)),
124-
gen.map(Set, gen.array(genSimpleVal, 0, 4)),
125-
gen.map(Map, gen.array(gen.array(genSimpleVal, 2), 0, 4)),
123+
gen.array(genSimpleVal, { minSize: 0, maxSize: 4 }).then(List),
124+
gen.array(genSimpleVal, { minSize: 0, maxSize: 4 }).then(Set),
125+
gen
126+
.array(gen.array(genSimpleVal, { size: 2 }), {
127+
minSize: 0,
128+
maxSize: 4,
129+
})
130+
.then(Map),
126131
]);
127132

128133
check.it(

__tests__/Range.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('Range', () => {
7777
}
7878
});
7979

80-
const shrinkInt = gen.shrink(gen.int);
80+
const shrinkInt = gen.int.alwaysShrink();
8181

8282
check.it(
8383
'slices the same as array slices',

__tests__/slice.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,13 @@ describe('slice', () => {
229229

230230
check.it(
231231
'works like Array.prototype.slice',
232-
[gen.int, gen.array(gen.oneOf([gen.int, gen.undefined]), 0, 3)],
232+
[
233+
gen.int,
234+
gen.array(gen.oneOf([gen.int, gen.undefined]), {
235+
minSize: 0,
236+
maxSize: 3,
237+
}),
238+
],
233239
(valuesLen, args) => {
234240
const a = Range(0, valuesLen).toArray();
235241
const v = List(a);
@@ -243,7 +249,10 @@ describe('slice', () => {
243249
'works like Array.prototype.slice on sparse array input',
244250
[
245251
gen.array(gen.array([gen.posInt, gen.int])),
246-
gen.array(gen.oneOf([gen.int, gen.undefined]), 0, 3),
252+
gen.array(gen.oneOf([gen.int, gen.undefined]), {
253+
minSize: 0,
254+
maxSize: 3,
255+
}),
247256
],
248257
(entries, args) => {
249258
const a: Array<any> = [];

__tests__/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @jest-environment jsdom
3+
*/
14
/* global document */
25
// eslint-disable-next-line import/no-unresolved -- immutable is resolve by jest resolver
36
import { List, isPlainObject } from 'immutable';

__tests__/zip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('zip', () => {
5555

5656
check.it(
5757
'is always the size of the smaller sequence',
58-
[gen.notEmpty(gen.array(gen.posInt))],
58+
[gen.array(gen.posInt).notEmpty()],
5959
lengths => {
6060
const ranges = lengths.map(l => Range(0, l));
6161
const first = ranges.shift();
@@ -108,7 +108,7 @@ describe('zip', () => {
108108

109109
check.it(
110110
'is always the size of the longest sequence',
111-
[gen.notEmpty(gen.array(gen.posInt))],
111+
[gen.array(gen.posInt).notEmpty()],
112112
lengths => {
113113
const ranges = lengths.map(l => Range(0, l));
114114
const first = ranges.shift();

jest.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
testRunner: 'jest-jasmine2', // See https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults as `jasmine-check` uses jasmine and not `jest-circus`
3+
moduleFileExtensions: ['js', 'ts'],
4+
resolver: '<rootDir>/resources/jestResolver.js',
5+
transform: {
6+
'^.+\\.(js|ts)$': '<rootDir>/resources/jestPreprocessor.js',
7+
},
8+
testRegex: '/__tests__/.*\\.(ts|js)$',
9+
unmockedModulePathPatterns: ['./node_modules/react'],
10+
};

0 commit comments

Comments
 (0)