Skip to content

Commit 4fec434

Browse files
committed
Reorganize test files
1 parent 0826148 commit 4fec434

19 files changed

+27
-100
lines changed

β€Žjest.config.jsβ€Ž

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const path = require('path');
2-
const { TEST_URL, DOCS_URL, LIB_URL } = require('./test/e2e/config/server.js');
2+
const { TEST_URL, DOCS_URL, LIB_URL } = require('./test/config/server.js');
33

44
const sharedConfig = {
55
errorOnDeprecated: true,
@@ -11,31 +11,30 @@ const sharedConfig = {
1111
SRC_PATH: path.resolve(__dirname, 'src'),
1212
TEST_URL,
1313
},
14-
globalSetup: './test/e2e/config/jest.setup.js',
15-
globalTeardown: './test/e2e/config/jest.teardown.js',
14+
globalSetup: './test/config/jest.setup.js',
15+
globalTeardown: './test/config/jest.teardown.js',
1616
resetModules: true,
1717
restoreMocks: true,
1818
};
1919

2020
// Jest-Playwrigth Config
21-
process.env.JEST_PLAYWRIGHT_CONFIG =
22-
'./test/e2e/config/jest-playwright.config.js';
21+
process.env.JEST_PLAYWRIGHT_CONFIG = './test/config/jest-playwright.config.js';
2322

2423
module.exports = {
2524
projects: [
2625
// Unit Tests (Jest)
2726
{
2827
...sharedConfig,
2928
displayName: 'unit',
30-
setupFilesAfterEnv: ['<rootDir>/test/unit/config/jest.setup-tests.js'],
29+
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
3130
testMatch: ['<rootDir>/test/unit/*.test.js'],
3231
testURL: TEST_URL,
3332
},
3433
// Integration Tests (Jest)
3534
{
3635
...sharedConfig,
3736
displayName: 'integration',
38-
setupFilesAfterEnv: ['<rootDir>/test/unit/config/jest.setup-tests.js'],
37+
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
3938
testMatch: ['<rootDir>/test/integration/*.test.js'],
4039
testURL: TEST_URL,
4140
},
@@ -44,7 +43,9 @@ module.exports = {
4443
...sharedConfig,
4544
displayName: 'e2e',
4645
preset: 'jest-playwright-preset',
47-
setupFilesAfterEnv: ['<rootDir>/test/e2e/config/jest.setup-tests.js'],
46+
setupFilesAfterEnv: [
47+
'<rootDir>/test/config/jest-playwright.setup-tests.js',
48+
],
4849
testMatch: ['<rootDir>/test/e2e/*.test.js'],
4950
},
5051
],

β€Žtest/README.mdβ€Ž

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414

1515
### Global Variables
1616

17-
- `TEST_URL`: Test server base URL (http://localhost:3001)
17+
- `TEST_URL`: Test server base URL (http://localhost:3001 => `/test/fixtures/`)
1818
- `DOCS_PATH`: File system path to docsify's `/docs` directory
1919
- `DOCS_URL`: Test server route to docsify's `/docs` directory
2020
- `LIB_PATH`: File system path to docsify's `/lib` directory
2121
- `LIB_URL`: Test server route to docsify's `/lib` directory
22+
- `SRC_PATH`: File system path to docsify's `/src` directory
2223

2324
### CLI commands
2425

@@ -47,10 +48,10 @@ npm run test -- -t \"describe() or test() name\"
4748
npm run test -- -i /path/to/file.test.js -t \"describe() or test() name\"
4849

4950
# Run all example tests
50-
npm run test -- -i /test/**/example.test.js --testPathIgnorePatterns
51+
npm run test -- -i /test/**/example.test.js
5152

5253
# Run specific example test file
53-
npm run test -- -i /path/to/example.test.js --testPathIgnorePatterns
54+
npm run test -- -i /path/to/example.test.js
5455

5556
# ------------------------------------------------------------------------------
5657

@@ -68,7 +69,7 @@ npm run test -- -u -i /path/to/file.test.js -t \"describe() or test() name\"
6869
# Start manual test server instance. Useful for previewing test fixtures.
6970
# Root: /test/e2e/fixtures/
7071
# Routes: /docs, /lib,
71-
node ./test/e2e/config/server.js --start
72+
node ./test/config/server.js --start
7273
```
7374

7475
### Resource

β€Žtest/e2e/config/jest.setup-tests.jsβ€Ž renamed to β€Žtest/config/jest-playwright.setup-tests.jsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global browserName */
12
const { configureToMatchImageSnapshot } = require('jest-image-snapshot');
23

34
// Lifecycle Hooks
File renamed without changes.
File renamed without changes.
File renamed without changes.

β€Žtest/e2e/config/server.jsβ€Ž renamed to β€Žtest/config/server.jsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function startServer(options = {}, cb = Function.prototype) {
2323
server: {
2424
baseDir: path.resolve(__dirname, '../fixtures'),
2525
routes: {
26-
'/docs': path.resolve(__dirname, '../../../docs'),
27-
'/lib': path.resolve(__dirname, '../../../lib'),
26+
'/docs': path.resolve(__dirname, '../../docs'),
27+
'/lib': path.resolve(__dirname, '../../lib'),
2828
'/docs/changelog.md': './CHANGELOG.md',
2929
},
3030
},

β€Žtest/e2e/example.test.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe(`Example Tests`, function() {
105105
test('manual docsify site using playwright methods', async () => {
106106
// Goto URL
107107
// https://playwright.dev/#path=docs%2Fapi.md&q=pagegotourl-options
108-
await page.goto(`${TEST_URL}/html5.html`);
108+
await page.goto(TEST_URL);
109109

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

β€Žtest/e2e/fixtures/docsify-init.htmlβ€Ž

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
Β (0)