Skip to content

Commit 46632ce

Browse files
fuzzie360claude
andcommitted
test: Group BrowserStack runs under one build
buildName was unique per run (a timestamp, or the GitHub run id), so every run produced a separate build entry and the dashboard had no single "gpu.js" build to open — the runs were there but effectively unfindable. Use the split BrowserStack expects instead: a stable buildName of "gpu.js" plus a varying buildIdentifier, so runs group under one build. BROWSERSTACK_BUILD overrides the name. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 4092aa7 commit 46632ce

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎test/browserstack/run.js‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ function buildCapabilities(target, context) {
145145
const bstack = {
146146
projectName: context.projectName,
147147
buildName: context.buildName,
148+
buildIdentifier: context.buildIdentifier,
148149
sessionName: target.name,
149150
local: 'true',
150151
localIdentifier: context.localIdentifier,
@@ -287,9 +288,13 @@ async function main() {
287288

288289
const { server, port } = await startServer();
289290
const localIdentifier = `gpujs-${process.pid}-${Date.now()}`;
290-
const buildName = process.env.GITHUB_RUN_ID
291-
? `gpu.js CI #${process.env.GITHUB_RUN_ID}`
292-
: `gpu.js local ${new Date().toISOString().replace('T', ' ').slice(0, 19)}`;
291+
// BrowserStack groups runs under a single build when the name is stable and
292+
// the identifier varies. A unique name per run instead creates a separate
293+
// build entry every time, which buries the project in the dashboard.
294+
const buildName = process.env.BROWSERSTACK_BUILD || 'gpu.js';
295+
const buildIdentifier = process.env.GITHUB_RUN_ID
296+
? `CI ${process.env.GITHUB_RUN_ID}`
297+
: `local ${new Date().toISOString().replace('T', ' ').slice(0, 19)}`;
293298

294299
const suitePath = args.suite === 'qunit'
295300
? `/test/all.html${args.filter ? `?filter=${encodeURIComponent(args.filter)}` : ''}`
@@ -298,13 +303,13 @@ async function main() {
298303

299304
console.log(`suite: ${args.suite}`);
300305
console.log(`url: ${url}`);
301-
console.log(`build: ${buildName}`);
306+
console.log(`build: ${buildName} (${buildIdentifier})`);
302307
console.log(`targets: ${targets.length} (${args.browsers}), concurrency ${args.concurrency}\n`);
303308

304309
if (args['dry-run']) {
305310
targets.forEach(target => {
306311
const caps = buildCapabilities(target, {
307-
user, key, localIdentifier, buildName, projectName: args.project
312+
user, key, localIdentifier, buildName, buildIdentifier, projectName: args.project
308313
});
309314
// never print the access key, even locally
310315
const shown = JSON.parse(JSON.stringify(caps));
@@ -320,7 +325,7 @@ async function main() {
320325
console.log('tunnel up\n');
321326

322327
const context = {
323-
user, key, localIdentifier, buildName, url,
328+
user, key, localIdentifier, buildName, buildIdentifier, url,
324329
projectName: args.project,
325330
suite: args.suite,
326331
timeout: args.timeout
@@ -361,7 +366,7 @@ async function main() {
361366
console.log(`\n${results.length - failed.length}/${results.length} targets passed`);
362367

363368
const reportPath = path.join(REPO_ROOT, 'browserstack-results.json');
364-
fs.writeFileSync(reportPath, JSON.stringify({ buildName, suite: args.suite, results }, null, 2));
369+
fs.writeFileSync(reportPath, JSON.stringify({ buildName, buildIdentifier, suite: args.suite, results }, null, 2));
365370
console.log(`report written to ${path.relative(REPO_ROOT, reportPath)}`);
366371

367372
process.exitCode = failed.length ? 1 : 0;

0 commit comments

Comments
 (0)