as-test 1.1.3 → 1.1.4

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 CHANGED
@@ -1,19 +1,30 @@
1
1
  # Change Log
2
2
 
3
- ## 2026-05-13 - v1.1.2
3
+ ## 2026-05-14 - v1.1.4
4
+
5
+ - feat: add `coverage.mode` (`project` or `all`) plus `coverage.dependencies` package allowlisting so dependency coverage can include normal or pnpm-installed packages without raw path globs.
6
+
7
+ ## 2026-05-13 - v1.1.3
8
+
9
+ ### Coverage
4
10
 
5
- - update build and run faliures to provide helpful error messages and reproduction commands and instructions
6
- - remove confirmation from ast clean
7
11
  - feat: make coverage gaps hierarchical and easier to scan, with parent-before-child grouping, tree-style connectors, collapsed nested gaps by default, and `--show-coverage=all` / `--verbose` expansion.
8
12
  - feat: add richer coverage point names including `DefaultValue`, `Ternary`, `IfBranch`, `Assignment`, `Loop`, `Return`, and `Throw` so uncovered points describe the actual construct instead of falling back to broad labels.
9
13
  - fix: make coverage snippets underline the emitted construct span instead of recomputing from the raw column, so cases like inline `if (...) ...` and assignments highlight the right text.
10
14
 
11
- ## 2026-05-12 -v1.1.1
15
+ ## 2026-05-13 - v1.1.2
16
+
17
+ ### Reporting & CLI
18
+
19
+ - fix: update build and run failures to provide clearer error messages plus reproduction commands and instructions.
20
+ - fix: remove the confirmation prompt from `ast clean`.
21
+
22
+ ## 2026-05-12 - v1.1.1
12
23
 
13
24
  - add `ast clean` command to remove build outputs, coverage outputs, crash reports, and logs.
14
25
  - remove deps
15
26
 
16
- ## 2026-05-12 -v1.1.0
27
+ ## 2026-05-12 - v1.1.0
17
28
 
18
29
  ### Upgrading to 1.1.0
19
30
 
@@ -81,7 +92,7 @@
81
92
  - feat: make integer `FuzzSeed` helpers default to the full range of their target type when no options are provided, instead of collapsing to `0`.
82
93
  - perf: add unchecked full-range fast paths for default integer seed generation while keeping explicit user-provided ranges validated.
83
94
 
84
- ## 2025-05-03 - v1.0.13
95
+ ## 2026-05-03 - v1.0.13
85
96
 
86
97
  - feat: add `--fuzzer` / `--fuzzers` filtering for `ast fuzz` and `ast test --fuzz`, accept `--suite` / `--suites` as fuzz aliases, and include target-specific repro commands in fuzz failure output.
87
98
  - feat: add `--suite` / `--suites` filtering for `ast run` and `ast test`, and print suite-specific repro commands on failing test assertions.
package/README.md CHANGED
@@ -16,12 +16,13 @@
16
16
  - [Why as-test](#why-as-test)
17
17
  - [Installation](#installation)
18
18
  - [Docs](#docs)
19
- - [Project Layout](#project-layout)
20
19
  - [Writing Tests](#writing-tests)
21
20
  - [Mocking](#mocking)
22
21
  - [Snapshots](#snapshots)
23
- - [Fuzzing](#fuzzing)
24
22
  - [Runtimes](#runtimes)
23
+ - [Modes](#modes)
24
+ - [Coverage](#coverage)
25
+ - [Fuzzing](#fuzzing)
25
26
  - [Examples](#examples)
26
27
  - [License](#license)
27
28
 
@@ -33,15 +34,6 @@ Most AssemblyScript testing tools are tied to a single runtime, usually Node.js.
33
34
  If you deploy to WASI, Wazero, or a custom runtime, you often end up mocking everything and maintaining parallel logic just for tests.
34
35
  as-test solves this by letting you run tests on your actual target runtime, while only mocking what’s necessary.
35
36
 
36
- Key benefits
37
-
38
- - Runtime-agnostic: test on WASI, bindings, or custom runners
39
- - Minimal mocking: keep real imports when possible
40
- - Production-like testing: catch runtime-specific issues early
41
- - Inline mocking and snapshots
42
- - Custom reporters and coverage
43
- - Integrated fuzzing support
44
-
45
37
  ## Installation
46
38
 
47
39
  The easiest way to start is with the project initializer:
@@ -64,50 +56,6 @@ Full documentation lives at:
64
56
 
65
57
  <https://docs.jairus.dev/as-test>
66
58
 
67
- ## Project Layout
68
-
69
- By default, `as-test` looks for:
70
-
71
- - tests in `assembly/__tests__`
72
- - fuzzers in `assembly/__fuzz__`
73
- - config in `as-test.config.json`
74
-
75
- Generated files go into `.as-test/`.
76
-
77
- Minimal `as-test.config.json`:
78
-
79
- ```json
80
- {
81
- "input": ["assembly/__tests__/*.spec.ts"],
82
- "output": ".as-test/",
83
- "buildOptions": {
84
- "target": "wasi"
85
- },
86
- "runOptions": {
87
- "runtime": {
88
- "cmd": "node .as-test/runners/default.wasi.js"
89
- }
90
- }
91
- }
92
- ```
93
-
94
- Coverage point filtering is configurable when you want to ignore known-noisy gaps:
95
-
96
- ```json
97
- {
98
- "coverage": {
99
- "enabled": true,
100
- "include": ["assembly/src/**/*.ts"],
101
- "ignore": {
102
- "labels": ["Call"],
103
- "names": ["panic", "serialize"],
104
- "locations": ["assembly/src/fuzz.ts:38:*"],
105
- "snippets": ["*message: string*"]
106
- }
107
- }
108
- }
109
- ```
110
-
111
59
  ## Writing Tests
112
60
 
113
61
  Tests usually live in `assembly/__tests__/*.spec.ts`.
@@ -119,7 +67,7 @@ import { describe, expect, test } from "as-test";
119
67
 
120
68
  describe("math", () => {
121
69
  test("adds numbers", () => {
122
- expect(1 + 2).toBe(3);
70
+ expect(1 + 2).toBe(3, "should add two numbers");
123
71
  });
124
72
  });
125
73
  ```
@@ -145,8 +93,8 @@ npx ast test math
145
93
  Re-run one suite inside a matching file:
146
94
 
147
95
  ```bash
148
- npx ast run math --suite array-check
149
- npx ast run math --suite array-manipulation/array-check
96
+ npx ast run math --suite math
97
+ npx ast run math --suite math/adds-numbers
150
98
  ```
151
99
 
152
100
  You do not need to learn every CLI flag to get started. Most projects can begin with `npx ast test`, then add more configuration only when they need it.
@@ -232,96 +180,6 @@ If an existing snapshot legitimately changed, overwrite it with:
232
180
  npx ast test --overwrite-snapshots
233
181
  ```
234
182
 
235
- ## Fuzzing
236
-
237
- Fuzzers usually live in `assembly/__fuzz__/*.fuzz.ts`.
238
-
239
- Example:
240
-
241
- ```ts
242
- import { expect, FuzzSeed, fuzz } from "as-test";
243
-
244
- fuzz("bounded integer addition", (left: i32, right: i32): bool => {
245
- const sum = left + right;
246
- expect(sum - right).toBe(left);
247
- return sum >= i32.MIN_VALUE;
248
- }).generate((seed: FuzzSeed, run: (left: i32, right: i32) => bool): void => {
249
- run(seed.i32({ min: -1000, max: 1000 }), seed.i32({ min: -1000, max: 1000 }));
250
- });
251
- ```
252
-
253
- Pass a third argument to override the operation count for one target without changing the global fuzz config:
254
-
255
- ```ts
256
- fuzz(
257
- "hot path stays stable",
258
- (): void => {
259
- expect(1 + 1).toBe(2);
260
- },
261
- 250,
262
- );
263
- ```
264
-
265
- Or pass it as the second argument to `.generate(...)`:
266
-
267
- ```ts
268
- fuzz(
269
- "ascii strings survive concatenation boundaries",
270
- (input: string): bool => {
271
- expect(input.length <= 40).toBe(true);
272
- return true;
273
- },
274
- ).generate((seed: FuzzSeed, run: (input: string) => bool): void => {
275
- run(seed.string({ charset: "ascii", min: 0, max: 40 }));
276
- }, 250);
277
- ```
278
-
279
- You can still override fuzz runs from the CLI when you want to force a different count for the current command:
280
-
281
- ```bash
282
- npx ast fuzz --runs 500
283
- npx ast fuzz --runs 1.5x
284
- npx ast fuzz --runs +10%
285
- npx ast fuzz --runs +100000
286
- ```
287
-
288
- If you used `npx ast init` with a fuzzer example, the config is already there. Otherwise, add a `fuzz` block to `as-test.config.json` so `npx ast fuzz` knows what to build:
289
-
290
- ```json
291
- {
292
- "fuzz": {
293
- "input": ["./assembly/__fuzz__/*.fuzz.ts"],
294
- "target": "bindings"
295
- }
296
- }
297
- ```
298
-
299
- `ast fuzz` runs fuzz files across the selected modes, reports one result per file, and keeps the final summary separate from the normal test totals. If you want one combined command, use `ast test --fuzz`.
300
-
301
- By default, each fuzz run campaign picks a new random base seed. Pin a seed with `--seed <n>` (or `--fuzz-seed <n>` on `ast test`) when you want deterministic replay.
302
-
303
- When a fuzzer fails, `as-test` now prints the exact failing seeds and one-run repro commands such as `ast fuzz ... --seed <seed+n> --runs 1`. Crash records in `.as-test/crashes` also include the captured inputs passed to `run(...)`, which helps when the generator itself has side effects.
304
-
305
- Run only fuzzers:
306
-
307
- ```bash
308
- npx ast fuzz
309
- ```
310
-
311
- Run one matching fuzz target:
312
-
313
- ```bash
314
- npx ast fuzz string --fuzzer ascii-strings-survive-concatenation-boundaries
315
- ```
316
-
317
- Run tests and fuzzers together:
318
-
319
- ```bash
320
- npx ast test --fuzz
321
- ```
322
-
323
- Fuzzing is there when you want broader input coverage, but it does not get in the way of the normal test flow. You can start with ordinary specs and add fuzzers later.
324
-
325
183
  ## Runtimes
326
184
 
327
185
  One of the main reasons to use `as-test` is that you are not locked into a single runtime.
@@ -350,7 +208,13 @@ Then run your tests normally:
350
208
  npx ast test
351
209
  ```
352
210
 
353
- If you want to keep more than one runtime around, use modes:
211
+ If you want to keep a single runtime, one config is enough. If you want to fan out across multiple runtimes, use modes.
212
+
213
+ ## Modes
214
+
215
+ Modes let one project keep more than one runtime or build target available at the same time.
216
+
217
+ For example:
354
218
 
355
219
  ```json
356
220
  {
@@ -389,8 +253,12 @@ Set `"default": false` on a mode when you want to keep it available for explicit
389
253
  "modes": {
390
254
  "web": {
391
255
  "default": false,
256
+ "buildOptions": {
257
+ "target": "web"
258
+ },
392
259
  "runOptions": {
393
260
  "runtime": {
261
+ "cmd": "node ./.as-test/runners/default.web.js",
394
262
  "browser": "chromium"
395
263
  }
396
264
  }
@@ -423,8 +291,12 @@ Modes can also be full config objects. That means a mode can override fuzzing, i
423
291
  "input": ["./assembly/__fuzz__/web/*.fuzz.ts"],
424
292
  "runs": 200
425
293
  },
294
+ "buildOptions": {
295
+ "target": "web"
296
+ },
426
297
  "runOptions": {
427
298
  "runtime": {
299
+ "cmd": "node ./.as-test/runners/default.web.js",
428
300
  "browser": "chromium"
429
301
  }
430
302
  }
@@ -455,6 +327,135 @@ or
455
327
  npx ast test --mode wasi,bindings
456
328
  ```
457
329
 
330
+ ## Coverage
331
+
332
+ Coverage is opt-in.
333
+
334
+ Enable it from the CLI:
335
+
336
+ ```bash
337
+ npx ast test --enable coverage
338
+ npx ast test --enable coverage --show-coverage
339
+ npx ast test --enable coverage --show-coverage=all
340
+ ```
341
+
342
+ Or from config:
343
+
344
+ ```json
345
+ {
346
+ "coverage": {
347
+ "enabled": true,
348
+ "mode": "project",
349
+ "dependencies": ["json-as"],
350
+ "includeSpecs": false
351
+ }
352
+ }
353
+ ```
354
+
355
+ Coverage modes:
356
+
357
+ - `project`
358
+ - covers project files only
359
+ - excludes dependency files by default
360
+ - `all`
361
+ - covers project files and dependency files
362
+ - still excludes AssemblyScript stdlib files
363
+
364
+ If you only want specific dependencies, keep `mode: "project"` and list package names in `dependencies`.
365
+ That works for both normal installs and `pnpm` layouts.
366
+
367
+ `--show-coverage` prints uncovered point details. `--show-coverage=all` and `--verbose` expand nested uncovered gaps instead of collapsing them.
368
+
369
+ ## Fuzzing
370
+
371
+ Fuzzers usually live in `assembly/__fuzz__/*.fuzz.ts`.
372
+
373
+ Example:
374
+
375
+ ```ts
376
+ import { expect, FuzzSeed, fuzz } from "as-test";
377
+
378
+ fuzz("bounded integer addition", (left: i32, right: i32): bool => {
379
+ const sum = left + right;
380
+ expect(sum - right).toBe(left);
381
+ return sum >= i32.MIN_VALUE;
382
+ }).generate((seed: FuzzSeed, run: (left: i32, right: i32) => bool): void => {
383
+ run(seed.i32({ min: -1000, max: 1000 }), seed.i32({ min: -1000, max: 1000 }));
384
+ });
385
+ ```
386
+
387
+ Pass a third argument to override the operation count for one target without changing the global fuzz config:
388
+
389
+ ```ts
390
+ fuzz(
391
+ "hot path stays stable",
392
+ (): void => {
393
+ expect(1 + 1).toBe(2);
394
+ },
395
+ 250,
396
+ );
397
+ ```
398
+
399
+ Or pass it as the second argument to `.generate(...)`:
400
+
401
+ ```ts
402
+ fuzz(
403
+ "ascii strings survive concatenation boundaries",
404
+ (input: string): bool => {
405
+ expect(input.length <= 40).toBe(true);
406
+ return true;
407
+ },
408
+ ).generate((seed: FuzzSeed, run: (input: string) => bool): void => {
409
+ run(seed.string({ charset: "ascii", min: 0, max: 40 }));
410
+ }, 250);
411
+ ```
412
+
413
+ You can still override fuzz runs from the CLI when you want to force a different count for the current command:
414
+
415
+ ```bash
416
+ npx ast fuzz --runs 500
417
+ npx ast fuzz --runs 1.5x
418
+ npx ast fuzz --runs +10%
419
+ npx ast fuzz --runs +100000
420
+ ```
421
+
422
+ If you used `npx ast init` with a fuzzer example, the config is already there. Otherwise, add a `fuzz` block to `as-test.config.json` so `npx ast fuzz` knows what to build:
423
+
424
+ ```json
425
+ {
426
+ "fuzz": {
427
+ "input": ["./assembly/__fuzz__/*.fuzz.ts"],
428
+ "target": "bindings"
429
+ }
430
+ }
431
+ ```
432
+
433
+ `ast fuzz` runs fuzz files across the selected modes, reports one result per file, and keeps the final summary separate from the normal test totals. If you want one combined command, use `ast test --fuzz`.
434
+
435
+ By default, each fuzz run campaign picks a new random base seed. Pin a seed with `--seed <n>` (or `--fuzz-seed <n>` on `ast test`) when you want deterministic replay.
436
+
437
+ When a fuzzer fails, `as-test` now prints the exact failing seeds and one-run repro commands such as `ast fuzz ... --seed <seed+n> --runs 1`. Crash records in `.as-test/crashes` also include the captured inputs passed to `run(...)`, which helps when the generator itself has side effects.
438
+
439
+ Run only fuzzers:
440
+
441
+ ```bash
442
+ npx ast fuzz
443
+ ```
444
+
445
+ Run one matching fuzz target:
446
+
447
+ ```bash
448
+ npx ast fuzz string --fuzzer ascii-strings-survive-concatenation-boundaries
449
+ ```
450
+
451
+ Run tests and fuzzers together:
452
+
453
+ ```bash
454
+ npx ast test --fuzz
455
+ ```
456
+
457
+ Fuzzing is there when you want broader input coverage, but it does not get in the way of the normal test flow. You can start with ordinary specs and add fuzzers later.
458
+
458
459
  This is the general idea throughout the project: write tests once, then choose the runtime that matches how your code actually runs.
459
460
 
460
461
  ## Examples
@@ -101,11 +101,25 @@
101
101
  "type": "boolean",
102
102
  "default": false
103
103
  },
104
+ "mode": {
105
+ "type": "string",
106
+ "enum": ["project", "all"],
107
+ "description": "Broad coverage eligibility. \"project\" covers project sources only. \"all\" also includes dependency sources.",
108
+ "default": "project"
109
+ },
104
110
  "includeSpecs": {
105
111
  "type": "boolean",
106
112
  "description": "Include *.spec.ts files in coverage collection.",
107
113
  "default": false
108
114
  },
115
+ "dependencies": {
116
+ "type": "array",
117
+ "description": "Package-name allowlist for dependency coverage, including pnpm-installed packages.",
118
+ "items": {
119
+ "type": "string"
120
+ },
121
+ "default": []
122
+ },
109
123
  "include": {
110
124
  "type": "array",
111
125
  "description": "Only include matching source files in coverage reports when this list is not empty.",
@@ -369,8 +383,18 @@
369
383
  "enabled": {
370
384
  "type": "boolean"
371
385
  },
386
+ "mode": {
387
+ "type": "string",
388
+ "enum": ["project", "all"]
389
+ },
372
390
  "includeSpecs": {
373
391
  "type": "boolean"
392
+ },
393
+ "dependencies": {
394
+ "type": "array",
395
+ "items": {
396
+ "type": "string"
397
+ }
374
398
  }
375
399
  }
376
400
  }
@@ -1313,12 +1313,18 @@ function isIgnoredCoverageFile(file, coverage) {
1313
1313
  const normalized = file.replace(/\\/g, "/");
1314
1314
  if (!isAllowedCoverageSourceFile(normalized))
1315
1315
  return true;
1316
- if (normalized.startsWith("node_modules/"))
1317
- return true;
1318
- if (normalized.includes("/node_modules/"))
1319
- return true;
1320
1316
  if (isAssemblyScriptStdlibFile(normalized))
1321
1317
  return true;
1318
+ const classification = classifyCoverageFile(normalized);
1319
+ if (classification.kind == "dependency") {
1320
+ if (coverage.mode != "all" && !coverage.dependencies.length)
1321
+ return true;
1322
+ if (coverage.dependencies.length &&
1323
+ (!classification.packageName ||
1324
+ !coverage.dependencies.includes(classification.packageName))) {
1325
+ return true;
1326
+ }
1327
+ }
1322
1328
  if (!coverage.includeSpecs && normalized.endsWith(".spec.ts"))
1323
1329
  return true;
1324
1330
  if (coverage.include.length &&
@@ -1387,11 +1393,42 @@ function isAssemblyScriptStdlibFile(file) {
1387
1393
  return true;
1388
1394
  return false;
1389
1395
  }
1396
+ function classifyCoverageFile(file) {
1397
+ const packageName = resolveCoverageDependencyPackage(file);
1398
+ if (packageName) {
1399
+ return { kind: "dependency", packageName };
1400
+ }
1401
+ return { kind: "project", packageName: null };
1402
+ }
1403
+ function resolveCoverageDependencyPackage(file) {
1404
+ const normalized = file.replace(/\\/g, "/");
1405
+ const marker = "/node_modules/";
1406
+ const prefixed = normalized.startsWith("node_modules/")
1407
+ ? `/${normalized}`
1408
+ : normalized;
1409
+ const index = prefixed.lastIndexOf(marker);
1410
+ if (index == -1)
1411
+ return null;
1412
+ const after = prefixed.slice(index + marker.length);
1413
+ if (!after.length)
1414
+ return null;
1415
+ const segments = after.split("/").filter(Boolean);
1416
+ if (!segments.length)
1417
+ return null;
1418
+ if (segments[0].startsWith("@")) {
1419
+ if (segments.length < 2)
1420
+ return null;
1421
+ return `${segments[0]}/${segments[1]}`;
1422
+ }
1423
+ return segments[0];
1424
+ }
1390
1425
  function resolveCoverageOptions(raw) {
1391
1426
  if (typeof raw == "boolean") {
1392
1427
  return {
1393
1428
  enabled: raw,
1429
+ mode: "project",
1394
1430
  includeSpecs: false,
1431
+ dependencies: [],
1395
1432
  include: [],
1396
1433
  exclude: [],
1397
1434
  ignore: {
@@ -1409,7 +1446,11 @@ function resolveCoverageOptions(raw) {
1409
1446
  : null;
1410
1447
  return {
1411
1448
  enabled: obj.enabled == null ? false : Boolean(obj.enabled),
1449
+ mode: obj.mode == "all" ? "all" : "project",
1412
1450
  includeSpecs: Boolean(obj.includeSpecs),
1451
+ dependencies: Array.isArray(obj.dependencies)
1452
+ ? obj.dependencies.filter((item) => typeof item == "string")
1453
+ : [],
1413
1454
  include: Array.isArray(obj.include)
1414
1455
  ? obj.include.filter((item) => typeof item == "string")
1415
1456
  : [],
@@ -1434,7 +1475,9 @@ function resolveCoverageOptions(raw) {
1434
1475
  }
1435
1476
  return {
1436
1477
  enabled: false,
1478
+ mode: "project",
1437
1479
  includeSpecs: false,
1480
+ dependencies: [],
1438
1481
  include: [],
1439
1482
  exclude: [],
1440
1483
  ignore: {
@@ -2489,3 +2532,9 @@ function resolveReporterFactory(mod) {
2489
2532
  }
2490
2533
  throw new Error(`reporter module must export a factory as "createReporter" or default`);
2491
2534
  }
2535
+ export const __coverageInternals = {
2536
+ classifyCoverageFile,
2537
+ resolveCoverageDependencyPackage,
2538
+ isIgnoredCoverageFile,
2539
+ resolveCoverageOptions,
2540
+ };
package/bin/types.js CHANGED
@@ -18,7 +18,9 @@ export class Config {
18
18
  export class CoverageOptions {
19
19
  constructor() {
20
20
  this.enabled = false;
21
+ this.mode = "project";
21
22
  this.includeSpecs = false;
23
+ this.dependencies = [];
22
24
  this.include = [];
23
25
  this.exclude = [];
24
26
  this.ignore = new CoverageIgnoreOptions();
package/bin/util.js CHANGED
@@ -332,7 +332,7 @@ function validateCoverageValue(value, path, issues) {
332
332
  issues.push({
333
333
  path,
334
334
  message: "must be a boolean or object",
335
- fix: 'use true/false or { "enabled": true, "includeSpecs": false, "include": ["assembly/**/*.ts"], "exclude": ["assembly/__tests__/**/*.spec.ts"] }',
335
+ fix: 'use true/false or { "enabled": true, "mode": "project", "includeSpecs": false, "dependencies": ["json-as"], "include": ["assembly/**/*.ts"], "exclude": ["assembly/__tests__/**/*.spec.ts"] }',
336
336
  });
337
337
  return;
338
338
  }
@@ -344,6 +344,22 @@ function validateCoverageValue(value, path, issues) {
344
344
  fix: "set to true or false",
345
345
  });
346
346
  }
347
+ if ("mode" in obj && obj.mode != undefined) {
348
+ if (typeof obj.mode != "string") {
349
+ issues.push({
350
+ path: `${path}.mode`,
351
+ message: 'must be "project" or "all"',
352
+ fix: 'set "mode" to "project" or "all"',
353
+ });
354
+ }
355
+ else if (obj.mode != "project" && obj.mode != "all") {
356
+ issues.push({
357
+ path: `${path}.mode`,
358
+ message: 'must be "project" or "all"',
359
+ fix: 'set "mode" to "project" or "all"',
360
+ });
361
+ }
362
+ }
347
363
  if ("includeSpecs" in obj && typeof obj.includeSpecs != "boolean") {
348
364
  issues.push({
349
365
  path: `${path}.includeSpecs`,
@@ -351,6 +367,7 @@ function validateCoverageValue(value, path, issues) {
351
367
  fix: "set to true or false",
352
368
  });
353
369
  }
370
+ validateStringArrayField(obj, "dependencies", path, issues);
354
371
  validateStringArrayField(obj, "include", path, issues);
355
372
  validateStringArrayField(obj, "exclude", path, issues);
356
373
  if ("ignore" in obj && obj.ignore != undefined) {
@@ -929,6 +946,8 @@ function cloneCoverageOptions(coverage) {
929
946
  if (typeof coverage == "boolean")
930
947
  return coverage;
931
948
  const cloned = Object.assign(new CoverageOptions(), coverage);
949
+ cloned.mode = coverage.mode ?? "project";
950
+ cloned.dependencies = [...(coverage.dependencies ?? [])];
932
951
  cloned.include = [...(coverage.include ?? [])];
933
952
  cloned.exclude = [...(coverage.exclude ?? [])];
934
953
  cloned.ignore = Object.assign(new CoverageIgnoreOptions(), coverage.ignore);
@@ -1035,8 +1054,12 @@ function mergeCoverageConfig(base, override, raw) {
1035
1054
  const rawObject = raw;
1036
1055
  if ("enabled" in rawObject)
1037
1056
  mergedBase.enabled = overrideOptions.enabled;
1057
+ if ("mode" in rawObject)
1058
+ mergedBase.mode = overrideOptions.mode;
1038
1059
  if ("includeSpecs" in rawObject)
1039
1060
  mergedBase.includeSpecs = overrideOptions.includeSpecs;
1061
+ if ("dependencies" in rawObject)
1062
+ mergedBase.dependencies = [...overrideOptions.dependencies];
1040
1063
  if ("include" in rawObject)
1041
1064
  mergedBase.include = [...overrideOptions.include];
1042
1065
  if ("exclude" in rawObject)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "as-test",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "author": "Jairus Tanaka",
5
5
  "repository": {
6
6
  "type": "git",
@@ -94,7 +94,7 @@
94
94
  "docs:preview": "vitepress preview docs",
95
95
  "format": "prettier -w .",
96
96
  "release:check": "npm run build:cli && npm run build:lib && npm run build:transform && npm run test && npm run test:integration && npm run test:examples && npm pack --dry-run --cache /tmp/as-test-npm-cache",
97
- "prepublishOnly": "npm run build:cli && npm run build:lib && npm run build:transform && npm run test && npm run test:integration"
97
+ "prepublishOnly": "npm run build:cli && npm run build:lib && npm run build:transform && npm run format && npm run test && npm run test:integration"
98
98
  },
99
99
  "type": "module"
100
100
  }
@@ -264,7 +264,7 @@ export class CoverageTransform extends Visitor {
264
264
  this.globalStatements.push(registerStmt);
265
265
  }
266
266
  }
267
- visitFunctionDeclaration(node, isDefault) {
267
+ visitFunctionDeclaration(node) {
268
268
  if (node.visited)
269
269
  return;
270
270
  node.visited = true;