Enable test/test-integration scripts to take file.test.ts arguments (#306039)

* Enable test/test-integration scripts to take file.test.ts arguments
The agent likes to use them this way, when it doesn't read the skill

Co-authored-by: Copilot <copilot@github.com>

* And this

* Fixes

* update

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Rob Lourens
2026-03-28 19:48:59 -07:00
committed by GitHub
parent 73b0fb2937
commit 23c0b41d69
2 changed files with 34 additions and 4 deletions

View File

@@ -27,8 +27,9 @@ const minimist = require('minimist');
/**
* @type {{
* _: string[];
* grep: string;
* run: string;
* run: string | string[];
* runGlob: string;
* testSplit: string;
* dev: boolean;
@@ -62,7 +63,10 @@ const args = minimist(process.argv.slice(2), {
});
if (args.help) {
console.log(`Usage: node ${process.argv[1]} [options]
console.log(`Usage: node ${process.argv[1]} [options] [file...]
Bare .ts/.js file paths passed as positional arguments are treated as
--run arguments.
Options:
--grep, -g, -f <pattern> only run tests matching <pattern>
@@ -83,6 +87,14 @@ Options:
process.exit(0);
}
// Treat bare .ts/.js positional arguments as --run values
const bareFiles = (args._ || []).filter(a => typeof a === 'string' && (a.endsWith('.ts') || a.endsWith('.js')));
if (bareFiles.length > 0) {
const existing = !args.run ? [] : Array.isArray(args.run) ? args.run : [args.run];
args.run = [...existing, ...bareFiles];
args._ = (args._ || []).filter(a => !bareFiles.includes(a));
}
let crashReporterDirectory = args['crash-reporter-directory'];
if (crashReporterDirectory) {
crashReporterDirectory = path.normalize(crashReporterDirectory);