fix(docs): refresh documentation and test timing tolerances for updated APIs

This commit is contained in:
2026-05-09 12:36:02 +00:00
parent 6d6a08b168
commit 6c8485c779
11 changed files with 2093 additions and 3106 deletions
+10 -28
View File
@@ -2,6 +2,10 @@
> 🧪 Core TAP testing framework with enhanced assertions and lifecycle hooks
## Issue Reporting and Security
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
## Installation
```bash
@@ -9,10 +13,6 @@
pnpm install --save-dev @git.zone/tstest
```
## Issue Reporting and Security
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
## Overview
`@git.zone/tstest/tapbundle` is the core testing framework module that provides the TAP (Test Anything Protocol) implementation for tstest. It offers a comprehensive API for writing and organizing tests with support for lifecycle hooks, test suites, enhanced assertions with diff generation, and flexible test configuration.
@@ -393,21 +393,14 @@ tap.test('second test', async (tapTools) => {
```typescript
// Define a fixture globally (outside tests)
import { TapTools } from '@git.zone/tstest/tapbundle';
import { tap, TapTools } from '@git.zone/tstest/tapbundle';
TapTools.defineFixture('database', async () => {
const db = await createTestDatabase();
return {
value: db,
cleanup: async () => await db.close()
};
});
TapTools.defineFixture('database', async () => createTestDatabase());
// Use fixtures in tests
tap.test('database test', async (tapTools) => {
const db = await tapTools.fixture('database');
// Use db...
// Cleanup happens automatically
});
```
@@ -415,27 +408,16 @@ tap.test('database test', async (tapTools) => {
```typescript
// Define a factory
TapTools.defineFixture('user', async () => {
return {
value: null, // Not used for factories
factory: async (data) => {
return await createUser(data);
},
cleanup: async (user) => await user.delete()
};
});
TapTools.defineFixture('user', async (data) => createUser(data));
// Use factory in tests
tap.test('user test', async (tapTools) => {
const user = await tapTools.factory('user').create({ name: 'Alice' });
// Create multiple
const users = await tapTools.factory('user').createMany([
{ name: 'Alice' },
{ name: 'Bob' }
]);
// Cleanup happens automatically
const users = await tapTools.factory('user').createMany(2, (index) => ({
name: index === 0 ? 'Alice' : 'Bob',
}));
});
```