cargo-web
cargo-web copied to clipboard
cargo web test -- --logfile causes error
Caused in some internal code. Stacktrace:
home/col/.cache/cargo-web/bin/test_runner.js:46
j++;
^
ReferenceError: j is not defined
at get_filter (/home/col/.cache/cargo-web/bin/test_runner.js:46:21)
at run (/home/col/.cache/cargo-web/bin/test_runner.js:294:28)
at new WebAssembly.Instance (/home/col/.cache/cargo-web/bin/test_runner.js:309:24)
at eval (eval at <anonymous> (/home/col/.cache/cargo-web/bin/test_runner.js:7:1), <anonymous>:26:33)
at eval (eval at <anonymous> (/home/col/.cache/cargo-web/bin/test_runner.js:7:1), <anonymous>:51:6)
at eval (eval at <anonymous> (/home/col/.cache/cargo-web/bin/test_runner.js:7:1), <anonymous>:12:26)
at eval (eval at <anonymous> (/home/col/.cache/cargo-web/bin/test_runner.js:7:1), <anonymous>:16:2)
at Object.<anonymous> (/home/col/.cache/cargo-web/bin/test_runner.js:7:1)
at Module._compile (internal/modules/cjs/loader.js:945:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10)
Code segment reveals that there's a typo; it increments a nonexistent variable j
(maybe you meant i
?)
const get_filter = function( args ) {
for( var i = 0; i < args.length; ++i ) {
const arg = args[ i ];
if( arg.startsWith( "--" ) ) {
if(
arg === "--skip" ||
arg === "--logfile" ||
arg === "--test-threads" ||
arg === "--color" ||
arg === "--format"
) {
j++;
}
continue;
}
return args[ i ];
}
return null;
};
FYI this is the only place that argument parsing seems to happen. I'm guessing these options are skipped for compatibility.