Skip to content

Commit

Permalink
upgrade to jest 27 and jasmine-check to 1.0.0-rc (#1874)
Browse files Browse the repository at this point in the history
* upgrade to jest 27

* remove deprecation for jasmine-check

* fix version number
  • Loading branch information
jdeniau committed Sep 16, 2021
1 parent d8cc0a2 commit c515a9f
Show file tree
Hide file tree
Showing 8 changed files with 2,363 additions and 2,853 deletions.
13 changes: 9 additions & 4 deletions __tests__/Equality.ts
Expand Up @@ -117,12 +117,17 @@ describe('Equality', () => {
expectIs(list, listShorter);
});

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

const genVal = gen.oneOf([
gen.map(List, gen.array(genSimpleVal, 0, 4)),
gen.map(Set, gen.array(genSimpleVal, 0, 4)),
gen.map(Map, gen.array(gen.array(genSimpleVal, 2), 0, 4)),
gen.array(genSimpleVal, { minSize: 0, maxSize: 4 }).then(List),
gen.array(genSimpleVal, { minSize: 0, maxSize: 4 }).then(Set),
gen
.array(gen.array(genSimpleVal, { size: 2 }), {
minSize: 0,
maxSize: 4,
})
.then(Map),
]);

check.it(
Expand Down
2 changes: 1 addition & 1 deletion __tests__/Range.ts
Expand Up @@ -77,7 +77,7 @@ describe('Range', () => {
}
});

const shrinkInt = gen.shrink(gen.int);
const shrinkInt = gen.int.alwaysShrink();

check.it(
'slices the same as array slices',
Expand Down
13 changes: 11 additions & 2 deletions __tests__/slice.ts
Expand Up @@ -229,7 +229,13 @@ describe('slice', () => {

check.it(
'works like Array.prototype.slice',
[gen.int, gen.array(gen.oneOf([gen.int, gen.undefined]), 0, 3)],
[
gen.int,
gen.array(gen.oneOf([gen.int, gen.undefined]), {
minSize: 0,
maxSize: 3,
}),
],
(valuesLen, args) => {
const a = Range(0, valuesLen).toArray();
const v = List(a);
Expand All @@ -243,7 +249,10 @@ describe('slice', () => {
'works like Array.prototype.slice on sparse array input',
[
gen.array(gen.array([gen.posInt, gen.int])),
gen.array(gen.oneOf([gen.int, gen.undefined]), 0, 3),
gen.array(gen.oneOf([gen.int, gen.undefined]), {
minSize: 0,
maxSize: 3,
}),
],
(entries, args) => {
const a: Array<any> = [];
Expand Down
3 changes: 3 additions & 0 deletions __tests__/utils.js
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
/* global document */
// eslint-disable-next-line import/no-unresolved -- immutable is resolve by jest resolver
import { List, isPlainObject } from 'immutable';
Expand Down
4 changes: 2 additions & 2 deletions __tests__/zip.ts
Expand Up @@ -55,7 +55,7 @@ describe('zip', () => {

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

check.it(
'is always the size of the longest sequence',
[gen.notEmpty(gen.array(gen.posInt))],
[gen.array(gen.posInt).notEmpty()],
lengths => {
const ranges = lengths.map(l => Range(0, l));
const first = ranges.shift();
Expand Down
10 changes: 10 additions & 0 deletions jest.config.js
@@ -0,0 +1,10 @@
module.exports = {
testRunner: 'jest-jasmine2', // See https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults as `jasmine-check` uses jasmine and not `jest-circus`
moduleFileExtensions: ['js', 'ts'],
resolver: '<rootDir>/resources/jestResolver.js',
transform: {
'^.+\\.(js|ts)$': '<rootDir>/resources/jestPreprocessor.js',
},
testRegex: '/__tests__/.*\\.(ts|js)$',
unmockedModulePathPatterns: ['./node_modules/react'],
};

0 comments on commit c515a9f

Please sign in to comment.