feat(core): Implement Protocol V2 with enhanced settings and lifecycle hooks
This commit is contained in:
56
test/tapbundle/test.diff-demo.ts
Normal file
56
test/tapbundle/test.diff-demo.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { tap, expect } from '../../ts_tapbundle/index.js';
|
||||
|
||||
tap.test('should show string diff', async () => {
|
||||
const expected = `Hello World
|
||||
This is a test
|
||||
of multiline strings`;
|
||||
|
||||
const actual = `Hello World
|
||||
This is a demo
|
||||
of multiline strings`;
|
||||
|
||||
// This will fail and show a diff
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
tap.test('should show object diff', async () => {
|
||||
const expected = {
|
||||
name: 'John',
|
||||
age: 30,
|
||||
city: 'New York',
|
||||
hobbies: ['reading', 'coding']
|
||||
};
|
||||
|
||||
const actual = {
|
||||
name: 'John',
|
||||
age: 31,
|
||||
city: 'Boston',
|
||||
hobbies: ['reading', 'gaming']
|
||||
};
|
||||
|
||||
// This will fail and show a diff
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
tap.test('should show array diff', async () => {
|
||||
const expected = [1, 2, 3, 4, 5];
|
||||
const actual = [1, 2, 3, 5, 6];
|
||||
|
||||
// This will fail and show a diff
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
tap.test('should show primitive diff', async () => {
|
||||
const expected = 42;
|
||||
const actual = 43;
|
||||
|
||||
// This will fail and show a diff
|
||||
expect(actual).toBe(expected);
|
||||
});
|
||||
|
||||
tap.test('should pass without diff', async () => {
|
||||
expect(true).toBe(true);
|
||||
expect('hello').toEqual('hello');
|
||||
});
|
||||
|
||||
tap.start({ throwOnError: false });
|
23
test/tapbundle/test.simple-diff.ts
Normal file
23
test/tapbundle/test.simple-diff.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { tap, expect } from '../../ts_tapbundle/index.js';
|
||||
|
||||
tap.test('should show string diff', async () => {
|
||||
const expected = `line 1
|
||||
line 2
|
||||
line 3`;
|
||||
|
||||
const actual = `line 1
|
||||
line changed
|
||||
line 3`;
|
||||
|
||||
try {
|
||||
expect(actual).toEqual(expected);
|
||||
} catch (e) {
|
||||
// Expected to fail
|
||||
}
|
||||
});
|
||||
|
||||
tap.test('should pass', async () => {
|
||||
expect('hello').toEqual('hello');
|
||||
});
|
||||
|
||||
tap.start({ throwOnError: false });
|
Reference in New Issue
Block a user