diff --git a/__tests__/non-parallel-cases/pjax.commits-page.ts b/__tests__/cases/non-parallel/pjax.commits-page.ts similarity index 96% rename from __tests__/non-parallel-cases/pjax.commits-page.ts rename to __tests__/cases/non-parallel/pjax.commits-page.ts index dde9484..cdd87bc 100644 --- a/__tests__/non-parallel-cases/pjax.commits-page.ts +++ b/__tests__/cases/non-parallel/pjax.commits-page.ts @@ -1,4 +1,4 @@ -import { expectToFind, expectToNotFind, sleep, waitForLegacyPJAXRedirect } from '../utils' +import { expectToFind, expectToNotFind, sleep, waitForLegacyPJAXRedirect } from '../../utils' describe(`in Gitako project page`, () => { beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako/commits/develop')) diff --git a/__tests__/non-parallel-cases/pjax.files-page.ts b/__tests__/cases/non-parallel/pjax.files-page.ts similarity index 96% rename from __tests__/non-parallel-cases/pjax.files-page.ts rename to __tests__/cases/non-parallel/pjax.files-page.ts index 015236e..dddf372 100644 --- a/__tests__/non-parallel-cases/pjax.files-page.ts +++ b/__tests__/cases/non-parallel/pjax.files-page.ts @@ -1,4 +1,4 @@ -import { expectToFind, expectToNotFind, sleep, waitForLegacyPJAXRedirect } from '../utils' +import { expectToFind, expectToNotFind, sleep, waitForLegacyPJAXRedirect } from '../../utils' describe(`in Gitako project page`, () => { beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako/tree/develop/src')) diff --git a/__tests__/non-parallel-cases/pjax.general.ts b/__tests__/cases/non-parallel/pjax.general.ts similarity index 94% rename from __tests__/non-parallel-cases/pjax.general.ts rename to __tests__/cases/non-parallel/pjax.general.ts index d915bc1..76657f4 100644 --- a/__tests__/non-parallel-cases/pjax.general.ts +++ b/__tests__/cases/non-parallel/pjax.general.ts @@ -4,8 +4,8 @@ import { patientClick, selectFileTreeItem, sleep, - waitForLegacyPJAXRedirect, -} from '../utils' + waitForLegacyPJAXRedirect +} from '../../utils' describe(`in Gitako project page`, () => { beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako/tree/develop/src')) diff --git a/__tests__/non-parallel-cases/pjax.internal.ts b/__tests__/cases/non-parallel/pjax.internal.ts similarity index 93% rename from __tests__/non-parallel-cases/pjax.internal.ts rename to __tests__/cases/non-parallel/pjax.internal.ts index b70f5fd..2856405 100644 --- a/__tests__/non-parallel-cases/pjax.internal.ts +++ b/__tests__/cases/non-parallel/pjax.internal.ts @@ -5,8 +5,8 @@ import { patientClick, selectFileTreeItem, sleep, - waitForPJAXAPIRedirect, -} from '../utils' + waitForPJAXAPIRedirect +} from '../../utils' describe(`in Gitako project page`, () => { beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako')) diff --git a/__tests__/non-parallel-cases/project-page.gitako.ts b/__tests__/cases/non-parallel/project-page.gitako.ts similarity index 98% rename from __tests__/non-parallel-cases/project-page.gitako.ts rename to __tests__/cases/non-parallel/project-page.gitako.ts index 22f99f8..6a831a9 100644 --- a/__tests__/non-parallel-cases/project-page.gitako.ts +++ b/__tests__/cases/non-parallel/project-page.gitako.ts @@ -4,7 +4,7 @@ import { expectToNotFind, scroll, selectFileTreeItem -} from '../utils' +} from '../../utils' describe(`in Gitako project page`, () => { beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako')) diff --git a/__tests__/cases/baseline.ts b/__tests__/cases/parallel/baseline.ts similarity index 92% rename from __tests__/cases/baseline.ts rename to __tests__/cases/parallel/baseline.ts index 71368a7..a8e7a74 100644 --- a/__tests__/cases/baseline.ts +++ b/__tests__/cases/parallel/baseline.ts @@ -1,8 +1,8 @@ /** - * Make sure some basic behaviors of puppeteer assertions + * Confirm basic behaviors of puppeteer assertions */ -import { expectToFind, expectToNotFind } from '../utils' +import { expectToFind, expectToNotFind } from '../../utils' describe(`in random page`, () => { beforeAll(() => page.goto('https://google.com')) diff --git a/__tests__/cases/expand-to-target.ts b/__tests__/cases/parallel/expand-to-target.ts similarity index 97% rename from __tests__/cases/expand-to-target.ts rename to __tests__/cases/parallel/expand-to-target.ts index bb55683..4be5dc0 100644 --- a/__tests__/cases/expand-to-target.ts +++ b/__tests__/cases/parallel/expand-to-target.ts @@ -3,7 +3,7 @@ import { selectFileTreeItem, sleep, waitForLegacyPJAXRedirect -} from '../utils' +} from '../../utils' describe(`in Gitako project page`, () => { beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako/tree/develop/src')) diff --git a/__tests__/cases/homepage.not-render.ts b/__tests__/cases/parallel/homepage.not-render.ts similarity index 82% rename from __tests__/cases/homepage.not-render.ts rename to __tests__/cases/parallel/homepage.not-render.ts index 1a326a7..8d67007 100644 --- a/__tests__/cases/homepage.not-render.ts +++ b/__tests__/cases/parallel/homepage.not-render.ts @@ -1,4 +1,4 @@ -import { expectToNotFind } from '../utils' +import { expectToNotFind } from '../../utils' describe(`in GitHub homepage`, () => { beforeAll(() => page.goto('https://github.com')) diff --git a/__tests__/cases/pull-request-page.gitako.ts b/__tests__/cases/parallel/pull-request-page.gitako.ts similarity index 89% rename from __tests__/cases/pull-request-page.gitako.ts rename to __tests__/cases/parallel/pull-request-page.gitako.ts index 00c7c18..a502711 100644 --- a/__tests__/cases/pull-request-page.gitako.ts +++ b/__tests__/cases/parallel/pull-request-page.gitako.ts @@ -1,4 +1,4 @@ -import { expectToFind } from '../utils' +import { expectToFind } from '../../utils' describe(`in Gitako project page`, () => { beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako/pull/71')) diff --git a/__tests__/jest.non-parallel.config.js b/__tests__/jest.non-parallel.config.js new file mode 100644 index 0000000..358ffd7 --- /dev/null +++ b/__tests__/jest.non-parallel.config.js @@ -0,0 +1,7 @@ +const baseConfig = require('../jest.config') + +module.exports = { + ...baseConfig, + maxWorkers: 1, + testMatch: [...baseConfig.testMatch, '**/__tests__/cases/non-parallel/*.ts?(x)'], +} diff --git a/__tests__/jest.parallel.config.js b/__tests__/jest.parallel.config.js new file mode 100644 index 0000000..1bef81e --- /dev/null +++ b/__tests__/jest.parallel.config.js @@ -0,0 +1,6 @@ +const baseConfig = require('../jest.config') + +module.exports = { + ...baseConfig, + testMatch: [...baseConfig.testMatch, '**/__tests__/cases/parallel/*.ts?(x)'], +} diff --git a/jest.config.js b/jest.config.js index f13eb4d..d9cf6da 100644 --- a/jest.config.js +++ b/jest.config.js @@ -141,7 +141,7 @@ module.exports = { // testLocationInResults: false, // The glob patterns Jest uses to detect test files - testMatch: ['**/__tests__/cases/*.ts?(x)', '**/?(*.)+(spec|test).ts?(x)'], + testMatch: ['**/?(*.)+(spec|test).ts?(x)'], // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped testPathIgnorePatterns: ['/node_modules/', '.d.ts$', '/vscode-icons/'], diff --git a/jest.non.parallel.config.js b/jest.non.parallel.config.js deleted file mode 100644 index 74dc653..0000000 --- a/jest.non.parallel.config.js +++ /dev/null @@ -1,7 +0,0 @@ -const baseConfig = require('./jest.config') - -module.exports = { - ...baseConfig, - maxWorkers: 1, - testMatch: ['**/__tests__/non-parallel-cases/*.ts?(x)'], -} diff --git a/package.json b/package.json index 2f7deb3..91574f6 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "build": "VERSION=v$(node scripts/get-version.js) NODE_ENV=production webpack", "roll": "make release", "test": "yarn run test:parallel && yarn run test:non-parallel", - "test:parallel": "NODE_ENV=test jest", - "test:non-parallel": "NODE_ENV=test jest --config jest.non.parallel.config.js" + "test:parallel": "NODE_ENV=test jest --config __tests__/jest.parallel.config.js", + "test:non-parallel": "NODE_ENV=test jest --config __tests__/jest.non-parallel.config.js" }, "dependencies": { "@primer/components": "^22.0.2",