tape-six 1.7.10 → 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 +1 -0
- package/TESTING.md +25 -1
- package/package.json +1 -1
- package/skills/write-tests/SKILL.md +4 -3
package/README.md
CHANGED
|
@@ -419,6 +419,7 @@ 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._
|
|
422
423
|
- 1.7.10 _Switched from workflows to Agent Skills (agentskills.io) for consumer integration. Improved CJS import docs._
|
|
423
424
|
- 1.7.9 _Merged test directories, fixed `.d.ts` typings, added `ts-check` to CI._
|
|
424
425
|
- 1.7.8 _Bug fix: Deno stdout flush before exit to prevent truncated output._
|
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
|
@@ -17,9 +17,9 @@ Write or update tests using the tape-six testing library.
|
|
|
17
17
|
|
|
18
18
|
1. Read the testing guide at `node_modules/tape-six/TESTING.md` for API reference and patterns.
|
|
19
19
|
2. Identify the module or feature to test. Read its source code to understand the public API.
|
|
20
|
-
3. Create or update the test file in `tests/test-<name>.js` (or `.ts` for TypeScript
|
|
21
|
-
-
|
|
22
|
-
-
|
|
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.
|
|
23
23
|
- Write one top-level `test()` per logical group.
|
|
24
24
|
- Use embedded `await t.test()` for sub-cases.
|
|
25
25
|
- Use `t.beforeEach`/`t.afterEach` for shared setup/teardown.
|
|
@@ -29,4 +29,5 @@ Write or update tests using the tape-six testing library.
|
|
|
29
29
|
4. Run the new test file directly to verify: `node tests/test-<name>.js`
|
|
30
30
|
5. Run the full test suite to check for regressions: `npm test`
|
|
31
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`).
|
|
32
33
|
6. Report results and any failures.
|