diff --git a/bazel/integration/test_runner/BUILD.bazel b/bazel/integration/test_runner/BUILD.bazel index d19939ec2..96721b661 100644 --- a/bazel/integration/test_runner/BUILD.bazel +++ b/bazel/integration/test_runner/BUILD.bazel @@ -9,6 +9,7 @@ ts_project( deps = [ "//bazel:node_modules/@types/node", "//bazel:node_modules/chalk", + "//bazel:node_modules/tinyglobby", "//bazel:node_modules/true-case-path", ], ) diff --git a/bazel/integration/test_runner/size-tracking.mts b/bazel/integration/test_runner/size-tracking.mts index 450424825..125ed9bfe 100644 --- a/bazel/integration/test_runner/size-tracking.mts +++ b/bazel/integration/test_runner/size-tracking.mts @@ -12,6 +12,7 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import chalk from 'chalk'; import {debug} from './debug.mjs'; +import {globSync} from 'tinyglobby'; // Convience access to chalk colors. const {red, green} = chalk; @@ -60,8 +61,8 @@ export class SizeTracker { }; for (let [filename, expectedSize] of Object.entries(expectedSizes)) { - const generedFilePath = path.join(testWorkingDir, filename); - if (!existsSync(generedFilePath)) { + const generedFilePath = this.findFile(path.join(testWorkingDir, filename)); + if (generedFilePath === null) { sizes[filename] = { actual: undefined, failing: true, @@ -121,4 +122,20 @@ export class SizeTracker { console.info(Array(80).fill('=').join('')); console.info(); } + + /** + * Find the provided file, replacing hash indicator if necessary for discovery, returns null if + * the file cannot be found. + */ + private findFile(filePath: string): string | null { + if (existsSync(filePath)) { + return filePath; + } + const filePathPattern = filePath.replace('[hash]', '*'); + const matchedFiles = globSync(filePathPattern, {onlyFiles: true}); + if (matchedFiles.length === 1) { + return matchedFiles[0]; + } + return null; + } } diff --git a/bazel/package.json b/bazel/package.json index 063ec82c2..4731be23a 100644 --- a/bazel/package.json +++ b/bazel/package.json @@ -17,7 +17,8 @@ "wait-on": "^8.0.3", "yargs": "18.0.0", "protractor": "7.0.0", - "selenium-webdriver": "4.34.0" + "selenium-webdriver": "4.33.0", + "tinyglobby": "0.2.14" }, "pnpm": { "onlyBuiltDependencies": [] diff --git a/bazel/pnpm-lock.yaml b/bazel/pnpm-lock.yaml index f16c08e6e..29171c72c 100644 --- a/bazel/pnpm-lock.yaml +++ b/bazel/pnpm-lock.yaml @@ -42,11 +42,14 @@ importers: specifier: 7.0.0 version: 7.0.0 selenium-webdriver: - specifier: 4.34.0 - version: 4.34.0 + specifier: 4.33.0 + version: 4.33.0 send: specifier: 1.2.0 version: 1.2.0 + tinyglobby: + specifier: 0.2.14 + version: 0.2.14 true-case-path: specifier: 2.2.1 version: 2.2.1 @@ -670,6 +673,14 @@ packages: fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + fdir@6.4.6: + resolution: {integrity: sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -1081,6 +1092,10 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.3: + resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} + engines: {node: '>=12'} + pify@2.3.0: resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} engines: {node: '>=0.10.0'} @@ -1205,9 +1220,9 @@ packages: resolution: {integrity: sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==} engines: {node: '>= 6.9.0'} - selenium-webdriver@4.34.0: - resolution: {integrity: sha512-zGfQFcsASAv3KrYzYh+iw4fFqB7iZAgHW7BU6rRz7isK1i1X4x3LvjmZad4bUUgHDwTnAhlqTzDh21byB+zHMg==} - engines: {node: '>= 20.0.0'} + selenium-webdriver@4.33.0: + resolution: {integrity: sha512-5vRhk4iI0B9nYbEitfnCjPDXBfG6o9DNhj5DG2355eQo8idETknhj1tigqqlkHsGephSZwLZqEm/d+3e1stGUA==} + engines: {node: '>= 18.20.5'} semver@5.7.2: resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==} @@ -1355,6 +1370,10 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + tinyglobby@0.2.14: + resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==} + engines: {node: '>=12.0.0'} + tmp@0.0.30: resolution: {integrity: sha512-HXdTB7lvMwcb55XFfrTM8CPr/IYREk4hVBFaQ4b/6nInrluSL86hfHm7vu0luYKCfyBZp2trCjpc8caC3vVM3w==} engines: {node: '>=0.4.0'} @@ -2179,6 +2198,10 @@ snapshots: fast-json-stable-stringify@2.1.0: {} + fdir@6.4.6(picomatch@4.0.3): + optionalDependencies: + picomatch: 4.0.3 + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -2574,6 +2597,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@4.0.3: {} + pify@2.3.0: {} pinkie-promise@2.0.1: @@ -2723,7 +2748,7 @@ snapshots: tmp: 0.0.30 xml2js: 0.4.23 - selenium-webdriver@4.34.0: + selenium-webdriver@4.33.0: dependencies: '@bazel/runfiles': 6.3.1 jszip: 3.10.1 @@ -2942,6 +2967,11 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + tinyglobby@0.2.14: + dependencies: + fdir: 6.4.6(picomatch@4.0.3) + picomatch: 4.0.3 + tmp@0.0.30: dependencies: os-tmpdir: 1.0.2