chore: update jest to v30

This commit is contained in:
tomasklim
2025-06-11 13:08:19 +02:00
committed by Tomáš Klíma
parent a9f09975f2
commit 6d27a2ca35
11 changed files with 1201 additions and 116 deletions

View File

@@ -121,11 +121,11 @@
"@trezor/eslint": "workspace:*",
"@types/jest": "29.5.12",
"@types/node": "22.13.10",
"babel-jest": "29.7.0",
"babel-jest": "30.0.0",
"depcheck": "^1.4.7",
"eslint": "^9.26.0",
"husky": "^9.1.7",
"jest": "29.7.0",
"jest": "30.0.0",
"jest-expo": "~52.0.6",
"node-fetch": "^2.6.4",
"node-gyp": "10.2.0",

View File

@@ -2,7 +2,6 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
// jest vs jasmine matchers compatibility:
// - jasmine is missing "toMatchObject" matcher (deeply partial matching)
// - jest.toBeCalledTimes === jasmine.matchers.toHaveBeenCalledTimes
jasmine.getEnv().beforeAll(() => {
jasmine.addMatchers({
toMatchObject: _obj => ({
@@ -56,7 +55,6 @@ jasmine.getEnv().beforeAll(() => {
return success;
},
}),
toBeCalledTimes: jasmine.matchers.toHaveBeenCalledTimes,
});
});

View File

@@ -104,7 +104,7 @@
"@trezor/trezor-user-env-link": "workspace:*",
"@types/karma": "^6.3.9",
"babel-loader": "^10.0.0",
"jest": "29.7.0",
"jest": "30.0.0",
"karma": "^6.4.4",
"karma-babel-preprocessor": "^8.0.2",
"karma-chrome-launcher": "^3.2.0",

View File

@@ -12,7 +12,7 @@ import { config } from './jest.config';
const argv: Config.Argv = {
...config,
runInBand: true,
testPathPattern: [process.argv[2] || ''],
testPathPatterns: [process.argv[2] || ''],
};
const { results } = await runCLI(argv, [__dirname]);

View File

@@ -27,7 +27,7 @@
"@trezor/utils": "workspace:*",
"buffer": "^6.0.3",
"esbuild": "^0.25.2",
"jest": "^29.7.0",
"jest": "30.0.0",
"jest-extended": "^4.0.2",
"ts-node": "^10.9.2",
"usb": "^2.15.0"

View File

@@ -57,7 +57,7 @@
"@types/bytebuffer": "^5.0.49",
"@types/sharedworker": "^0.0.143",
"@types/w3c-web-usb": "^1.0.10",
"jest": "29.7.0",
"jest": "30.0.0",
"jest-environment-node": "^29.7.0",
"ts-node": "^10.9.2",
"tsx": "^4.19.3"

View File

@@ -8,8 +8,8 @@ describe(getRandomInt.name, () => {
'The value of "max" is out of range. It must be greater than the value of "min" (0). Received -1',
);
expect(() => randomInt(0, -1)).toThrow(EXPECTED_ERROR);
expect(() => getRandomInt(0, -1)).toThrow(EXPECTED_ERROR);
expect(() => randomInt(0, -1)).toThrow(EXPECTED_ERROR.message);
expect(() => getRandomInt(0, -1)).toThrow(EXPECTED_ERROR.message);
});
it('raises error for range > 2^32', () => {
@@ -27,8 +27,12 @@ describe(getRandomInt.name, () => {
'The "min" argument must be a safe integer. Received type number (9007199254740992)',
);
expect(() => randomInt(UNSAFE_INTEGER, UNSAFE_INTEGER + 1)).toThrow(EXPECTED_ERROR_MIN);
expect(() => getRandomInt(UNSAFE_INTEGER, UNSAFE_INTEGER + 1)).toThrow(EXPECTED_ERROR_MIN);
expect(() => randomInt(UNSAFE_INTEGER, UNSAFE_INTEGER + 1)).toThrow(
EXPECTED_ERROR_MIN.message,
);
expect(() => getRandomInt(UNSAFE_INTEGER, UNSAFE_INTEGER + 1)).toThrow(
EXPECTED_ERROR_MIN.message,
);
const EXPECTED_ERROR_MAX = new RangeError(
'The "max" argument must be a safe integer. Received type number (9007199254740992)',
@@ -37,10 +41,10 @@ describe(getRandomInt.name, () => {
'The "max" argument must be a safe integer. Received type number (-9007199254740992)',
);
expect(() => randomInt(0, UNSAFE_INTEGER)).toThrow(EXPECTED_ERROR_MAX);
expect(() => getRandomInt(0, UNSAFE_INTEGER)).toThrow(EXPECTED_ERROR_MAX);
expect(() => randomInt(0, -UNSAFE_INTEGER)).toThrow(EXPECTED_ERROR_MAX_NEGATIVE);
expect(() => getRandomInt(0, -UNSAFE_INTEGER)).toThrow(EXPECTED_ERROR_MAX_NEGATIVE);
expect(() => randomInt(0, UNSAFE_INTEGER)).toThrow(EXPECTED_ERROR_MAX.message);
expect(() => getRandomInt(0, UNSAFE_INTEGER)).toThrow(EXPECTED_ERROR_MAX.message);
expect(() => randomInt(0, -UNSAFE_INTEGER)).toThrow(EXPECTED_ERROR_MAX_NEGATIVE.message);
expect(() => getRandomInt(0, -UNSAFE_INTEGER)).toThrow(EXPECTED_ERROR_MAX_NEGATIVE.message);
});
// This test takes 100+seconds to run. It is very needed for development and debugging,

View File

@@ -90,7 +90,7 @@ describe('address', () => {
// it(`encode fails (${f.exception}`, () => {
// expect(() => {
// baddress.toBech32(Buffer.from(f.data, 'hex'), f.version, f.prefix);
// }).toThrowError(new RegExp(f.exception));
// }).toThrow(new RegExp(f.exception));
// });
// });
});

View File

@@ -1,7 +1,7 @@
import { invariant } from '../invariant';
describe('invariant', () => {
let consoleErrorSpy: jest.SpyInstance;
let consoleErrorSpy: jest.Spied<typeof console.error>;
beforeEach(() => {
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});

View File

@@ -148,11 +148,12 @@
"@types/fast-text-encoding": "^1",
"@types/jest": "^29.5.12",
"@types/node": "22.13.10",
"babel-jest": "29.7.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"babel-plugin-transform-remove-console": "^6.9.4",
"detox": "^20.36.3",
"expo-atlas": "0.4.0",
"jest": "^29.7.0",
"jest": "29.7.0",
"jest-junit": "^16.0.0",
"metro": "0.81.0",
"ts-jest": "^29.1.2",

1276
yarn.lock

File diff suppressed because it is too large Load Diff