Skip to content

Commit a7c103d

Browse files
author
Luca Forstner
committed
Fix tests on node 10
1 parent 6f4b028 commit a7c103d

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

packages/nextjs/jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ module.exports = {
55
// This prevents the build tests from running when unit tests run. (If they do, they fail, because the build being
66
// tested hasn't necessarily run yet.)
77
testPathIgnorePatterns: ['<rootDir>/test/buildProcess/'],
8-
setupFiles: ['<rootDir>/test/setupUnitTests.ts'],
98
};

packages/nextjs/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
"devDependencies": {
3333
"@types/webpack": "^4.41.31",
3434
"eslint-plugin-react": "^7.31.11",
35-
"next": "10.1.3",
36-
"whatwg-fetch": "3.6.2"
35+
"next": "10.1.3"
3736
},
3837
"peerDependencies": {
3938
"next": "^10.0.8 || ^11.0 || ^12.0 || ^13.0",

packages/nextjs/test/edge/edgeWrapperUtils.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ import { withEdgeWrapping } from '../../src/edge/utils/edgeWrapperUtils';
55

66
jest.spyOn(sentryTracing, 'hasTracingEnabled').mockImplementation(() => true);
77

8+
// @ts-ignore Request does not exist on type Global
9+
const origRequest = global.Request;
10+
// @ts-ignore Response does not exist on type Global
11+
const origResponse = global.Response;
12+
13+
// @ts-ignore Request does not exist on type Global
14+
global.Request = class Request {
15+
headers = {
16+
get() {
17+
return null;
18+
},
19+
};
20+
};
21+
22+
// @ts-ignore Response does not exist on type Global
23+
global.Response = class Request {};
24+
25+
afterAll(() => {
26+
// @ts-ignore Request does not exist on type Global
27+
global.Request = origRequest;
28+
// @ts-ignore Response does not exist on type Global
29+
global.Response = origResponse;
30+
});
31+
832
describe('withEdgeWrapping', () => {
933
it('should return a function that calls the passed function', async () => {
1034
const origFunctionReturnValue = new Response();

packages/nextjs/test/setupUnitTests.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25053,7 +25053,7 @@ whatwg-encoding@^2.0.0:
2505325053
dependencies:
2505425054
iconv-lite "0.6.3"
2505525055

25056-
whatwg-fetch@3.6.2, whatwg-fetch@>=0.10.0:
25056+
whatwg-fetch@>=0.10.0:
2505725057
version "3.6.2"
2505825058
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c"
2505925059
integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==

0 commit comments

Comments
 (0)