Skip to content

Commit f4e549d

Browse files
committed
Merge branch 'main' into 2025-10-30_more_ubuntu
2 parents 2714913 + ead5ab1 commit f4e549d

6 files changed

Lines changed: 248 additions & 95 deletions

File tree

.github/workflows/test.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,24 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13-
test-macos:
14-
name: Test macOS
13+
browser:
14+
name: Test Browser
1515
runs-on: macos-latest
1616
env:
1717
GITHUB_ACTIONS_OUTPUT: ""
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
browser: [safari]
21+
browser: [chrome, firefox, safari]
22+
suite: [default, disabled, main]
2223
steps:
2324
- name: Extract Week Number
2425
run: echo "WEEK_NUMBER=$(date +%W)" >> $GITHUB_ENV
2526

27+
- name: Install Firefox
28+
if: ${{ matrix.browser == 'firefox' }}
29+
run: brew install --cask firefox
30+
2631
- name: Checkout Branch
2732
uses: actions/checkout@v5
2833

@@ -35,26 +40,20 @@ jobs:
3540
- name: Install Node Packages
3641
run: npm ci
3742

38-
- name: Cache jsvu Binaries
39-
uses: actions/cache@v4
40-
with:
41-
path: ~/.jsvu
42-
key: ${{ runner.os }}-jsvu-${{ matrix.browser }}-week-${{ env.WEEK_NUMBER }}
43-
4443
- name: Run Tests
4544
run: |
4645
echo "Running in $BROWSER"
47-
npm run test:${{ matrix.browser }}
48-
49-
test-linux:
50-
name: Test Linux
46+
npm run test:${{ matrix.browser }} -- ${{ matrix.suite }}
47+
shell:
48+
name: Test Shell
5149
runs-on: ubuntu-latest
5250
env:
5351
GITHUB_ACTIONS_OUTPUT: ""
5452
strategy:
5553
fail-fast: false
5654
matrix:
57-
browser: [chrome, firefox, jsc, spidermonkey, v8]
55+
shell: [jsc, spidermonkey, v8]
56+
suite: [default, disabled, main]
5857
steps:
5958
- name: Extract Week Number
6059
run: echo "WEEK_NUMBER=$(date +%W)" >> $GITHUB_ENV
@@ -71,19 +70,18 @@ jobs:
7170
- name: Install Node Packages
7271
run: npm ci
7372

74-
- name: Cache jsvu Binaries
73+
- name: Cache jsvu Binaries
7574
uses: actions/cache@v4
7675
with:
7776
path: ~/.jsvu
78-
key: ${{ runner.os }}-jsvu-${{ matrix.browser }}-week-${{ env.WEEK_NUMBER }}
77+
key: ${{ runner.os }}-jsvu-${{ matrix.shell }}-week-${{ env.WEEK_NUMBER }}
7978

8079
- name: Run Tests
8180
run: |
8281
echo "Running in $BROWSER"
83-
npm run test:${{ matrix.browser }}
84-
82+
npm run test:${{ matrix.shell }} -- ${{ matrix.suite }}
8583
build:
86-
name: Build
84+
name: Test Build
8785
runs-on: ubuntu-latest
8886
steps:
8987
- name: Checkout Branch

JetStreamDriver.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,21 @@ let BENCHMARKS = [
22562256
],
22572257
tags: ["default", "js", "Proxy"],
22582258
}),
2259+
new AsyncBenchmark({
2260+
name: "mobx-startup",
2261+
files: [
2262+
"./utils/StartupBenchmark.js",
2263+
"./mobx/benchmark.js",
2264+
],
2265+
preload: {
2266+
// Debug Sources for nicer profiling.
2267+
// BUNDLE: "./mobx/dist/bundle.es6.js",
2268+
BUNDLE: "./mobx/dist/bundle.es6.min.js",
2269+
},
2270+
tags: ["default", "js", "mobx", "startup", "es6"],
2271+
iterations: 30,
2272+
worstCaseCount: 3,
2273+
}),
22592274
new AsyncBenchmark({
22602275
name: "jsdom-d3-startup",
22612276
files: [

mobx/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const EXPECTED_LOG_LENGTH = 6824;
2828
class Benchmark extends StartupBenchmark {
2929
lastResult;
3030

31-
constructor(iterationCount) {
31+
constructor({iterationCount}) {
3232
super({
3333
iterationCount,
3434
expectedCacheCommentCount: 464,

tests/helper.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export async function logGroup(name, body) {
8181
}
8282

8383

84-
export function printHelp(message = "", optionDefinitions) {
84+
export function printHelp(message, optionDefinitions) {
8585
const usage = commandLineUsage([
8686
{
8787
header: "Run all tests",
@@ -91,13 +91,13 @@ export function printHelp(message = "", optionDefinitions) {
9191
optionList: optionDefinitions,
9292
},
9393
]);
94-
if (!message) {
94+
if (!message?.length) {
9595
console.log(usage);
9696
process.exit(0);
9797
} else {
9898
console.error(message);
99-
console.error();
100-
console.error(usage);
99+
console.log();
100+
console.log(usage);
101101
process.exit(1);
102102
}
103103
}

tests/run-browser.mjs

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,45 @@ import os from "os";
3333

3434
import {logInfo, logError, printHelp, runTest} from "./helper.mjs";
3535

36+
const TESTS = [
37+
{
38+
name: "Run Single Suite",
39+
tags: ["all", "main"],
40+
run() {
41+
return runEnd2EndTest("Run Single Suite", { test: "proxy-mobx" });
42+
}
43+
},
44+
{
45+
name: "Run Multiple Suites",
46+
tags: ["all", "main"],
47+
run() {
48+
return runEnd2EndTest("Run Multiple Suites", { test: "prismjs-startup-es6,postcss-wtb" });
49+
}
50+
},
51+
{
52+
name: "Run Tag No Prefetch",
53+
tags: ["all", "main"],
54+
run() {
55+
return runEnd2EndTest("Run Tag No Prefetch", { tag: "proxy", prefetchResources: "false" });
56+
}
57+
},
58+
{
59+
name: "Run Disabled Suite",
60+
tags: ["all", "disabled"],
61+
run() {
62+
return runEnd2EndTest("Run Disabled Suite", { tag: "disabled" });
63+
}
64+
},
65+
{
66+
name: "Run Default Suite",
67+
tags: ["all", "default"],
68+
run() {
69+
return runEnd2EndTest("Run Default Suite");
70+
}
71+
}
72+
];
73+
74+
const VALID_TAGS = Array.from(new Set(TESTS.map((each) => each.tags).flat()));
3675

3776
function sleep(ms) {
3877
return new Promise(resolve => setTimeout(resolve, ms));
@@ -42,12 +81,16 @@ const optionDefinitions = [
4281
{ name: "browser", type: String, description: "Set the browser to test, choices are [safari, firefox, chrome, edge]. By default the $BROWSER env variable is used." },
4382
{ name: "port", type: Number, defaultValue: 8010, description: "Set the test-server port, The default value is 8010." },
4483
{ name: "help", alias: "h", description: "Print this help text." },
84+
{ name: "suite", type: String, defaultOption: true, typeLabel: `{underline choices}: ${VALID_TAGS.join(", ")}`, description: "Run a specific suite by name." }
4585
];
4686

4787
const options = commandLineArgs(optionDefinitions);
4888

4989
if ("help" in options)
50-
printHelp(optionDefinitions);
90+
printHelp("". optionDefinitions);
91+
92+
if (options.suite && !VALID_TAGS.includes(options.suite))
93+
printHelp(`Invalid suite: ${options.suite}. Choices are: ${VALID_TAGS.join(", ")}`);
5194

5295
const BROWSER = options?.browser;
5396
if (!BROWSER)
@@ -73,7 +116,7 @@ switch (BROWSER) {
73116
break;
74117
}
75118
default: {
76-
printHelp(`Invalid browser "${BROWSER}", choices are: "safari", "firefox", "chrome", "edge"`);
119+
printHelp(`Invalid browser "${BROWSER}", choices are: "safari", "firefox", "chrome", "edge"`, optionDefinitions);
77120
}
78121
}
79122

@@ -91,12 +134,19 @@ const server = await serve(PORT);
91134

92135
async function runTests() {
93136
let success = true;
137+
const suiteFilter = options.suite || "all";
138+
139+
const testsToRun = TESTS.filter(test => test.tags.includes(suiteFilter));
140+
141+
if (testsToRun.length === 0) {
142+
console.error(`No suite found for filter: ${suiteFilter}`);
143+
process.exit(1);
144+
}
145+
94146
try {
95-
success &&= await runEnd2EndTest("Run Single Suite", { test: "proxy-mobx" });
96-
success &&= await runEnd2EndTest("Run Multiple Suites", { test: "prismjs-startup-es6,postcss-wtb" });
97-
success &&= await runEnd2EndTest("Run Tag No Prefetch", { tag: "proxy", prefetchResources: "false" });
98-
success &&= await runEnd2EndTest("Run Disabled Suite", { tag: "disabled" });
99-
success &&= await runEnd2EndTest("Run Default Suite");
147+
for (const test of testsToRun) {
148+
success &&= await test.run();
149+
}
100150
} finally {
101151
server.close();
102152
}

0 commit comments

Comments
 (0)