Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions bazel/integration/test_runner/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
21 changes: 19 additions & 2 deletions bazel/integration/test_runner/size-tracking.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -121,4 +122,20 @@ export class SizeTracker {
console.info(Array(80).fill('=').join(''));
console.info();
}

/**
* File the provided file, replacing has 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(/\[[hH][aA][sS][hH]\]/, '*');
const matchedFiles = globSync(filePathPattern, {onlyFiles: true});
if (matchedFiles.length === 1) {
return matchedFiles[0];
}
return null;
}
}
3 changes: 2 additions & 1 deletion bazel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
Expand Down
42 changes: 36 additions & 6 deletions bazel/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading