Skip to content

Navigation Menu

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

Better TypeScript configuration for jest #2087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 __tests__/ArraySeq.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Seq } from 'immutable';

describe('ArraySequence', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/Comparator.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { List, OrderedSet, Seq, type Comparator, PairSorting } from 'immutable';

const sourceNumbers: readonly number[] = [3, 4, 5, 6, 7, 9, 10, 12, 90, 92, 95];
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/Conversion.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { fromJS, is, List, Map, OrderedMap, Record } from 'immutable';
import fc, { type JsonValue } from 'fast-check';

Expand Down
2 changes: 2 additions & 0 deletions 2 __tests__/Equality.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { is, List, Map, Seq, Set } from 'immutable';
import fc from 'fast-check';

Expand Down Expand Up @@ -143,6 +144,7 @@ describe('Equality', () => {
fc.assert(
fc.property(genVal, genVal, (a, b) => {
if (is(a, b)) {
// eslint-disable-next-line jest/no-conditional-expect
expect(a.hashCode()).toBe(b.hashCode());
}
}),
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/IndexedSeq.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Seq } from 'immutable';

describe('IndexedSequence', () => {
Expand Down
3 changes: 2 additions & 1 deletion 3 __tests__/KeyedSeq.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { describe, expect, it } from '@jest/globals';
import { Range, Seq } from 'immutable';
import fc from 'fast-check';

describe('KeyedSeq', () => {
it('it iterates equivalently', () => {
it('iterates equivalently', () => {
fc.assert(
fc.property(fc.array(fc.integer()), (ints) => {
const seq = Seq(ints);
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/List.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { fromJS, List, Map, Range, Seq, Set } from 'immutable';
import fc from 'fast-check';
import { create as createSeed } from 'random-seed';
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/ListJS.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { List } from 'immutable';

const NON_NUMBERS = {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/Map.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest } from '@jest/globals';
import { fromJS, is, List, Map, Range, Record, Seq } from 'immutable';
import fc from 'fast-check';

Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/MultiRequire.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest } from '@jest/globals';
import * as Immutable1 from '../src/Immutable';

jest.resetModules();
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/ObjectSeq.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Seq } from 'immutable';

describe('ObjectSequence', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/OrderedMap.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { OrderedMap, Range, Seq } from 'immutable';

describe('OrderedMap', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/OrderedSet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { OrderedSet, Map } from 'immutable';

describe('OrderedSet', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/Predicates.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import {
is,
isImmutable,
Expand Down
2 changes: 2 additions & 0 deletions 2 __tests__/Range.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Range } from 'immutable';
import fc from 'fast-check';

Expand Down Expand Up @@ -86,6 +87,7 @@ describe('Range', () => {
const last = to + (isIncreasing ? -1 : 1);
expect(r.last()).toBe(size ? last : undefined);
if (size) {
// eslint-disable-next-line jest/no-conditional-expect
expect(a[a.length - 1]).toBe(last);
}
})
Expand Down
3 changes: 2 additions & 1 deletion 3 __tests__/Record.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { isKeyed, List, Map, Record, Seq } from 'immutable';

describe('Record', () => {
Expand Down Expand Up @@ -78,7 +79,7 @@ describe('Record', () => {
const MyType = Record({ a: 1, b: 2, c: 3 });
const t1 = MyType({ a: 10 });
const t2 = MyType({ a: 10, b: 2 });
expect(t1.equals(t2));
expect(t1.equals(t2)).toBe(true);
});

it('if compared against undefined or null should return false', () => {
Expand Down
5 changes: 3 additions & 2 deletions 5 __tests__/RecordJS.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Record } from 'immutable';

describe('Record', () => {
Expand Down Expand Up @@ -41,8 +42,8 @@ describe('Record', () => {
const t = new Alphabet();
const t2 = t.set('b', 200);

expect(t instanceof Record);
expect(t instanceof Alphabet);
expect(t instanceof Record).toBe(true);
expect(t instanceof Alphabet).toBe(true);
expect(t.soup()).toBe(6);
expect(t2.soup()).toBe(204);

Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/Repeat.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Repeat } from 'immutable';

describe('Repeat', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/Seq.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { isCollection, isIndexed, isKeyed, Seq } from 'immutable';

describe('Seq', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/Set.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, jest } from '@jest/globals';
import { fromJS, is, List, Map, OrderedSet, Seq, Set } from 'immutable';

describe('Set', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/Stack.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Seq, Stack } from 'immutable';
import fc from 'fast-check';

Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/concat.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { List, Seq, Set } from 'immutable';

describe('concat', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/count.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Range, Seq } from 'immutable';

describe('count', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/find.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Seq } from 'immutable';

describe('find', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/flatten.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Collection, fromJS, List, Range, Seq } from 'immutable';

describe('flatten', () => {
Expand Down
3 changes: 2 additions & 1 deletion 3 __tests__/fromJS.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from '@jest/globals';
import { runInNewContext } from 'vm';

import { List, Map, Set, isCollection, fromJS } from 'immutable';

describe('fromJS', () => {
Expand Down Expand Up @@ -64,6 +64,7 @@ describe('fromJS', () => {
expect(isCollection(fromJS({}))).toBe(true);
});

// eslint-disable-next-line jest/expect-expect
it('is iterable inside of a vm', () => {
runInNewContext(
`
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/functional/get.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { get, Map, List, Range } from 'immutable';

describe('get', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/functional/has.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { has, Map, List, Range } from 'immutable';

describe('has', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/functional/remove.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { remove, List, Map } from 'immutable';

describe('remove', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/functional/set.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { set } from 'immutable';

describe('set', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/functional/update.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { update } from 'immutable';

describe('update', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/get.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Range } from 'immutable';

describe('get', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/getIn.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { fromJS, getIn, List, Map } from 'immutable';

describe('getIn', () => {
Expand Down
3 changes: 3 additions & 0 deletions 3 __tests__/groupBy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import {
Collection,
Map,
Expand Down Expand Up @@ -40,8 +41,10 @@ describe('groupBy', () => {
expect(isOrdered(col)).toBe(constructorIsOrdered);
expect(isOrdered(grouped)).toBe(constructorIsOrdered);
if (constructorIsOrdered) {
// eslint-disable-next-line jest/no-conditional-expect
expect(grouped).toBeInstanceOf(OrderedMap);
} else {
// eslint-disable-next-line jest/no-conditional-expect
expect(grouped).not.toBeInstanceOf(OrderedMap);
}
}
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/hasIn.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { fromJS, hasIn, List, Map } from 'immutable';

describe('hasIn', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/hash.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { hash } from 'immutable';
import fc from 'fast-check';

Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/interpose.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Range } from 'immutable';

describe('interpose', () => {
Expand Down
11 changes: 7 additions & 4 deletions 11 __tests__/issues.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import {
fromJS,
List,
Expand Down Expand Up @@ -34,7 +35,7 @@ describe('Issue #1188', () => {
});
});

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

it(`Collection#hashCode() should handle objects that return ${label} for valueOf`, () => {
const set = Set().add(new MyClass());
set.hashCode();
expect(() => set.hashCode()).not.toThrow();
});
});
});

describe('Issue #1785', () => {
const emptyRecord = Record({})();
it('merge() should not return undefined', () => {
const emptyRecord = Record({})();

expect(emptyRecord.merge({ id: 1 })).toBe(emptyRecord);
expect(emptyRecord.merge({ id: 1 })).toBe(emptyRecord);
});
});

describe('Issue #1475', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/join.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Seq } from 'immutable';
import fc from 'fast-check';

Expand Down
3 changes: 2 additions & 1 deletion 3 __tests__/merge.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import {
fromJS,
List,
Expand Down Expand Up @@ -34,7 +35,7 @@ describe('merge', () => {
const m1 = Map({ a: 1, b: 2, c: 3 });
const m2 = Map({ d: 10, b: 20, e: 30 });
// @ts-expect-error -- test that runtime does throw
expect(() => m1.mergeWith(1, m2)).toThrowError(TypeError);
expect(() => m1.mergeWith(1, m2)).toThrow(TypeError);
});

it('provides key as the third argument of merge function', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/minmax.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { is, Seq } from 'immutable';
import fc from 'fast-check';

Expand Down
3 changes: 2 additions & 1 deletion 3 __tests__/partition.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import {
isAssociative,
isIndexed,
Expand All @@ -13,7 +14,7 @@ import {
} from 'immutable';

describe('partition', () => {
let isOdd: jest.Mock<unknown, [x: number]>;
let isOdd: jest.Mock<(x: number) => number>;

beforeEach(() => {
isOdd = jest.fn((x) => x % 2);
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/slice.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { List, Range, Seq } from 'immutable';
import fc from 'fast-check';

Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/sort.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { List, OrderedMap, Range, Seq } from 'immutable';

describe('sort', () => {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/splice.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { List, Range, Seq } from 'immutable';
import fc from 'fast-check';

Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/transformerProtocol.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import * as t from 'transducers-js';
import { List, Map, Set, Stack } from 'immutable';

Expand Down
2 changes: 2 additions & 0 deletions 2 __tests__/ts-utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect } from '@jest/globals';

export function expectToBeDefined<T>(
arg: T
): asserts arg is Exclude<T, undefined> {
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/updateIn.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import {
fromJS,
List,
Expand Down
1 change: 1 addition & 0 deletions 1 __tests__/zip.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { List, Range, Seq } from 'immutable';
import fc from 'fast-check';
import { expectToBeDefined } from './ts-utils';
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.