Skip to content

Commit 3155e03

Browse files
Merge pull request #123 from zohassadar/single_test_build_option
run single test
2 parents cb63856 + 9d8ce88 commit 3155e03

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

build.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ if (args.includes('-h')) {
2929
-c force PNG to CHR conversion
3030
-o override autodetect mmc1 header with cnrom
3131
-t run tests (requires cargo)
32+
-T run single test
3233
-h you are here
3334
`);
3435
process.exit(0);
@@ -126,8 +127,7 @@ console.timeEnd('CHR');
126127

127128
const { spawnSync } = require('child_process');
128129

129-
function exec(cmd) {
130-
const [exe, ...args] = cmd.split(' ');
130+
function execArgs(exe, args) {
131131
const output = spawnSync(exe, args).output.flatMap(
132132
(d) => d?.toString() || [],
133133
);
@@ -137,6 +137,11 @@ function exec(cmd) {
137137
}
138138
}
139139

140+
function exec(cmd) {
141+
const [exe, ...args] = cmd.split(' ');
142+
execArgs(exe, args)
143+
}
144+
140145
const ca65bin = nativeCC65 ? 'ca65' : 'node ./tools/assemble/ca65.js';
141146
const flags = compileFlags.join(' ');
142147

@@ -199,7 +204,15 @@ console.log();
199204

200205
console.timeEnd('build');
201206

207+
// tests
208+
202209
if (args.includes('-t')) {
203210
console.log('\nrunning tests');
204211
exec('cargo run --release --manifest-path tests/Cargo.toml -- -t');
205212
}
213+
214+
if (args.includes('-T')) {
215+
const singleTest = args.slice(1+args.indexOf('-T')).join(' ');
216+
console.log(`\nrunning single test: ${singleTest}`);
217+
execArgs('cargo', [...'run --release --manifest-path tests/Cargo.toml -- -T'.split(' '), singleTest]);
218+
}

0 commit comments

Comments
 (0)