Skip to content
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

chore: update to jest 29 #2048

Merged
merged 2 commits into from
Feb 10, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ module.exports = {
resetMocks: false,
setupFiles: ['./jest.setup.js', 'jest-localstorage-mock'],
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
globals: {
ymqy marked this conversation as resolved.
Show resolved Hide resolved
'ts-jest': {
tsconfig: 'tsconfig.json',
},
transform: {
ymqy marked this conversation as resolved.
Show resolved Hide resolved
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.json' }],
},
collectCoverageFrom: [
'<rootDir>/**/src/**/*.{js,jsx,ts,tsx}',
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@commitlint/config-conventional": "^17.1.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^27.4.1",
"@types/jest": "^29.4.0",
"@types/lodash.debounce": "^4.0.6",
"@types/lodash.isequal": "^4.5.5",
"@types/lodash.throttle": "^4.1.6",
Expand All @@ -60,7 +60,8 @@
"gulp-babel": "^8.0.0",
"gulp-typescript": "^6.0.0-alpha.1",
"husky": "^8.0.0",
"jest": "^27.5.1",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
ymqy marked this conversation as resolved.
Show resolved Hide resolved
"jest-fetch-mock": "^3.0.3",
"jest-localstorage-mock": "^2.4.18",
"mockjs": "^1.1.0",
Expand All @@ -73,7 +74,7 @@
"react-shadow": "^19.0.3",
"rimraf": "^3.0.2",
"surge": "^0.21.3",
"ts-jest": "^27.1.5",
"ts-jest": "^29.0.5",
"typescript": "^4.8.4",
"umi-request": "^1.2.18",
"webpack": "^4.43.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/useCountDown/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const setup = (options: Options = {}) =>

describe('useCountDown', () => {
beforeAll(() => {
jest.useFakeTimers('modern');
jest.useFakeTimers({ legacyFakeTimers: false });
ymqy marked this conversation as resolved.
Show resolved Hide resolved
jest.setSystemTime(1479427200000);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/useRafInterval/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const setUp = ({ fn, delay, options }: ParamsObj) =>
const FRAME_TIME = 16;
describe('useRafInterval', () => {
beforeAll(() => {
jest.useFakeTimers('modern');
jest.useFakeTimers({ legacyFakeTimers: false });
});
afterAll(() => {
jest.restoreAllMocks();
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/useRafTimeout/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const setUp = ({ fn, delay }: ParamsObj) => renderHook(() => useRafTimeout(fn, d
const FRAME_TIME = 16.7;
describe('useRafTimeout', () => {
beforeAll(() => {
jest.useFakeTimers('modern');
jest.useFakeTimers({ legacyFakeTimers: false });
});
afterAll(() => {
jest.restoreAllMocks();
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/useRafTimeout/__tests__/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const setUp = ({ fn, delay }: ParamsObj) => renderHook(() => useRafTimeout(fn, d
const FRAME_TIME = 16.7;
describe('useRafTimeout', () => {
beforeAll(() => {
jest.useFakeTimers('modern');
jest.useFakeTimers({ legacyFakeTimers: false });
});
afterAll(() => {
jest.restoreAllMocks();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`useResponsive should response to window width changes 1`] = `
Object {
{
ymqy marked this conversation as resolved.
Show resolved Hide resolved
"lg": true,
"md": true,
"sm": true,
Expand All @@ -11,7 +11,7 @@ Object {
`;

exports[`useResponsive should response to window width changes 2`] = `
Object {
{
"lg": false,
"md": false,
"sm": false,
Expand All @@ -21,7 +21,7 @@ Object {
`;

exports[`useResponsive should response to window width changes 3`] = `
Object {
{
"lg": false,
"md": false,
"sm": true,
Expand All @@ -31,7 +31,7 @@ Object {
`;

exports[`useResponsive should response to window width changes 4`] = `
Object {
{
"lg": false,
"md": true,
"sm": true,
Expand All @@ -41,7 +41,7 @@ Object {
`;

exports[`useResponsive should response to window width changes 5`] = `
Object {
{
"lg": true,
"md": true,
"sm": true,
Expand All @@ -51,7 +51,7 @@ Object {
`;

exports[`useResponsive should response to window width changes 6`] = `
Object {
{
"lg": true,
"md": true,
"sm": true,
Expand Down