Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 88b7b19

Browse filesBrowse files
committed
Better TypeScript configuration for jest
1 parent 7364aea commit 88b7b19
Copy full SHA for 88b7b19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

56 files changed

+552
-211
lines changed

‎__tests__/ArraySeq.ts

Copy file name to clipboardExpand all lines: __tests__/ArraySeq.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Seq } from 'immutable';
23

34
describe('ArraySequence', () => {

‎__tests__/Comparator.ts

Copy file name to clipboardExpand all lines: __tests__/Comparator.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { List, OrderedSet, Seq, type Comparator, PairSorting } from 'immutable';
23

34
const sourceNumbers: readonly number[] = [3, 4, 5, 6, 7, 9, 10, 12, 90, 92, 95];

‎__tests__/Conversion.ts

Copy file name to clipboardExpand all lines: __tests__/Conversion.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { fromJS, is, List, Map, OrderedMap, Record } from 'immutable';
23
import fc, { type JsonValue } from 'fast-check';
34

‎__tests__/Equality.ts

Copy file name to clipboardExpand all lines: __tests__/Equality.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { is, List, Map, Seq, Set } from 'immutable';
23
import fc from 'fast-check';
34

@@ -143,6 +144,7 @@ describe('Equality', () => {
143144
fc.assert(
144145
fc.property(genVal, genVal, (a, b) => {
145146
if (is(a, b)) {
147+
// eslint-disable-next-line jest/no-conditional-expect
146148
expect(a.hashCode()).toBe(b.hashCode());
147149
}
148150
}),

‎__tests__/IndexedSeq.ts

Copy file name to clipboardExpand all lines: __tests__/IndexedSeq.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Seq } from 'immutable';
23

34
describe('IndexedSequence', () => {

‎__tests__/KeyedSeq.ts

Copy file name to clipboardExpand all lines: __tests__/KeyedSeq.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Range, Seq } from 'immutable';
23
import fc from 'fast-check';
34

45
describe('KeyedSeq', () => {
5-
it('it iterates equivalently', () => {
6+
it('iterates equivalently', () => {
67
fc.assert(
78
fc.property(fc.array(fc.integer()), (ints) => {
89
const seq = Seq(ints);

‎__tests__/List.ts

Copy file name to clipboardExpand all lines: __tests__/List.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { fromJS, List, Map, Range, Seq, Set } from 'immutable';
23
import fc from 'fast-check';
34
import { create as createSeed } from 'random-seed';

‎__tests__/ListJS.js

Copy file name to clipboardExpand all lines: __tests__/ListJS.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { List } from 'immutable';
23

34
const NON_NUMBERS = {

‎__tests__/Map.ts

Copy file name to clipboardExpand all lines: __tests__/Map.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it, jest } from '@jest/globals';
12
import { fromJS, is, List, Map, Range, Record, Seq } from 'immutable';
23
import fc from 'fast-check';
34

‎__tests__/MultiRequire.js

Copy file name to clipboardExpand all lines: __tests__/MultiRequire.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import * as Immutable1 from '../src/Immutable';
23

34
jest.resetModules();

‎__tests__/ObjectSeq.ts

Copy file name to clipboardExpand all lines: __tests__/ObjectSeq.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Seq } from 'immutable';
23

34
describe('ObjectSequence', () => {

‎__tests__/OrderedMap.ts

Copy file name to clipboardExpand all lines: __tests__/OrderedMap.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { OrderedMap, Range, Seq } from 'immutable';
23

34
describe('OrderedMap', () => {

‎__tests__/OrderedSet.ts

Copy file name to clipboardExpand all lines: __tests__/OrderedSet.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { OrderedSet, Map } from 'immutable';
23

34
describe('OrderedSet', () => {

‎__tests__/Predicates.ts

Copy file name to clipboardExpand all lines: __tests__/Predicates.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import {
23
is,
34
isImmutable,

‎__tests__/Range.ts

Copy file name to clipboardExpand all lines: __tests__/Range.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Range } from 'immutable';
23
import fc from 'fast-check';
34

@@ -86,6 +87,7 @@ describe('Range', () => {
8687
const last = to + (isIncreasing ? -1 : 1);
8788
expect(r.last()).toBe(size ? last : undefined);
8889
if (size) {
90+
// eslint-disable-next-line jest/no-conditional-expect
8991
expect(a[a.length - 1]).toBe(last);
9092
}
9193
})

‎__tests__/Record.ts

Copy file name to clipboardExpand all lines: __tests__/Record.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { isKeyed, List, Map, Record, Seq } from 'immutable';
23

34
describe('Record', () => {
@@ -78,7 +79,7 @@ describe('Record', () => {
7879
const MyType = Record({ a: 1, b: 2, c: 3 });
7980
const t1 = MyType({ a: 10 });
8081
const t2 = MyType({ a: 10, b: 2 });
81-
expect(t1.equals(t2));
82+
expect(t1.equals(t2)).toBe(true);
8283
});
8384

8485
it('if compared against undefined or null should return false', () => {

‎__tests__/RecordJS.js

Copy file name to clipboardExpand all lines: __tests__/RecordJS.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Record } from 'immutable';
23

34
describe('Record', () => {
@@ -41,8 +42,8 @@ describe('Record', () => {
4142
const t = new Alphabet();
4243
const t2 = t.set('b', 200);
4344

44-
expect(t instanceof Record);
45-
expect(t instanceof Alphabet);
45+
expect(t instanceof Record).toBe(true);
46+
expect(t instanceof Alphabet).toBe(true);
4647
expect(t.soup()).toBe(6);
4748
expect(t2.soup()).toBe(204);
4849

‎__tests__/Repeat.ts

Copy file name to clipboardExpand all lines: __tests__/Repeat.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Repeat } from 'immutable';
23

34
describe('Repeat', () => {

‎__tests__/Seq.ts

Copy file name to clipboardExpand all lines: __tests__/Seq.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { isCollection, isIndexed, isKeyed, Seq } from 'immutable';
23

34
describe('Seq', () => {

‎__tests__/Set.ts

Copy file name to clipboardExpand all lines: __tests__/Set.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it, jest } from '@jest/globals';
12
import { fromJS, is, List, Map, OrderedSet, Seq, Set } from 'immutable';
23

34
describe('Set', () => {

‎__tests__/Stack.ts

Copy file name to clipboardExpand all lines: __tests__/Stack.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Seq, Stack } from 'immutable';
23
import fc from 'fast-check';
34

‎__tests__/concat.ts

Copy file name to clipboardExpand all lines: __tests__/concat.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { List, Seq, Set } from 'immutable';
23

34
describe('concat', () => {

‎__tests__/count.ts

Copy file name to clipboardExpand all lines: __tests__/count.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Range, Seq } from 'immutable';
23

34
describe('count', () => {

‎__tests__/find.ts

Copy file name to clipboardExpand all lines: __tests__/find.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Seq } from 'immutable';
23

34
describe('find', () => {

‎__tests__/flatten.ts

Copy file name to clipboardExpand all lines: __tests__/flatten.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Collection, fromJS, List, Range, Seq } from 'immutable';
23

34
describe('flatten', () => {

‎__tests__/fromJS.ts

Copy file name to clipboardExpand all lines: __tests__/fromJS.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { runInNewContext } from 'vm';
2-
33
import { List, Map, Set, isCollection, fromJS } from 'immutable';
44

55
describe('fromJS', () => {
@@ -64,6 +64,7 @@ describe('fromJS', () => {
6464
expect(isCollection(fromJS({}))).toBe(true);
6565
});
6666

67+
// eslint-disable-next-line jest/expect-expect
6768
it('is iterable inside of a vm', () => {
6869
runInNewContext(
6970
`

‎__tests__/functional/get.ts

Copy file name to clipboardExpand all lines: __tests__/functional/get.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { get, Map, List, Range } from 'immutable';
23

34
describe('get', () => {

‎__tests__/functional/has.ts

Copy file name to clipboardExpand all lines: __tests__/functional/has.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { has, Map, List, Range } from 'immutable';
23

34
describe('has', () => {

‎__tests__/functional/remove.ts

Copy file name to clipboardExpand all lines: __tests__/functional/remove.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { remove, List, Map } from 'immutable';
23

34
describe('remove', () => {

‎__tests__/functional/set.ts

Copy file name to clipboardExpand all lines: __tests__/functional/set.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { set } from 'immutable';
23

34
describe('set', () => {

‎__tests__/functional/update.ts

Copy file name to clipboardExpand all lines: __tests__/functional/update.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { update } from 'immutable';
23

34
describe('update', () => {

‎__tests__/get.ts

Copy file name to clipboardExpand all lines: __tests__/get.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Range } from 'immutable';
23

34
describe('get', () => {

‎__tests__/getIn.ts

Copy file name to clipboardExpand all lines: __tests__/getIn.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { fromJS, getIn, List, Map } from 'immutable';
23

34
describe('getIn', () => {

‎__tests__/groupBy.ts

Copy file name to clipboardExpand all lines: __tests__/groupBy.ts
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import {
23
Collection,
34
Map,
@@ -40,8 +41,10 @@ describe('groupBy', () => {
4041
expect(isOrdered(col)).toBe(constructorIsOrdered);
4142
expect(isOrdered(grouped)).toBe(constructorIsOrdered);
4243
if (constructorIsOrdered) {
44+
// eslint-disable-next-line jest/no-conditional-expect
4345
expect(grouped).toBeInstanceOf(OrderedMap);
4446
} else {
47+
// eslint-disable-next-line jest/no-conditional-expect
4548
expect(grouped).not.toBeInstanceOf(OrderedMap);
4649
}
4750
}

‎__tests__/hasIn.ts

Copy file name to clipboardExpand all lines: __tests__/hasIn.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { fromJS, hasIn, List, Map } from 'immutable';
23

34
describe('hasIn', () => {

‎__tests__/hash.ts

Copy file name to clipboardExpand all lines: __tests__/hash.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { hash } from 'immutable';
23
import fc from 'fast-check';
34

‎__tests__/interpose.ts

Copy file name to clipboardExpand all lines: __tests__/interpose.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Range } from 'immutable';
23

34
describe('interpose', () => {

‎__tests__/issues.ts

Copy file name to clipboardExpand all lines: __tests__/issues.ts
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import {
23
fromJS,
34
List,
@@ -34,7 +35,7 @@ describe('Issue #1188', () => {
3435
});
3536
});
3637

37-
describe('Issue #1220 : Seq.rest() throws an exception when invoked on a single item sequence ', () => {
38+
describe('Issue #1220 : Seq.rest() throws an exception when invoked on a single item sequence', () => {
3839
it('should be iterable', () => {
3940
// Helper for this test
4041
const ITERATOR_SYMBOL =
@@ -122,15 +123,17 @@ describe('Issue #1643', () => {
122123

123124
it(`Collection#hashCode() should handle objects that return ${label} for valueOf`, () => {
124125
const set = Set().add(new MyClass());
125-
set.hashCode();
126+
expect(() => set.hashCode()).not.toThrow();
126127
});
127128
});
128129
});
129130

130131
describe('Issue #1785', () => {
131-
const emptyRecord = Record({})();
132+
it('merge() should not return undefined', () => {
133+
const emptyRecord = Record({})();
132134

133-
expect(emptyRecord.merge({ id: 1 })).toBe(emptyRecord);
135+
expect(emptyRecord.merge({ id: 1 })).toBe(emptyRecord);
136+
});
134137
});
135138

136139
describe('Issue #1475', () => {

‎__tests__/join.ts

Copy file name to clipboardExpand all lines: __tests__/join.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { Seq } from 'immutable';
23
import fc from 'fast-check';
34

‎__tests__/merge.ts

Copy file name to clipboardExpand all lines: __tests__/merge.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import {
23
fromJS,
34
List,
@@ -34,7 +35,7 @@ describe('merge', () => {
3435
const m1 = Map({ a: 1, b: 2, c: 3 });
3536
const m2 = Map({ d: 10, b: 20, e: 30 });
3637
// @ts-expect-error -- test that runtime does throw
37-
expect(() => m1.mergeWith(1, m2)).toThrowError(TypeError);
38+
expect(() => m1.mergeWith(1, m2)).toThrow(TypeError);
3839
});
3940

4041
it('provides key as the third argument of merge function', () => {

‎__tests__/minmax.ts

Copy file name to clipboardExpand all lines: __tests__/minmax.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { is, Seq } from 'immutable';
23
import fc from 'fast-check';
34

‎__tests__/partition.ts

Copy file name to clipboardExpand all lines: __tests__/partition.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
12
import {
23
isAssociative,
34
isIndexed,
@@ -13,7 +14,7 @@ import {
1314
} from 'immutable';
1415

1516
describe('partition', () => {
16-
let isOdd: jest.Mock<unknown, [x: number]>;
17+
let isOdd: jest.Mock<(x: number) => number>;
1718

1819
beforeEach(() => {
1920
isOdd = jest.fn((x) => x % 2);

‎__tests__/slice.ts

Copy file name to clipboardExpand all lines: __tests__/slice.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { List, Range, Seq } from 'immutable';
23
import fc from 'fast-check';
34

‎__tests__/sort.ts

Copy file name to clipboardExpand all lines: __tests__/sort.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { List, OrderedMap, Range, Seq } from 'immutable';
23

34
describe('sort', () => {

‎__tests__/splice.ts

Copy file name to clipboardExpand all lines: __tests__/splice.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { List, Range, Seq } from 'immutable';
23
import fc from 'fast-check';
34

‎__tests__/transformerProtocol.ts

Copy file name to clipboardExpand all lines: __tests__/transformerProtocol.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import * as t from 'transducers-js';
23
import { List, Map, Set, Stack } from 'immutable';
34

‎__tests__/ts-utils.ts

Copy file name to clipboardExpand all lines: __tests__/ts-utils.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { expect } from '@jest/globals';
2+
13
export function expectToBeDefined<T>(
24
arg: T
35
): asserts arg is Exclude<T, undefined> {

‎__tests__/updateIn.ts

Copy file name to clipboardExpand all lines: __tests__/updateIn.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import {
23
fromJS,
34
List,

‎__tests__/zip.ts

Copy file name to clipboardExpand all lines: __tests__/zip.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from '@jest/globals';
12
import { List, Range, Seq } from 'immutable';
23
import fc from 'fast-check';
34
import { expectToBeDefined } from './ts-utils';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.