You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
koni1234
changed the title
[Bug]: TS 5.2 - TypeError: [1,3,2].toSorted is not a function
[Bug]: TS 5.2 - TypeError: toSorted is not a function
Sep 4, 2023
Version
29.1.1
Steps to reproduce
TS config:
{ "compilerOptions": { // ..., "target": "ES6", "module": "ESNext", "moduleResolution": "Node", "lib": ["ES2023", "DOM"], } }
Jest config:
{ preset: 'ts-jest', testEnvironment: 'jsdom', testEnvironmentOptions: { customExportConditions: ['node', 'node-addons'], }, setupFiles: ['<rootDir>/tests/unit/jest.init.ts'], transform: { '^.+\\.ts$': ['ts-jest', { isolatedModules: true }], // ... }, // ..., };
create a simple test like this one
describe('',() => { it('test toSorted', () => { expect([1, 3, 2].toSorted()).toStrictEqual([1, 2, 3]); }); });
Expected behavior
I should see the test passed
Actual behavior
Test fail with this error:
TypeError: [1,3,2].toSorted is not a function
Debug log
https://justpaste.it/ckwj8
Additional context
Typescript checks and build work fine, the problem seems to be present only in unit tests.
Environment
System: OS: macOS 13.2 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Binaries: Node: 18.14.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.3.1 - /usr/local/bin/npm npmPackages: jest: ^29.6.2 => 29.6.2
The text was updated successfully, but these errors were encountered: