Compare commits

...

2 Commits

8 changed files with 19 additions and 9 deletions

View File

@@ -1,5 +1,12 @@
# Changelog # Changelog
## 2026-01-25 - 3.1.8 - fix(tapbundle)
treat tests that call tools.allowFailure() as passing and update tests to use tools parameter
- Set testResult.ok to this.failureAllowed so allowed failures are considered passing in the tap test runner implementation (ts_tapbundle/tapbundle.classes.taptest.ts).
- Updated multiple tests to accept the tools parameter and call tools.allowFailure() where failures are intended (test/tapbundle/test.performance-metrics.ts, test/tstest/test.fail.ts, test/tstest/test.failing-with-logs.ts).
- Prevents intentionally-failing tests from skewing timing/metric calculations and preserves console logs for allowed failures.
## 2026-01-25 - 3.1.7 - fix(tap-parser) ## 2026-01-25 - 3.1.7 - fix(tap-parser)
append newline to WebSocket tap log messages to ensure proper line-by-line processing append newline to WebSocket tap log messages to ensure proper line-by-line processing

View File

@@ -9,5 +9,5 @@
"target": "ES2022" "target": "ES2022"
}, },
"nodeModulesDir": true, "nodeModulesDir": true,
"version": "3.1.7" "version": "3.1.8"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@git.zone/tstest", "name": "@git.zone/tstest",
"version": "3.1.7", "version": "3.1.8",
"private": false, "private": false,
"description": "a test utility to run tests that match test/**/*.ts", "description": "a test utility to run tests that match test/**/*.ts",
"exports": { "exports": {

View File

@@ -47,6 +47,7 @@ tap.test('metric test fast 3 - minimal work', async () => {
// Test to verify that failed tests still contribute to timing metrics // Test to verify that failed tests still contribute to timing metrics
tap.test('metric test that fails - 60ms before failure', async (tools) => { tap.test('metric test that fails - 60ms before failure', async (tools) => {
tools.allowFailure();
await tools.delayFor(60); await tools.delayFor(60);
expect(true).toBeFalse(); // This will fail expect(true).toBeFalse(); // This will fail
}); });

View File

@@ -1,6 +1,7 @@
import { expect, tap } from '../../ts_tapbundle/index.js'; import { expect, tap } from '../../ts_tapbundle/index.js';
tap.test('This test should fail', async () => { tap.test('This test should fail', async (tools) => {
tools.allowFailure();
console.log('This test will fail on purpose'); console.log('This test will fail on purpose');
expect(true).toBeFalse(); expect(true).toBeFalse();
}); });

View File

@@ -1,16 +1,17 @@
import { expect, tap } from '../../ts_tapbundle/index.js'; import { expect, tap } from '../../ts_tapbundle/index.js';
tap.test('Test that will fail with console logs', async () => { tap.test('Test that will fail with console logs', async (tools) => {
tools.allowFailure();
console.log('Starting the test...'); console.log('Starting the test...');
console.log('Doing some setup work'); console.log('Doing some setup work');
console.log('About to check assertion'); console.log('About to check assertion');
const value = 42; const value = 42;
console.log(`The value is: ${value}`); console.log(`The value is: ${value}`);
// This will fail // This will fail
expect(value).toEqual(100); expect(value).toEqual(100);
console.log('This log will not be reached'); console.log('This log will not be reached');
}); });

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tstest', name: '@git.zone/tstest',
version: '3.1.7', version: '3.1.8',
description: 'a test utility to run tests that match test/**/*.ts' description: 'a test utility to run tests that match test/**/*.ts'
} }

View File

@@ -261,7 +261,7 @@ export class TapTest<T = unknown> {
// Final failure // Final failure
const testResult = { const testResult = {
ok: false, ok: this.failureAllowed, // Pass if failure is allowed
testNumber, testNumber,
description: this.description, description: this.description,
metadata: { metadata: {