test: divide cases according to parallelizibility

This commit is contained in:
EnixCoda 2021-05-31 17:31:55 +08:00
parent 863260a454
commit 345c5cec99
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
8 changed files with 11 additions and 4 deletions

View file

@ -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/"]`,

View file

@ -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: [

View file

@ -0,0 +1,7 @@
const baseConfig = require('./jest.config')
module.exports = {
...baseConfig,
maxWorkers: 1,
testMatch: ['**/__tests__/non-parallel-cases/*.ts?(x)'],
}

View file

@ -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",