Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ jobs:
pnpm run test

job_node_unit_tests:
name: Node (${{ matrix.node }}) Unit Tests
name: Node (${{ matrix.node }}) Unit Tests (${{ matrix.shard }}/2)
needs: [job_get_metadata, job_build]
timeout-minutes: 10
runs-on: ubuntu-24.04-arm
Expand All @@ -550,6 +550,7 @@ jobs:
fail-fast: false
matrix:
node: [20.19, 22, 24, 26, '^27.0.0-0']
shard: [1, 2]
steps:
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
uses: actions/checkout@v7
Expand Down Expand Up @@ -579,12 +580,14 @@ jobs:
if: github.event_name == 'pull_request'
env:
NODE_VERSION: ${{ matrix.node }}
UNIT_TEST_SHARD: ${{ matrix.shard }}

- name: Run all tests
run: pnpm run test:ci:node
if: github.event_name != 'pull_request'
env:
NODE_VERSION: ${{ matrix.node }}
UNIT_TEST_SHARD: ${{ matrix.shard }}

job_browser_playwright_tests:
name:
Expand Down
16 changes: 16 additions & 0 deletions scripts/ci-unit-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as path from 'path';

const UNIT_TEST_ENV = process.env.UNIT_TEST_ENV as 'node' | 'browser' | undefined;
const RUN_AFFECTED = process.argv.includes('--affected');
const UNIT_TEST_SHARD = process.env.UNIT_TEST_SHARD;

// These packages are tested separately in CI, so no need to run them here
const DEFAULT_SKIP_PACKAGES = ['@sentry/bun', '@sentry/deno'];
Expand Down Expand Up @@ -58,6 +59,21 @@ function runTests(): void {
BROWSER_TEST_PACKAGES.forEach(pkg => ignores.add(pkg));
}

if (UNIT_TEST_SHARD) {
if (UNIT_TEST_SHARD !== '1' && UNIT_TEST_SHARD !== '2') {
throw new Error(`Invalid unit-test shard: ${UNIT_TEST_SHARD}`);
}

packages
.filter(pkg => !ignores.has(pkg))
.sort()
.forEach((pkg, index) => {
if (index % 2 !== Number(UNIT_TEST_SHARD) - 1) {
ignores.add(pkg);
}
});
}
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved

if (RUN_AFFECTED) {
runAffectedTests(ignores);
} else {
Expand Down
Loading