as-test 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -1
- package/README.md +138 -406
- package/as-test.config.schema.json +210 -17
- package/assembly/__fuzz__/array.fuzz.ts +10 -0
- package/assembly/__fuzz__/bytes.fuzz.ts +8 -0
- package/assembly/__fuzz__/math.fuzz.ts +9 -0
- package/assembly/__fuzz__/string.fuzz.ts +21 -0
- package/assembly/index.ts +141 -86
- package/assembly/src/expectation.ts +104 -19
- package/assembly/src/fuzz.ts +723 -0
- package/assembly/src/log.ts +6 -1
- package/assembly/src/suite.ts +45 -3
- package/assembly/util/json.ts +38 -4
- package/assembly/util/wipc.ts +35 -26
- package/bin/build-worker-pool.js +149 -0
- package/bin/build-worker.js +43 -0
- package/bin/commands/build-core.js +214 -28
- package/bin/commands/build.js +1 -0
- package/bin/commands/fuzz-core.js +306 -0
- package/bin/commands/fuzz.js +10 -0
- package/bin/commands/init-core.js +129 -24
- package/bin/commands/run-core.js +525 -123
- package/bin/commands/run.js +4 -1
- package/bin/commands/test.js +8 -3
- package/bin/commands/web-runner-source.js +634 -0
- package/bin/crash-store.js +64 -0
- package/bin/index.js +1484 -169
- package/bin/reporters/default.js +281 -49
- package/bin/reporters/tap.js +83 -2
- package/bin/types.js +19 -2
- package/bin/util.js +315 -33
- package/bin/wipc.js +79 -0
- package/package.json +19 -9
- package/transform/lib/coverage.js +1 -2
- package/transform/lib/index.js +3 -3
- package/transform/lib/log.js +1 -1
package/transform/lib/index.js
CHANGED
|
@@ -99,9 +99,9 @@ function analyzeSourceText(sourceText) {
|
|
|
99
99
|
const runAlias = detectRunAlias(text);
|
|
100
100
|
const hasRunCall = runAlias
|
|
101
101
|
? new RegExp(`\\b${escapeRegex(runAlias)}\\s*\\(`).test(text)
|
|
102
|
-
:
|
|
102
|
+
: false;
|
|
103
103
|
return {
|
|
104
|
-
hasSuiteCalls: /\b(?:describe|test|it)\s*\(/.test(text),
|
|
104
|
+
hasSuiteCalls: /\b(?:describe|test|it|only|xonly|todo|fuzz|xfuzz)\s*\(/.test(text),
|
|
105
105
|
hasRunCall,
|
|
106
106
|
runImportPath,
|
|
107
107
|
hasMockCalls: /\b(?:mockFn|unmockFn|mockImport|unmockImport)\s*\(/.test(text),
|
|
@@ -135,7 +135,7 @@ function detectRunAlias(text) {
|
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
137
|
function looksLikeAsTestImport(specifiers) {
|
|
138
|
-
return /\b(?:describe|test|it|expect|beforeAll|afterAll|beforeEach|afterEach|mockFn|unmockFn|mockImport|unmockImport|
|
|
138
|
+
return /\b(?:describe|test|it|only|xonly|todo|fuzz|xfuzz|expect|beforeAll|afterAll|beforeEach|afterEach|mockFn|unmockFn|mockImport|unmockImport|snapshotFn|log|run)\b/.test(specifiers);
|
|
139
139
|
}
|
|
140
140
|
function stripComments(sourceText) {
|
|
141
141
|
return sourceText.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "");
|
package/transform/lib/log.js
CHANGED
|
@@ -73,7 +73,7 @@ function detectAsTestImportPath(sourceText) {
|
|
|
73
73
|
function looksLikeAsTestImport(specifiers, modulePath) {
|
|
74
74
|
if (modulePath === "as-test" || modulePath.endsWith("/as-test"))
|
|
75
75
|
return true;
|
|
76
|
-
return /\b(?:describe|test|it|expect|beforeAll|afterAll|beforeEach|afterEach|mockFn|unmockFn|mockImport|unmockImport|
|
|
76
|
+
return /\b(?:describe|test|it|expect|beforeAll|afterAll|beforeEach|afterEach|mockFn|unmockFn|mockImport|unmockImport|snapshotFn|log|run)\b/.test(specifiers);
|
|
77
77
|
}
|
|
78
78
|
function stripComments(sourceText) {
|
|
79
79
|
return sourceText.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "");
|