@git.zone/tstest 1.7.0 → 1.9.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.9.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.9.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 with embedded 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
 
@@ -134,10 +143,10 @@ tstest supports different test environments through file naming:
134
143
 
135
144
  ### Writing Tests
136
145
 
137
- tstest uses TAP (Test Anything Protocol) for test output. Use `@pushrocks/tapbundle` for the best experience:
146
+ tstest includes a built-in TAP (Test Anything Protocol) test framework. Import it from the embedded tapbundle:
138
147
 
139
148
  ```typescript
140
- import { expect, tap } from '@push.rocks/tapbundle';
149
+ import { expect, tap } from '@git.zone/tstest/tapbundle';
141
150
 
142
151
  tap.test('my awesome test', async () => {
143
152
  const result = await myFunction();
@@ -147,6 +156,111 @@ tap.test('my awesome test', async () => {
147
156
  tap.start();
148
157
  ```
149
158
 
159
+ **Module Exports**
160
+
161
+ tstest provides multiple exports for different use cases:
162
+
163
+ - `@git.zone/tstest` - Main CLI and test runner functionality
164
+ - `@git.zone/tstest/tapbundle` - Browser-compatible test framework
165
+ - `@git.zone/tstest/tapbundle_node` - Node.js-specific test utilities
166
+
167
+ #### Test Features
168
+
169
+ **Tag-based Test Filtering**
170
+ ```typescript
171
+ tap.tags('unit', 'api')
172
+ .test('should handle API requests', async () => {
173
+ // Test code
174
+ });
175
+
176
+ // Run with: tstest test/ --tags unit,api
177
+ ```
178
+
179
+ **Test Lifecycle Hooks**
180
+ ```typescript
181
+ tap.describe('User API Tests', () => {
182
+ let testUser;
183
+
184
+ tap.beforeEach(async () => {
185
+ testUser = await createTestUser();
186
+ });
187
+
188
+ tap.afterEach(async () => {
189
+ await deleteTestUser(testUser.id);
190
+ });
191
+
192
+ tap.test('should update user profile', async () => {
193
+ // Test code using testUser
194
+ });
195
+ });
196
+ ```
197
+
198
+ **Parallel Test Execution**
199
+ ```typescript
200
+ // Files with matching parallel group names run concurrently
201
+ // test.auth.para__1.ts
202
+ tap.test('authentication test', async () => { /* ... */ });
203
+
204
+ // test.user.para__1.ts
205
+ tap.test('user operations test', async () => { /* ... */ });
206
+ ```
207
+
208
+ **Test Timeouts and Retries**
209
+ ```typescript
210
+ tap.timeout(5000)
211
+ .retry(3)
212
+ .test('flaky network test', async (tools) => {
213
+ // This test has 5 seconds to complete and will retry up to 3 times
214
+ });
215
+ ```
216
+
217
+ **Snapshot Testing**
218
+ ```typescript
219
+ tap.test('should match snapshot', async (tools) => {
220
+ const result = await generateReport();
221
+ await tools.matchSnapshot(result);
222
+ });
223
+ ```
224
+
225
+ **Test Fixtures**
226
+ ```typescript
227
+ // Define a reusable fixture
228
+ tap.defineFixture('testUser', async () => ({
229
+ id: 1,
230
+ name: 'Test User',
231
+ email: 'test@example.com'
232
+ }));
233
+
234
+ tap.test('user test', async (tools) => {
235
+ const user = tools.fixture('testUser');
236
+ expect(user.name).toEqual('Test User');
237
+ });
238
+ ```
239
+
240
+ **Skipping and Todo Tests**
241
+ ```typescript
242
+ tap.skip.test('work in progress', async () => {
243
+ // This test will be skipped
244
+ });
245
+
246
+ tap.todo('implement user deletion', async () => {
247
+ // This marks a test as todo
248
+ });
249
+ ```
250
+
251
+ **Browser Testing**
252
+ ```typescript
253
+ // test.browser.ts
254
+ import { tap, webhelpers } from '@git.zone/tstest/tapbundle';
255
+
256
+ tap.test('DOM manipulation', async () => {
257
+ const element = await webhelpers.fixture(webhelpers.html`
258
+ <div>Hello World</div>
259
+ `);
260
+ expect(element).toBeInstanceOf(HTMLElement);
261
+ });
262
+ ```
263
+
150
264
  ## Advanced Features
151
265
 
152
266
  ### Glob Pattern Support
@@ -163,6 +277,8 @@ tstest "test/integration/*.test.ts"
163
277
  tstest "test/**/*.spec.ts" "test/**/*.test.ts"
164
278
  ```
165
279
 
280
+ **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.
281
+
166
282
  ### Automatic Logging
167
283
 
168
284
  Use `--logfile` to automatically save test output:
@@ -181,6 +297,26 @@ In verbose mode, see performance metrics:
181
297
  Slowest test: api integration test (486ms)
182
298
  ```
183
299
 
300
+ ### Parallel Test Groups
301
+
302
+ Tests can be organized into parallel groups for concurrent execution:
303
+
304
+ ```
305
+ ━━━ Parallel Group: para__1 ━━━
306
+ ▶️ test/auth.para__1.ts
307
+ ▶️ test/user.para__1.ts
308
+ ... tests run concurrently ...
309
+ ──────────────────────────────────
310
+
311
+ ━━━ Parallel Group: para__2 ━━━
312
+ ▶️ test/db.para__2.ts
313
+ ▶️ test/api.para__2.ts
314
+ ... tests run concurrently ...
315
+ ──────────────────────────────────
316
+ ```
317
+
318
+ Files with the same parallel group suffix (e.g., `para__1`) run simultaneously, while different groups run sequentially.
319
+
184
320
  ### CI/CD Integration
185
321
 
186
322
  For continuous integration, combine quiet and JSON modes:
@@ -192,6 +328,20 @@ tstest test/ --json > test-results.json
192
328
  tstest test/ --quiet
193
329
  ```
194
330
 
331
+ ## Changelog
332
+
333
+ ### Version 1.8.0
334
+ - 📦 Embedded tapbundle directly into tstest project
335
+ - 🌐 Made tapbundle fully browser-compatible
336
+ - 📸 Added snapshot testing with base64-encoded communication protocol
337
+ - 🏷️ Introduced tag-based test filtering
338
+ - 🔧 Enhanced test lifecycle hooks (beforeEach/afterEach)
339
+ - 🎯 Fixed parallel test execution and grouping
340
+ - ⏳ Improved timeout and retry mechanisms
341
+ - 🛠️ Added test fixtures for reusable test data
342
+ - 📊 Enhanced TAP parser for better test reporting
343
+ - 🐛 Fixed glob pattern handling in shell scripts
344
+
195
345
  ## Contribution
196
346
 
197
347
  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.9.0',
7
7
  description: 'a test utility to run tests that match test/**/*.ts'
8
8
  }