Skip to content

Commit

Permalink
ci: use shard sequencer to ignore e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin committed Oct 27, 2023
1 parent 053159e commit f89e452
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
run: |
node -v
npm -v
yarn test --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }}
yarn test --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }} --testSequencer=../../../shardSequencer.cjs
env:
SANITY_CI_CLI_AUTH_TOKEN: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }}
GITHUB_SHARD_IDENTIFIER: ${{ matrix.shardIndex }}-${{ matrix.shardTotal }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.0",
"@bjoerge/mutiny": "^0.0.2",
"@jest/test-sequencer": "^29.7.0",
"@optimize-lodash/rollup-plugin": "^4.0.4",
"@playwright/test": "^1.38.1",
"@sanity/client": "^6.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/portable-text-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"prettier": "prettier --write './**/*.{ts,tsx,js,css,html}'",
"dev": "cd ./test/ && ts-node serve",
"test": "jest",
"test:e2e": "cd e2e-tests && jest",
"test:e2e": "cd e2e-tests && jest --config=e2e-tests/e2e.config.cjs",
"test:watch": "jest --watch",
"watch": "pkg-utils watch --tsconfig tsconfig.lib.json"
},
Expand Down
9 changes: 9 additions & 0 deletions shardSequencer.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict'

const Sequencer = require('@jest/test-sequencer').default

module.exports = class JestShardSequencer extends Sequencer {
shard(tests) {
return tests.filter((test) => !test.path.includes('e2e'))
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15999,6 +15999,11 @@ yargs@^17.3.0, yargs@^17.3.1:
y18n "^5.0.5"
yargs-parser "^21.1.1"

yarn@^1.22.19:
version "1.22.19"
resolved "https://registry.npmjs.org/yarn/-/yarn-1.22.19.tgz#4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
integrity sha512-/0V5q0WbslqnwP91tirOvldvYISzaqhClxzyUKXYxs07yUILIs5jx/k6CFe8bvKSkds5w+eiOqta39Wk3WxdcQ==

yauzl@^2.4.2:
version "2.10.0"
resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"
Expand Down

0 comments on commit f89e452

Please sign in to comment.