Skip to content

Commit 25eb91a

Browse files
committed
update docs
1 parent 280f5c6 commit 25eb91a

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

bin/as-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (lt(version, "12.16.0")) {
1414
exit(-1);
1515
}
1616
const argv = [];
17-
argv.push("--experimental-wasi-unstable-preview1");
17+
argv.push("--no-warnings");
1818
if (lt(version, "15.0.0")) {
1919
argv.push("--experimental-wasm-bigint");
2020
}

docs/api-documents/options.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ There are command line options which can override the configuration in `as-test.
2727
```
2828
--testcase <testcases...> only run specified test cases
2929
--testNamePattern <test name pattern> run only tests with a name that matches the regex pattern
30+
--onlyFailures Run tests that failed in the previous
3031
```
3132

3233
There are several ways to run partial test cases:
3334

34-
#### Partial Test Files
35+
#### Run specified test files
3536

3637
Providing file path to `--testcase`, it can specify a certain group of files for testing.
3738

@@ -55,7 +56,7 @@ run `as-test --testcase a.test.ts b.test.ts` will match all tests in `a.test.ts`
5556

5657
:::
5758

58-
#### Partial Tests
59+
#### Run partial tests using a regex name pattern
5960

6061
Providing regex which can match targeted test name to `--testNamePattern`, it can specify a certain group of tests for testing.
6162

@@ -94,6 +95,10 @@ The framework join `DescriptionName` and `TestName` with `" "` by default, e.g.
9495

9596
:::
9697

98+
#### Run only failures
99+
100+
Provides the ability to run only the test cases that failed in the previous test.
101+
97102
### Whether collect coverage information
98103

99104
```

package-lock.json

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
},
3030
"dependencies": {
3131
"@assemblyscript/loader": ">=0.25.1",
32-
"@assemblyscript/wasi-shim": "^0.1.0",
3332
"chalk": "^5.2.0",
3433
"commander": "^8.3.0",
3534
"cross-spawn": "^7.0.3",

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { execWasmBinaries } from "./core/execute.js";
88
import { generateReport, reportConfig } from "./generator/index.js";
99
import { TestOption } from "./interface.js";
1010
import { join } from "node:path";
11-
import assert from "node:assert";
1211

1312
const { readFileSync, emptydirSync } = pkg;
1413

@@ -39,7 +38,14 @@ export async function start_unit_test(options: TestOption): Promise<boolean> {
3938
let failedTestCases: string[] = [];
4039
if (options.onlyFailures) {
4140
failedTestCases = JSON.parse(readFileSync(failurePath, "utf8")) as string[];
42-
assert(failedTestCases.length > 0, "No failed test cases found");
41+
if (failedTestCases.length === 0) {
42+
options.collectCoverage = true;
43+
console.log(
44+
chalk.yellowBright(
45+
'Warning: no failed test cases found while enabled "onlyFailures", execute all test cases by default'
46+
)
47+
);
48+
}
4349
}
4450

4551
emptydirSync(options.outputFolder);

0 commit comments

Comments
 (0)