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
8 changes: 5 additions & 3 deletions .github/workflows/runtime_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,11 @@ jobs:
fail-fast: false
matrix:
shard:
- 1/3
- 2/3
- 3/3
- 1/5
- 2/5
- 3/5
- 4/5
- 5/5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => <Child />;
Expand Down
1 change: 1 addition & 0 deletions scripts/jest/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module.exports = {
globalSetup: require.resolve('./setupGlobal.js'),
testSequencer: require.resolve('./sizeBalancedSequencer.js'),
modulePathIgnorePatterns: [
'<rootDir>/scripts/rollup/shims/',
'<rootDir>/scripts/bench/',
Expand Down
28 changes: 28 additions & 0 deletions scripts/jest/sizeBalancedSequencer.js
Original file line number Diff line number Diff line change
@@ -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;
Loading