Skip to content

Commit 0ebff52

Browse files
fix(deps): update jest monorepo (major) (#426)
1 parent cdb6d53 commit 0ebff52

File tree

11 files changed

+1241
-4990
lines changed

11 files changed

+1241
-4990
lines changed

package-lock.json

Lines changed: 1211 additions & 4952 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@commitlint/cli": "^13.0.0",
4949
"@commitlint/config-conventional": "^13.0.0",
5050
"@types/chai": "^4.2.12",
51-
"@types/jest": "^26.0.13",
51+
"@types/jest": "^27.0.0",
5252
"@types/jest-diff": "^24.3.0",
5353
"@types/jest-matcher-utils": "^25.1.0",
5454
"@types/mockdate": "^2.0.0",
@@ -61,18 +61,18 @@
6161
"eslint": "^7.13.0",
6262
"eslint-config-prettier": "^6.15.0",
6363
"husky": "^4.0.7",
64-
"jest": "^26.0.0",
64+
"jest": "^27.0.0",
6565
"mockdate": "^3.0.0",
6666
"prettier": "^2.0.0",
67-
"ts-jest": "^26.4.4",
67+
"ts-jest": "^27.0.0",
6868
"ts-node": "^10.0.0",
6969
"typescript": "^4.0.5"
7070
},
7171
"dependencies": {
7272
"aws-sdk": "^2.678.0",
7373
"axios": "^0.21.0",
7474
"filter-obj": "^2.0.1",
75-
"jest-diff": "^26.0.0",
75+
"jest-diff": "^27.0.0",
7676
"uuid": "^8.0.0"
7777
},
7878
"engines": {

src/common/index.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { epochDateMinusHours, sleep, verifyProps } from './';
22

3-
jest.useFakeTimers();
4-
53
describe('common index', () => {
4+
afterEach(() => {
5+
jest.useRealTimers();
6+
});
7+
68
describe('sleep', () => {
79
test('should call setTimeout', async () => {
10+
// TODO: Use modern timers once https://github.com/facebook/jest/issues/11713 is resolved
11+
jest.useFakeTimers('legacy');
812
const promise = sleep(1000);
913
jest.runAllTimers();
1014

src/jest/api.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import { toReturnResponse } from './api';
77
jest.mock('../common');
88
jest.mock('../utils/api');
99
jest.spyOn(console, 'error');
10-
jest.mock('jest-diff', () => ({
11-
__esModule: true,
12-
default: jest.fn(),
13-
}));
10+
jest.mock('jest-diff');
1411

1512
describe('api matchers', () => {
1613
describe('toReturnResponse', () => {
@@ -70,7 +67,7 @@ describe('api matchers', () => {
7067
});
7168

7269
test('should not pass on response not matching', async () => {
73-
const diff = require('jest-diff').default;
70+
const { diff } = require('jest-diff');
7471
const diffString = 'diffString';
7572
diff.mockReturnValue(diffString);
7673

@@ -101,7 +98,7 @@ describe('api matchers', () => {
10198
});
10299

103100
test('should not pass on getItem item not matching empty diffString', async () => {
104-
const diff = require('jest-diff').default;
101+
const { diff } = require('jest-diff');
105102
const diffString = '';
106103
diff.mockReturnValue(diffString);
107104

@@ -131,7 +128,7 @@ describe('api matchers', () => {
131128
});
132129

133130
test('should pass on getItem item matching', async () => {
134-
const diff = require('jest-diff').default;
131+
const { diff } = require('jest-diff');
135132

136133
matcherUtils.equals.mockReturnValue(true);
137134

src/jest/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import diff from 'jest-diff';
1+
import { diff } from 'jest-diff';
22
import { EOL } from 'os';
33
import { verifyProps } from '../common';
44
import { expectedProps, IApiProps, IExpectedResponse } from '../common/api';

src/jest/dynamoDb.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { toHaveItem } from './dynamoDb';
66
jest.mock('../common');
77
jest.mock('../utils/dynamoDb');
88
jest.spyOn(console, 'error');
9-
jest.mock('jest-diff', () => ({
10-
__esModule: true,
11-
default: jest.fn(),
12-
}));
9+
jest.mock('jest-diff');
1310

1411
describe('dynamoDb matchers', () => {
1512
describe('toHaveItem', () => {
@@ -89,7 +86,7 @@ describe('dynamoDb matchers', () => {
8986
});
9087

9188
test('should not pass on getItem item not matching', async () => {
92-
const diff = require('jest-diff').default;
89+
const { diff } = require('jest-diff');
9390
const diffString = 'diffString';
9491
diff.mockReturnValue(diffString);
9592

@@ -121,7 +118,7 @@ describe('dynamoDb matchers', () => {
121118
});
122119

123120
test('should not pass on getItem item not matching empty diffString', async () => {
124-
const diff = require('jest-diff').default;
121+
const { diff } = require('jest-diff');
125122
const diffString = '';
126123
diff.mockReturnValue(diffString);
127124

@@ -154,7 +151,7 @@ describe('dynamoDb matchers', () => {
154151
});
155152

156153
test('should pass on getItem item matching', async () => {
157-
const diff = require('jest-diff').default;
154+
const { diff } = require('jest-diff');
158155

159156
matcherUtils.equals.mockReturnValue(true);
160157

src/jest/dynamoDb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import diff from 'jest-diff';
1+
import { diff } from 'jest-diff';
22
import { EOL } from 'os';
33
import { verifyProps } from '../common';
44
import {

src/jest/s3.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { toHaveObject } from './s3';
66
jest.mock('../common');
77
jest.mock('../utils/s3');
88
jest.spyOn(console, 'error');
9-
jest.mock('jest-diff', () => ({
10-
__esModule: true,
11-
default: jest.fn(),
12-
}));
9+
jest.mock('jest-diff');
1310

1411
describe('s3 matchers', () => {
1512
describe('toHaveObject', () => {
@@ -97,7 +94,7 @@ describe('s3 matchers', () => {
9794
});
9895

9996
test('should not pass on getObject buffer not matching', async () => {
100-
const diff = require('jest-diff').default;
97+
const { diff } = require('jest-diff');
10198
const diffString = 'diffString';
10299
diff.mockReturnValue(diffString);
103100

@@ -131,7 +128,7 @@ describe('s3 matchers', () => {
131128
});
132129

133130
test('should not pass on getObject buffer not matching empty diffString', async () => {
134-
const diff = require('jest-diff').default;
131+
const { diff } = require('jest-diff');
135132
const diffString = '';
136133
diff.mockReturnValue(diffString);
137134

@@ -158,7 +155,7 @@ describe('s3 matchers', () => {
158155
});
159156

160157
test('should pass on getObject buffer matching', async () => {
161-
const diff = require('jest-diff').default;
158+
const { diff } = require('jest-diff');
162159

163160
matcherUtils.equals.mockReturnValue(true);
164161

src/jest/s3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import diff from 'jest-diff';
1+
import { diff } from 'jest-diff';
22
import { EOL } from 'os';
33
import { verifyProps } from '../common';
44
import { expectedProps, IS3Props } from '../common/s3';

src/jest/stepFunctions.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { toBeAtState, toHaveState } from './stepFunctions';
66
jest.mock('../common');
77
jest.mock('../utils/stepFunctions');
88
jest.spyOn(console, 'error');
9-
jest.mock('jest-diff', () => ({
10-
__esModule: true,
11-
default: jest.fn(),
12-
}));
9+
jest.mock('jest-diff');
1310

1411
describe('stepFunctions matchers', () => {
1512
const matcherUtils = {
@@ -63,7 +60,7 @@ describe('stepFunctions matchers', () => {
6360
});
6461

6562
test('should not pass when wrong state', async () => {
66-
const diff = require('jest-diff').default;
63+
const { diff } = require('jest-diff');
6764
const diffString = 'diffString';
6865
diff.mockReturnValue(diffString);
6966

@@ -98,7 +95,7 @@ describe('stepFunctions matchers', () => {
9895
});
9996

10097
test('should not pass when wrong state empty diffString', async () => {
101-
const diff = require('jest-diff').default;
98+
const { diff } = require('jest-diff');
10299
const diffString = '';
103100
diff.mockReturnValue(diffString);
104101

@@ -120,7 +117,7 @@ describe('stepFunctions matchers', () => {
120117
});
121118

122119
test('should pass when correct state', async () => {
123-
const diff = require('jest-diff').default;
120+
const { diff } = require('jest-diff');
124121

125122
matcherUtils.equals.mockReturnValue(true);
126123

0 commit comments

Comments
 (0)