diff --git a/.github/workflows/runtime_build_and_test.yml b/.github/workflows/runtime_build_and_test.yml
index c1cc8df2eb7..25282e8400a 100644
--- a/.github/workflows/runtime_build_and_test.yml
+++ b/.github/workflows/runtime_build_and_test.yml
@@ -382,9 +382,6 @@ jobs:
-r=experimental --env=development,
-r=experimental --env=production,
- # Dev Tools
- --project=devtools -r=experimental,
-
# TODO: Update test config to support www build tests
# - "-r=www-classic --env=development --variant=false"
# - "-r=www-classic --env=production --variant=false"
@@ -450,6 +447,50 @@ jobs:
run: ls -R build
- run: yarn test --build ${{ matrix.test_params }} --shard=${{ matrix.shard }} --ci
+ test_build_devtools:
+ name: yarn test-build (devtools)
+ needs: [build_and_lint, runtime_node_modules_cache]
+ strategy:
+ fail-fast: false
+ matrix:
+ shard:
+ - 1/5
+ - 2/5
+ - 3/5
+ - 4/5
+ - 5/5
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.inputs.commit_sha != '' && github.event.inputs.commit_sha || github.event.pull_request.head.sha || github.sha }}
+ - uses: actions/setup-node@v4
+ with:
+ node-version-file: '.nvmrc'
+ cache: yarn
+ cache-dependency-path: yarn.lock
+ - name: Restore cached node_modules
+ uses: actions/cache/restore@v4
+ id: node_modules
+ with:
+ path: |
+ **/node_modules
+ key: runtime-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
+ # Don't use restore-keys here. Otherwise the cache grows indefinitely.
+ - name: Ensure clean build directory
+ run: rm -rf build
+ - run: yarn install --frozen-lockfile
+ if: steps.node_modules.outputs.cache-hit != 'true'
+ - name: Restore archived build
+ uses: actions/download-artifact@v4
+ with:
+ pattern: _build_*
+ path: build
+ merge-multiple: true
+ - name: Display structure of build
+ run: ls -R build
+ - run: yarn test --build --project=devtools -r=experimental --shard=${{ matrix.shard }} --ci
+
process_artifacts_combined:
name: Process artifacts combined
needs: [build_and_lint, runtime_node_modules_cache]
diff --git a/packages/react-devtools-shared/src/__tests__/profilerContext-test.js b/packages/react-devtools-shared/src/__tests__/profilerContext-test.js
index 7864f9703ea..a1e47defa2a 100644
--- a/packages/react-devtools-shared/src/__tests__/profilerContext-test.js
+++ b/packages/react-devtools-shared/src/__tests__/profilerContext-test.js
@@ -654,7 +654,7 @@ describe('ProfilerContext', () => {
expect(store.profilerStore.isProfilingBasedOnUserInput).toBe(false);
document.body.removeChild(profilerContainer);
- });
+ }, 20000);
it('should navigate between commits when the keyboard shortcut is pressed', async () => {
const Parent = () => ;
diff --git a/scripts/jest/config.base.js b/scripts/jest/config.base.js
index ba001e165ee..12b5fc45cd4 100644
--- a/scripts/jest/config.base.js
+++ b/scripts/jest/config.base.js
@@ -2,6 +2,7 @@
module.exports = {
globalSetup: require.resolve('./setupGlobal.js'),
+ testSequencer: require.resolve('./sizeBalancedSequencer.js'),
modulePathIgnorePatterns: [
'/scripts/rollup/shims/',
'/scripts/bench/',
diff --git a/scripts/jest/sizeBalancedSequencer.js b/scripts/jest/sizeBalancedSequencer.js
new file mode 100644
index 00000000000..318cd136be4
--- /dev/null
+++ b/scripts/jest/sizeBalancedSequencer.js
@@ -0,0 +1,28 @@
+'use strict';
+
+const Sequencer = require('@jest/test-sequencer').default;
+const fs = require('fs');
+
+class SizeBalancedSequencer extends Sequencer {
+ shard(tests, {shardIndex, shardCount}) {
+ const shards = Array.from({length: shardCount}, () => ({
+ tests: [],
+ size: 0,
+ }));
+ const sorted = [...tests].sort(
+ (a, b) => fs.statSync(b.path).size - fs.statSync(a.path).size
+ );
+
+ for (let i = 0; i < sorted.length; i++) {
+ const test = sorted[i];
+ const size = fs.statSync(test.path).size;
+ const smallest = shards.reduce((min, s) => (s.size < min.size ? s : min));
+ smallest.tests.push(test);
+ smallest.size += size;
+ }
+
+ return shards[shardIndex - 1].tests;
+ }
+}
+
+module.exports = SizeBalancedSequencer;