Skip to content

Commit 51451a4

Browse files
committed
Remove BLANK_URL global
1 parent 69efae3 commit 51451a4

File tree

6 files changed

+8
-16
lines changed

6 files changed

+8
-16
lines changed

jest.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const { globals: serverGlobals } = require('./test/config/server.js');
1+
const { TEST_HOST } = require('./test/config/server.js');
22

33
const sharedConfig = {
44
errorOnDeprecated: true,
55
globals: {
6-
...serverGlobals, // BLANK_URL, TEST_HOST
6+
TEST_HOST,
77
},
88
globalSetup: './test/config/jest.setup.js',
99
globalTeardown: './test/config/jest.teardown.js',
@@ -23,15 +23,15 @@ module.exports = {
2323
displayName: 'unit',
2424
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
2525
testMatch: ['<rootDir>/test/unit/*.test.js'],
26-
testURL: serverGlobals.BLANK_URL,
26+
testURL: `${TEST_HOST}/_blank.html`,
2727
},
2828
// Integration Tests (Jest)
2929
{
3030
...sharedConfig,
3131
displayName: 'integration',
3232
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
3333
testMatch: ['<rootDir>/test/integration/*.test.js'],
34-
testURL: serverGlobals.BLANK_URL,
34+
testURL: `${TEST_HOST}/_blank.html`,
3535
},
3636
// E2E Tests (Jest + Playwright)
3737
{

test/.eslintrc.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ module.exports = {
55
'jest/globals': true,
66
},
77
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
8-
globals: {
9-
...jestConfig.globals,
10-
},
8+
globals: jestConfig.globals,
119
plugins: ['jest'],
1210
};

test/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
## Global Variables
1616

17-
- `BLANK_URL`: Test server route to virtual `_blank.html` file
1817
- `TEST_HOST`: Test server ip:port
1918

2019
## CLI commands

test/config/jest-playwright.setup-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ beforeEach(async () => {
5050
// will cause operations that require the window location to be a valid URL
5151
// to fail (e.g. AJAX requests). To avoid these issues, this hook ensures
5252
// that each tests begins by a blank HTML page.
53-
await page.goto(BLANK_URL);
53+
await page.goto(`${TEST_HOST}/_blank.html`);
5454
});

test/config/server.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,8 @@ else if (require.main === module) {
104104
}
105105

106106
module.exports = {
107-
globals: {
108-
get BLANK_URL() {
109-
return `${this.TEST_HOST}/_blank.html`;
110-
},
111-
TEST_HOST: `http://${serverConfig.host}:${serverConfig.port}`,
112-
},
113107
start: startServer,
114108
startAsync: startServerAsync,
115109
stop: stopServer,
110+
TEST_HOST: `http://${serverConfig.host}:${serverConfig.port}`,
116111
};

test/e2e/example.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe(`Example Tests`, function() {
9292
test('manual docsify site using playwright methods', async () => {
9393
// Goto URL
9494
// https://playwright.dev/#path=docs%2Fapi.md&q=pagegotourl-options
95-
await page.goto(BLANK_URL);
95+
await page.goto(`${TEST_HOST}/_blank.html`);
9696

9797
// Set docsify configuration
9898
// https://playwright.dev/#path=docs%2Fapi.md&q=pageevaluatepagefunction-arg

0 commit comments

Comments
 (0)