Remove BLANK_URL global

This commit is contained in:
John Hildenbiddle 2020-11-11 16:57:22 -06:00
parent 69efae3c4f
commit 51451a40f7
6 changed files with 8 additions and 16 deletions

View File

@ -1,9 +1,9 @@
const { globals: serverGlobals } = require('./test/config/server.js');
const { TEST_HOST } = require('./test/config/server.js');
const sharedConfig = {
errorOnDeprecated: true,
globals: {
...serverGlobals, // BLANK_URL, TEST_HOST
TEST_HOST,
},
globalSetup: './test/config/jest.setup.js',
globalTeardown: './test/config/jest.teardown.js',
@ -23,7 +23,7 @@ module.exports = {
displayName: 'unit',
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
testMatch: ['<rootDir>/test/unit/*.test.js'],
testURL: serverGlobals.BLANK_URL,
testURL: `${TEST_HOST}/_blank.html`,
},
// Integration Tests (Jest)
{
@ -31,7 +31,7 @@ module.exports = {
displayName: 'integration',
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
testMatch: ['<rootDir>/test/integration/*.test.js'],
testURL: serverGlobals.BLANK_URL,
testURL: `${TEST_HOST}/_blank.html`,
},
// E2E Tests (Jest + Playwright)
{

View File

@ -5,8 +5,6 @@ module.exports = {
'jest/globals': true,
},
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
globals: {
...jestConfig.globals,
},
globals: jestConfig.globals,
plugins: ['jest'],
};

View File

@ -14,7 +14,6 @@
## Global Variables
- `BLANK_URL`: Test server route to virtual `_blank.html` file
- `TEST_HOST`: Test server ip:port
## CLI commands

View File

@ -50,5 +50,5 @@ beforeEach(async () => {
// will cause operations that require the window location to be a valid URL
// to fail (e.g. AJAX requests). To avoid these issues, this hook ensures
// that each tests begins by a blank HTML page.
await page.goto(BLANK_URL);
await page.goto(`${TEST_HOST}/_blank.html`);
});

View File

@ -104,13 +104,8 @@ else if (require.main === module) {
}
module.exports = {
globals: {
get BLANK_URL() {
return `${this.TEST_HOST}/_blank.html`;
},
TEST_HOST: `http://${serverConfig.host}:${serverConfig.port}`,
},
start: startServer,
startAsync: startServerAsync,
stop: stopServer,
TEST_HOST: `http://${serverConfig.host}:${serverConfig.port}`,
};

View File

@ -92,7 +92,7 @@ describe(`Example Tests`, function() {
test('manual docsify site using playwright methods', async () => {
// Goto URL
// https://playwright.dev/#path=docs%2Fapi.md&q=pagegotourl-options
await page.goto(BLANK_URL);
await page.goto(`${TEST_HOST}/_blank.html`);
// Set docsify configuration
// https://playwright.dev/#path=docs%2Fapi.md&q=pageevaluatepagefunction-arg