mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-24 02:32:22 +01:00
chore: update jest and related dependency
- jest: 29.5.0 - babel-jest: 29.5.0 - jest-watch-typeahead: 2.2.2 - @types/jest: 29.5.0 removed: - @jest/types - jest-environment-jsdom - jest-environment-node - ts-jest
This commit is contained in:
committed by
Tomáš Klíma
parent
073eb9e400
commit
b8a321c837
10
package.json
10
package.json
@@ -86,7 +86,6 @@
|
||||
"bcrypto": "5.4.0",
|
||||
"react": "18.2.0",
|
||||
"electron": "27.0.4",
|
||||
"@jest/types": "27.5.1",
|
||||
"webpack": "^5.89.0",
|
||||
"css-loader": "^6.8.1",
|
||||
"html-webpack-plugin": "^5.5.3",
|
||||
@@ -106,13 +105,13 @@
|
||||
"@babel/preset-typescript": "^7.23.3",
|
||||
"@babel/runtime": "^7.23.2",
|
||||
"@suite-common/wallet-types": "workspace:*",
|
||||
"@types/jest": "^26.0.24",
|
||||
"@types/jest": "29.5.0",
|
||||
"@types/node": "18.17.15",
|
||||
"@types/prettier": "^3.0.0",
|
||||
"@types/semver": "^7.5.4",
|
||||
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
||||
"@typescript-eslint/parser": "^6.11.0",
|
||||
"babel-jest": "^26.6.3",
|
||||
"babel-jest": "29.5.0",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
@@ -125,9 +124,7 @@
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"jest": "^26.6.3",
|
||||
"jest-environment-jsdom": "^26.6.2",
|
||||
"jest-environment-node": "^26.6.2",
|
||||
"jest": "29.5.0",
|
||||
"jest-expo": "^49.0.0",
|
||||
"metro-react-native-babel-preset": "0.76.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
@@ -137,7 +134,6 @@
|
||||
"prettier-eslint": "^16.1.2",
|
||||
"rimraf": "^5.0.5",
|
||||
"semver": "^7.5.4",
|
||||
"ts-jest": "^26.5.6",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"tsx": "^4.6.2",
|
||||
|
||||
@@ -2,21 +2,10 @@
|
||||
* Integration tests for library build in `./lib` and `./build` directory
|
||||
*/
|
||||
|
||||
const baseConfig = require('../../jest.config.base');
|
||||
|
||||
module.exports = {
|
||||
rootDir: './',
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: 'tsconfig.json',
|
||||
},
|
||||
},
|
||||
...baseConfig,
|
||||
moduleFileExtensions: ['js', 'ts', 'json'],
|
||||
testMatch: ['**/tests/integration/*.ts'],
|
||||
collectCoverage: false,
|
||||
moduleDirectories: ['node_modules', './'], // './' - ia a home directory for the 'trezor-blockchain-link' library (lib/index.js)
|
||||
modulePathIgnorePatterns: ['<rootDir>/libDev'],
|
||||
watchPathIgnorePatterns: ['<rootDir>/libDev'],
|
||||
transform: {
|
||||
'^.+\\.js$': 'babel-jest',
|
||||
'^.+\\.ts$': 'ts-jest',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2,32 +2,20 @@
|
||||
* Unit tests for source with coverage
|
||||
*/
|
||||
|
||||
const { testPathIgnorePatterns, ...baseConfig } = require('../../jest.config.base');
|
||||
|
||||
module.exports = {
|
||||
rootDir: './',
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: 'tsconfig.json',
|
||||
},
|
||||
},
|
||||
moduleFileExtensions: ['js', 'ts', 'json'],
|
||||
...baseConfig,
|
||||
testMatch: ['**/tests/unit/**/*.ts'],
|
||||
coverageDirectory: './coverage/',
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['**/src/**/*.ts'],
|
||||
modulePathIgnorePatterns: [
|
||||
'node_modules',
|
||||
testPathIgnorePatterns: [
|
||||
...testPathIgnorePatterns,
|
||||
'src/types',
|
||||
'src/ui',
|
||||
'src/utils/ws.ts',
|
||||
'fixtures',
|
||||
'unit/worker/index.ts',
|
||||
'<rootDir>/lib',
|
||||
'<rootDir>/libDev',
|
||||
],
|
||||
setupFiles: ['./tests/setup.js'],
|
||||
transform: {
|
||||
'^.+\\.js$': 'babel-jest',
|
||||
'^.+\\.ts$': 'ts-jest',
|
||||
},
|
||||
watchPathIgnorePatterns: ['<rootDir>/libDev'],
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
"@trezor/type-utils": "workspace:*",
|
||||
"fs-extra": "^11.1.1",
|
||||
"html-webpack-plugin": "^5.5.3",
|
||||
"jest": "^26.6.3",
|
||||
"jest": "29.5.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"tiny-worker": "^2.3.0",
|
||||
"tsx": "^4.6.2",
|
||||
|
||||
@@ -25,7 +25,6 @@ workers.forEach(instance => {
|
||||
let blockchain: BlockchainLink;
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.setTimeout(20000);
|
||||
server = await BackendWebsocketServerMock.create(instance.name);
|
||||
blockchain = new BlockchainLink({
|
||||
...instance,
|
||||
@@ -49,7 +48,7 @@ workers.forEach(instance => {
|
||||
expect(error.code).toEqual('blockchain_link/connect');
|
||||
expect(error.message).toEqual('All backends are down');
|
||||
}
|
||||
});
|
||||
}, 9000);
|
||||
|
||||
it('Handle message timeout', async () => {
|
||||
server.setFixtures([
|
||||
@@ -80,7 +79,7 @@ workers.forEach(instance => {
|
||||
await blockchain.subscribe({ type: 'block' });
|
||||
await new Promise(resolve => setTimeout(resolve, 6000));
|
||||
expect(server.fixtures).toEqual([]);
|
||||
});
|
||||
}, 7000);
|
||||
|
||||
it('Handle ping (keepAlive)', async () => {
|
||||
const method = getMethod(instance.name);
|
||||
@@ -97,7 +96,7 @@ workers.forEach(instance => {
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 6000));
|
||||
expect(server.fixtures).toEqual([]);
|
||||
});
|
||||
}, 7000);
|
||||
|
||||
it('Ping should not be called and websocket should be disconnected', async () => {
|
||||
const method = getMethod(instance.name);
|
||||
@@ -122,24 +121,26 @@ workers.forEach(instance => {
|
||||
expect(server.getFixtures()!.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('Handle connect event', async done => {
|
||||
it('Handle connect event', done => {
|
||||
blockchain.on('connected', done);
|
||||
const result = await blockchain.connect();
|
||||
expect(result).toEqual(true);
|
||||
blockchain.connect().then(result => {
|
||||
expect(result).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('Handle disconnect event', async done => {
|
||||
it('Handle disconnect event', done => {
|
||||
blockchain.on('disconnected', done);
|
||||
await blockchain.connect();
|
||||
// TODO: ripple-lib throws error when disconnect is called immediately
|
||||
// investigate more, use setTimeout as a workaround
|
||||
// Error [ERR_UNHANDLED_ERROR]: Unhandled error. (websocket)
|
||||
// at Connection.RippleAPI.connection.on (../../node_modules/ripple-lib/src/api.ts:133:14)
|
||||
if (instance.name === 'ripple') {
|
||||
setTimeout(() => blockchain.disconnect(), 1000);
|
||||
} else {
|
||||
blockchain.disconnect();
|
||||
}
|
||||
blockchain.connect().then(() => {
|
||||
// TODO: ripple-lib throws error when disconnect is called immediately
|
||||
// investigate more, use setTimeout as a workaround
|
||||
// Error [ERR_UNHANDLED_ERROR]: Unhandled error. (websocket)
|
||||
// at Connection.RippleAPI.connection.on (../../node_modules/ripple-lib/src/api.ts:133:14)
|
||||
if (instance.name === 'ripple') {
|
||||
setTimeout(() => blockchain.disconnect(), 1000);
|
||||
} else {
|
||||
blockchain.disconnect();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Connect (only one endpoint is valid)', async () => {
|
||||
|
||||
@@ -10,9 +10,7 @@ import {
|
||||
} from '../fixtures/round.fixture';
|
||||
|
||||
// using fakeTimers and async callbacks
|
||||
const fastForward = (time: number) =>
|
||||
// @ts-expect-error needs @types/jest update, related to https://github.com/trezor/trezor-suite/issues/6025
|
||||
jest.advanceTimersByTimeAsync(time);
|
||||
const fastForward = (time: number) => jest.advanceTimersByTimeAsync(time);
|
||||
|
||||
// use getters to allow mocking different values in each test case
|
||||
jest.mock('../../src/constants', () => {
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "5.3.2"
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"es6-promise": "^4.2.8",
|
||||
"html-webpack-plugin": "^5.5.3",
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"terser-webpack-plugin": "^5.3.9",
|
||||
"typescript": "5.3.2",
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
"@types/w3c-web-usb": "^1.0.9",
|
||||
"html-webpack-plugin": "^5.5.3",
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"selfsigned": "^2.4.1",
|
||||
"terser-webpack-plugin": "^5.3.9",
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
"@trezor/node-utils": "workspace:*",
|
||||
"@trezor/trezor-user-env-link": "workspace:*",
|
||||
"@types/chrome": "latest",
|
||||
"jest": "^26.6.3",
|
||||
"jest": "29.5.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"terser-webpack-plugin": "^5.3.9",
|
||||
"tsx": "^4.6.2",
|
||||
|
||||
@@ -74,7 +74,6 @@
|
||||
"@types/parse-uri": "^1.0.2",
|
||||
"ethereum-cryptography": "^2.0.0",
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"karma": "^6.4.2",
|
||||
"karma-babel-preprocessor": "^8.0.2",
|
||||
"karma-chrome-launcher": "^3.2.0",
|
||||
|
||||
8
packages/ipc-proxy/jest.config.js
Normal file
8
packages/ipc-proxy/jest.config.js
Normal file
@@ -0,0 +1,8 @@
|
||||
const { testPathIgnorePatterns, ...baseConfig } = require('../../jest.config.base');
|
||||
|
||||
module.exports = {
|
||||
...baseConfig,
|
||||
testEnvironment: 'jsdom',
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.ts'],
|
||||
};
|
||||
@@ -17,7 +17,7 @@
|
||||
"browser": "src/proxy",
|
||||
"scripts": {
|
||||
"lint": "eslint '**/*.{ts,tsx,js}'",
|
||||
"test:unit": "jest -c ../../jest.config.base.js",
|
||||
"test:unit": "jest -c ./jest.config.js",
|
||||
"type-check": "tsc --build"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"typescript": "5.3.2"
|
||||
}
|
||||
|
||||
@@ -135,8 +135,7 @@
|
||||
"@types/zxcvbn": "^4.4.3",
|
||||
"jest": "29.5.0",
|
||||
"jest-canvas-mock": "^2.5.2",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"jest-watch-typeahead": "0.6.5",
|
||||
"jest-watch-typeahead": "2.2.2",
|
||||
"prettier": "3.0.3",
|
||||
"react-test-renderer": "^18.2.0",
|
||||
"redux-devtools-extension": "^2.13.9",
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
"@types/sharedworker": "^0.0.105",
|
||||
"@types/w3c-web-usb": "^1.0.9",
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsx": "^4.6.2",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createCooldown } from '../src/createCooldown';
|
||||
|
||||
it('createCooldown', () => {
|
||||
jest.useFakeTimers('modern');
|
||||
jest.useFakeTimers();
|
||||
|
||||
const cooldown = createCooldown(20);
|
||||
expect(cooldown()).toBe(true);
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
const baseConfig = require('../../jest.config.base');
|
||||
|
||||
module.exports = {
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: 'tsconfig.json',
|
||||
},
|
||||
},
|
||||
...baseConfig,
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
coverageDirectory: './coverage/',
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['**/src/**/*.ts'],
|
||||
modulePathIgnorePatterns: ['node_modules', '<rootDir>/lib', '<rootDir>/libDev'],
|
||||
watchPathIgnorePatterns: ['<rootDir>/libDev', '<rootDir>/lib'],
|
||||
testPathIgnorePatterns: ['<rootDir>/libDev/', '<rootDir>/lib/'],
|
||||
setupFiles: ['./tests/jest.setup.js'],
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest',
|
||||
},
|
||||
collectCoverageFrom: ['src/**/*.ts'],
|
||||
};
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
"@types/create-hash": "^1.2.4",
|
||||
"@types/create-hmac": "^1.1.2",
|
||||
"@types/wif": "^2.0.4",
|
||||
"jest": "^26.6.3",
|
||||
"jest": "29.5.0",
|
||||
"minimaldata": "^1.0.2",
|
||||
"rimraf": "^5.0.5",
|
||||
"tsx": "^4.6.2",
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
"@suite-common/test-utils": "workspace:*",
|
||||
"@types/fs-extra": "^11.0.3",
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "5.3.2"
|
||||
},
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
"react-redux": "8.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0"
|
||||
"jest": "29.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
"@babel/plugin-proposal-decorators": "^7.23.5",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
||||
"@babel/plugin-transform-class-static-block": "^7.23.4",
|
||||
"babel-jest": "^26.6.3",
|
||||
"babel-jest": "29.5.0",
|
||||
"jest": "29.5.0",
|
||||
"metro-react-native-babel-preset": "0.73.9",
|
||||
"react-test-renderer": "18.2.0",
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
"test:unit": "jest -c ../../jest.config.base.js --passWithNoTests"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "^26.6.3"
|
||||
"jest": "29.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
"react-native": "0.71.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0"
|
||||
"jest": "29.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0",
|
||||
"typescript": "5.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user