tape-six 1.7.9 → 1.7.11
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/README.md
CHANGED
|
@@ -110,6 +110,7 @@ tape-six/
|
|
|
110
110
|
├── src/ # Source code (test engine, reporters, runners, utilities)
|
|
111
111
|
├── web-app/ # Browser test UI application
|
|
112
112
|
├── tests/ # Test files (JS + TS)
|
|
113
|
+
├── skills/ # Agent Skills (agentskills.io) shipped via npm
|
|
113
114
|
├── wiki/ # GitHub wiki documentation (submodule)
|
|
114
115
|
└── vendors/ # Git submodules (deep6)
|
|
115
116
|
```
|
|
@@ -131,9 +132,8 @@ The whole API is based on two objects: `test` and `Tester`.
|
|
|
131
132
|
import test from 'tape-six';
|
|
132
133
|
// import {test} from 'tape-six';
|
|
133
134
|
|
|
134
|
-
// CommonJS:
|
|
135
|
+
// CommonJS (named import is recommended):
|
|
135
136
|
// const {test} = require('tape-six');
|
|
136
|
-
// const {default: test} = require('tape-six');
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
To help port tests from other frameworks, `test()` is aliased as `suite()`, `describe()` and `it()`. When called inside a test body, `test()` and its aliases automatically delegate to the current tester's `t.test()` method. The same applies to `test.skip()`, `test.todo()`, and `test.asPromise()`. Using `t.test()` directly is still preferred because it makes the delegation explicit.
|
|
@@ -419,6 +419,8 @@ Test output can be controlled by flags. See [Supported flags](https://github.com
|
|
|
419
419
|
|
|
420
420
|
The most recent releases:
|
|
421
421
|
|
|
422
|
+
- 1.7.11 _Documentation consistency: added missing sequential test commands to AI docs, fixed test glob references._
|
|
423
|
+
- 1.7.10 _Switched from workflows to Agent Skills (agentskills.io) for consumer integration. Improved CJS import docs._
|
|
422
424
|
- 1.7.9 _Merged test directories, fixed `.d.ts` typings, added `ts-check` to CI._
|
|
423
425
|
- 1.7.8 _Bug fix: Deno stdout flush before exit to prevent truncated output._
|
|
424
426
|
- 1.7.7 _Bug fix: Windows path normalization in `tape6-server`, documented `--flags=FO` option form._
|
package/TESTING.md
CHANGED
|
@@ -512,6 +512,8 @@ Flags control test output. Uppercase = enabled, lowercase = disabled.
|
|
|
512
512
|
|
|
513
513
|
Common combinations: `FO` (failures only + stop at first), `FOT` (+ show time).
|
|
514
514
|
|
|
515
|
+
When multiple `--flags` are given, the last one wins. To see which files are being run (overriding `--flags FO` from a script), append `--flags fo` — lowercase disables the flags.
|
|
516
|
+
|
|
515
517
|
### Environment variables
|
|
516
518
|
|
|
517
519
|
- `TAPE6_FLAGS` — flags string (alternative to `--flags`).
|
|
@@ -541,7 +543,7 @@ Add to `package.json`:
|
|
|
541
543
|
```
|
|
542
544
|
|
|
543
545
|
- `tests` — glob patterns for test files (relative to project root with leading `/`). Common for all environments.
|
|
544
|
-
- `cli` — additional patterns for CLI-only environments (Node, Bun, Deno). Typically used for `.cjs` files.
|
|
546
|
+
- `cli` — additional patterns for CLI-only environments (Node, Bun, Deno). Typically used for `.cjs` files that browsers cannot run. For CLI-only projects (no browser testing), it doesn't matter whether `.cjs` patterns go in `cli` or `tests` — all CLI runners handle both.
|
|
545
547
|
- `node`, `deno`, `bun`, `browser` — additional patterns specific to a given environment. These are **not overrides** — they are added to `tests` (and `cli` for non-browser).
|
|
546
548
|
- `importmap` — import map for browser testing (standard [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) format).
|
|
547
549
|
|
|
@@ -745,6 +747,28 @@ test('MyClass', async t => {
|
|
|
745
747
|
});
|
|
746
748
|
```
|
|
747
749
|
|
|
750
|
+
### Writing a CommonJS test
|
|
751
|
+
|
|
752
|
+
```cjs
|
|
753
|
+
const {test} = require('tape-six');
|
|
754
|
+
const {myFunction} = require('my-package');
|
|
755
|
+
|
|
756
|
+
test('myFunction from CJS', t => {
|
|
757
|
+
t.equal(myFunction(1, 2), 3);
|
|
758
|
+
});
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
If the module under test uses top-level `await`, `require()` cannot load it. Use `await import()` inside async tests instead:
|
|
762
|
+
|
|
763
|
+
```cjs
|
|
764
|
+
const {test} = require('tape-six');
|
|
765
|
+
|
|
766
|
+
test('async module from CJS', async t => {
|
|
767
|
+
const {myFunction} = await import('my-async-package');
|
|
768
|
+
t.equal(myFunction(1, 2), 3);
|
|
769
|
+
});
|
|
770
|
+
```
|
|
771
|
+
|
|
748
772
|
### Verifying after writing tests
|
|
749
773
|
|
|
750
774
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tape-six",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.11",
|
|
4
4
|
"description": "TAP-based unit test library for Node, Deno, Bun, and browsers. ES modules, TypeScript, zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"llms.txt",
|
|
82
82
|
"llms-full.txt",
|
|
83
83
|
"TESTING.md",
|
|
84
|
-
"
|
|
84
|
+
"skills"
|
|
85
85
|
],
|
|
86
86
|
"tape6": {
|
|
87
87
|
"tests": [
|
|
@@ -104,10 +104,10 @@
|
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@types/chai": "^5.2.3",
|
|
107
|
-
"@types/node": "^25.3.
|
|
107
|
+
"@types/node": "^25.3.5",
|
|
108
108
|
"chai": "^6.2.2",
|
|
109
109
|
"playwright": "^1.58.2",
|
|
110
|
-
"puppeteer": "^24.
|
|
110
|
+
"puppeteer": "^24.38.0",
|
|
111
111
|
"typescript": "^5.9.3"
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
name: write-tests
|
|
3
|
+
description: Write or update tests using the tape-six testing library. Use when asked to write tests, add test coverage, or create test files for a project that uses tape-six.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
# Write Tests
|
|
@@ -16,18 +17,17 @@ Write or update tests using the tape-six testing library.
|
|
|
16
17
|
|
|
17
18
|
1. Read the testing guide at `node_modules/tape-six/TESTING.md` for API reference and patterns.
|
|
18
19
|
2. Identify the module or feature to test. Read its source code to understand the public API.
|
|
19
|
-
3. Create or update the test file in `tests/test-<name>.js` (or `.ts` for TypeScript
|
|
20
|
-
-
|
|
21
|
-
-
|
|
20
|
+
3. Create or update the test file in `tests/test-<name>.js` (or `.ts` for TypeScript, `.cjs` for CommonJS):
|
|
21
|
+
- **ESM** (`.js`): `import test from 'tape-six'` and import the module under test using the project's package name.
|
|
22
|
+
- **CJS** (`.cjs`): `const {test} = require('tape-six')` and `const {...} = require('my-package')`. If the module under test uses top-level `await`, `require()` cannot load it — use `await import('my-package')` inside async tests instead.
|
|
22
23
|
- Write one top-level `test()` per logical group.
|
|
23
24
|
- Use embedded `await t.test()` for sub-cases.
|
|
24
25
|
- Use `t.beforeEach`/`t.afterEach` for shared setup/teardown.
|
|
25
26
|
- Cover: normal operation, edge cases, error conditions.
|
|
26
27
|
- Use `t.equal` for primitives, `t.deepEqual` for objects/arrays, `t.throws` for errors, `await t.rejects` for async errors.
|
|
27
28
|
- All `msg` arguments are optional but recommended for clarity.
|
|
28
|
-
// turbo
|
|
29
29
|
4. Run the new test file directly to verify: `node tests/test-<name>.js`
|
|
30
|
-
// turbo
|
|
31
30
|
5. Run the full test suite to check for regressions: `npm test`
|
|
32
31
|
- If debugging, use `npm run test:seq` (runs sequentially, easier to trace issues).
|
|
32
|
+
- To see which files are being run, add `--flags fo` (overrides the default `--flags FO`).
|
|
33
33
|
6. Report results and any failures.
|