diff --git a/__tests__/cases/pjax.commits-page.ts b/__tests__/non-parallel-cases/pjax.commits-page.ts similarity index 90% rename from __tests__/cases/pjax.commits-page.ts rename to __tests__/non-parallel-cases/pjax.commits-page.ts index e1d219d..dde9484 100644 --- a/__tests__/cases/pjax.commits-page.ts +++ b/__tests__/non-parallel-cases/pjax.commits-page.ts @@ -4,8 +4,6 @@ describe(`in Gitako project page`, () => { beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako/commits/develop')) it('should not break go back in history', async () => { - // temporarily skip this test as GitHub has unexpected PJAX behaviors - return for (let i = 0; i < 3; i++) { const commitLinks = await page.$$( `#js-repo-pjax-container .TimelineItem-body ol li > div:nth-child(1) a[href*="/commit/"]`, diff --git a/__tests__/cases/pjax.files-page.ts b/__tests__/non-parallel-cases/pjax.files-page.ts similarity index 100% rename from __tests__/cases/pjax.files-page.ts rename to __tests__/non-parallel-cases/pjax.files-page.ts diff --git a/__tests__/cases/pjax.general.ts b/__tests__/non-parallel-cases/pjax.general.ts similarity index 100% rename from __tests__/cases/pjax.general.ts rename to __tests__/non-parallel-cases/pjax.general.ts diff --git a/__tests__/cases/pjax.internal.ts b/__tests__/non-parallel-cases/pjax.internal.ts similarity index 100% rename from __tests__/cases/pjax.internal.ts rename to __tests__/non-parallel-cases/pjax.internal.ts diff --git a/__tests__/cases/project-page.gitako.ts b/__tests__/non-parallel-cases/project-page.gitako.ts similarity index 100% rename from __tests__/cases/project-page.gitako.ts rename to __tests__/non-parallel-cases/project-page.gitako.ts diff --git a/jest.config.js b/jest.config.js index eafe22d..f13eb4d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -61,7 +61,7 @@ module.exports = { // globals: {}, // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. - maxWorkers: 1, // more than 1 workers may make tabs in background and never renders Gitako's file items. + maxWorkers: 8, // An array of directory names to be searched recursively up from the requiring module's location // moduleDirectories: [ diff --git a/jest.non.parallel.config.js b/jest.non.parallel.config.js new file mode 100644 index 0000000..74dc653 --- /dev/null +++ b/jest.non.parallel.config.js @@ -0,0 +1,7 @@ +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 96c9c49..4d02fbc 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,9 @@ "postinstall": "rm -rf node_modules/@types/react-native && node scripts/fix-pjax-api", "build": "VERSION=v$(node scripts/get-version.js) NODE_ENV=production webpack", "roll": "make release", - "test": "NODE_ENV=test jest" + "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" }, "dependencies": { "@primer/components": "^22.0.2",