@git.zone/tstest 1.7.0 → 1.8.0

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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@git.zone/tstest',
6
- version: '1.7.0',
6
+ version: '1.8.0',
7
7
  description: 'a test utility to run tests that match test/**/*.ts'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxrQkFBa0I7SUFDeEIsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHFEQUFxRDtDQUNuRSxDQUFBIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@git.zone/tstest",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "private": false,
5
5
  "description": "a test utility to run tests that match test/**/*.ts",
6
6
  "exports": {
package/readme.md CHANGED
@@ -19,6 +19,14 @@
19
19
  - 📝 **Detailed Logging** - Optional file logging for debugging
20
20
  - ⚡ **Performance Metrics** - See which tests are slow
21
21
  - 🤖 **CI/CD Ready** - JSON output mode for automation
22
+ - 🏷️ **Tag-based Filtering** - Run only tests with specific tags
23
+ - 🎯 **Parallel Test Execution** - Run tests in parallel groups
24
+ - 🔧 **Test Lifecycle Hooks** - beforeEach/afterEach support
25
+ - 📸 **Snapshot Testing** - Compare test outputs with saved snapshots
26
+ - ⏳ **Timeout Control** - Set custom timeouts for tests
27
+ - 🔁 **Retry Logic** - Automatically retry failing tests
28
+ - 🛠️ **Test Fixtures** - Create reusable test data
29
+ - 📦 **Browser-Compatible** - Full browser support for tapbundle
22
30
 
23
31
  ## Installation
24
32
 
@@ -61,6 +69,7 @@ tstest "test/unit/*.ts"
61
69
  | `--no-color` | Disable colored output |
62
70
  | `--json` | Output results as JSON |
63
71
  | `--logfile` | Save detailed logs to `.nogit/testlogs/[testname].log` |
72
+ | `--tags <tags>` | Run only tests with specific tags (comma-separated) |
64
73
 
65
74
  ### Example Outputs
66
75
 
@@ -147,6 +156,103 @@ tap.test('my awesome test', async () => {
147
156
  tap.start();
148
157
  ```
149
158
 
159
+ #### Test Features
160
+
161
+ **Tag-based Test Filtering**
162
+ ```typescript
163
+ tap.tags('unit', 'api')
164
+ .test('should handle API requests', async () => {
165
+ // Test code
166
+ });
167
+
168
+ // Run with: tstest test/ --tags unit,api
169
+ ```
170
+
171
+ **Test Lifecycle Hooks**
172
+ ```typescript
173
+ tap.describe('User API Tests', () => {
174
+ let testUser;
175
+
176
+ tap.beforeEach(async () => {
177
+ testUser = await createTestUser();
178
+ });
179
+
180
+ tap.afterEach(async () => {
181
+ await deleteTestUser(testUser.id);
182
+ });
183
+
184
+ tap.test('should update user profile', async () => {
185
+ // Test code using testUser
186
+ });
187
+ });
188
+ ```
189
+
190
+ **Parallel Test Execution**
191
+ ```typescript
192
+ // Files with matching parallel group names run concurrently
193
+ // test.auth.para__1.ts
194
+ tap.test('authentication test', async () => { /* ... */ });
195
+
196
+ // test.user.para__1.ts
197
+ tap.test('user operations test', async () => { /* ... */ });
198
+ ```
199
+
200
+ **Test Timeouts and Retries**
201
+ ```typescript
202
+ tap.timeout(5000)
203
+ .retry(3)
204
+ .test('flaky network test', async (tools) => {
205
+ // This test has 5 seconds to complete and will retry up to 3 times
206
+ });
207
+ ```
208
+
209
+ **Snapshot Testing**
210
+ ```typescript
211
+ tap.test('should match snapshot', async (tools) => {
212
+ const result = await generateReport();
213
+ await tools.matchSnapshot(result);
214
+ });
215
+ ```
216
+
217
+ **Test Fixtures**
218
+ ```typescript
219
+ // Define a reusable fixture
220
+ tap.defineFixture('testUser', async () => ({
221
+ id: 1,
222
+ name: 'Test User',
223
+ email: 'test@example.com'
224
+ }));
225
+
226
+ tap.test('user test', async (tools) => {
227
+ const user = tools.fixture('testUser');
228
+ expect(user.name).toEqual('Test User');
229
+ });
230
+ ```
231
+
232
+ **Skipping and Todo Tests**
233
+ ```typescript
234
+ tap.skip.test('work in progress', async () => {
235
+ // This test will be skipped
236
+ });
237
+
238
+ tap.todo('implement user deletion', async () => {
239
+ // This marks a test as todo
240
+ });
241
+ ```
242
+
243
+ **Browser Testing**
244
+ ```typescript
245
+ // test.browser.ts
246
+ import { tap, webhelpers } from '@push.rocks/tapbundle';
247
+
248
+ tap.test('DOM manipulation', async () => {
249
+ const element = await webhelpers.fixture(webhelpers.html`
250
+ <div>Hello World</div>
251
+ `);
252
+ expect(element).toBeInstanceOf(HTMLElement);
253
+ });
254
+ ```
255
+
150
256
  ## Advanced Features
151
257
 
152
258
  ### Glob Pattern Support
@@ -163,6 +269,8 @@ tstest "test/integration/*.test.ts"
163
269
  tstest "test/**/*.spec.ts" "test/**/*.test.ts"
164
270
  ```
165
271
 
272
+ **Important**: Always quote glob patterns to prevent shell expansion. Without quotes, the shell will expand the pattern and only pass the first matching file to tstest.
273
+
166
274
  ### Automatic Logging
167
275
 
168
276
  Use `--logfile` to automatically save test output:
@@ -181,6 +289,26 @@ In verbose mode, see performance metrics:
181
289
  Slowest test: api integration test (486ms)
182
290
  ```
183
291
 
292
+ ### Parallel Test Groups
293
+
294
+ Tests can be organized into parallel groups for concurrent execution:
295
+
296
+ ```
297
+ ━━━ Parallel Group: para__1 ━━━
298
+ ▶️ test/auth.para__1.ts
299
+ ▶️ test/user.para__1.ts
300
+ ... tests run concurrently ...
301
+ ──────────────────────────────────
302
+
303
+ ━━━ Parallel Group: para__2 ━━━
304
+ ▶️ test/db.para__2.ts
305
+ ▶️ test/api.para__2.ts
306
+ ... tests run concurrently ...
307
+ ──────────────────────────────────
308
+ ```
309
+
310
+ Files with the same parallel group suffix (e.g., `para__1`) run simultaneously, while different groups run sequentially.
311
+
184
312
  ### CI/CD Integration
185
313
 
186
314
  For continuous integration, combine quiet and JSON modes:
@@ -192,6 +320,19 @@ tstest test/ --json > test-results.json
192
320
  tstest test/ --quiet
193
321
  ```
194
322
 
323
+ ## Changelog
324
+
325
+ ### Version 1.7.0
326
+ - 🎉 Made `@push.rocks/tapbundle` fully browser-compatible
327
+ - 📸 Added snapshot testing with base64-encoded communication protocol
328
+ - 🏷️ Introduced tag-based test filtering
329
+ - 🔧 Enhanced test lifecycle hooks (beforeEach/afterEach)
330
+ - 🎯 Fixed parallel test execution and grouping
331
+ - ⏳ Improved timeout and retry mechanisms
332
+ - 🛠️ Added test fixtures for reusable test data
333
+ - 📊 Enhanced TAP parser for better test reporting
334
+ - 🐛 Fixed glob pattern handling in shell scripts
335
+
195
336
  ## Contribution
196
337
 
197
338
  We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@git.zone/tstest',
6
- version: '1.7.0',
6
+ version: '1.8.0',
7
7
  description: 'a test utility to run tests that match test/**/*.ts'
8
8
  }