Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions global.d.ts

This file was deleted.

25 changes: 0 additions & 25 deletions jest.config.js

This file was deleted.

2,518 changes: 2,092 additions & 426 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,19 @@
},
"scripts": {
"eslint": "npx eslint .",
"test": "cd tests && ./gen-certs.sh && npx jest",
"test": "cd tests && ./gen-certs.sh && npx vitest",
"ts-compile": "npx tsc --noEmit",
"prepack": "rm -rf build && npx tsc -p ./tsconfig-build.json && npx ts-add-js-extension --dir=build"
},
"devDependencies": {
"@types/jest": "^29.5.13",
"@types/node": "^20.12.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.57.0",
"eslint-plugin-jest": "^27.9.0",
"jest": "^29.7.0",
"ts-add-js-extension": "^1.6.4",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
"typescript": "^5.6.2",
"vitest": "^3.0.8"
},
"files": [
"build"
Expand Down
14 changes: 7 additions & 7 deletions tests/arrayBlock.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it, vi } from 'vitest';

import * as de from '../lib' ;

import {
Expand All @@ -8,8 +10,6 @@ import {
getTimeout,
} from './helpers' ;

import { describe, it, expect, jest } from '@jest/globals';

// --------------------------------------------------------------------------------------------------------------- //

describe('de.array', () => {
Expand Down Expand Up @@ -273,12 +273,12 @@ describe('de.array', () => {
describe('cancel', () => {

it('cancel object, subblocks cancelled too #1', async() => {
const actionFooSpy = jest.fn();
const actionFooSpy = vi.fn();
const blockFoo = getResultBlock(null, 150, {
onCancel: actionFooSpy,
});

const actionBarSpy = jest.fn();
const actionBarSpy = vi.fn();
const blockBar = getResultBlock(null, 150, {
onCancel: actionBarSpy,
});
Expand Down Expand Up @@ -310,12 +310,12 @@ describe('de.array', () => {
});

it('cancel object, subblocks cancelled too #2', async() => {
const actionFooSpy = jest.fn();
const actionFooSpy = vi.fn();
const blockFoo = getResultBlock(null, 50, {
onCancel: actionFooSpy,
});

const actionBarSpy = jest.fn();
const actionBarSpy = vi.fn();
const blockBar = getResultBlock(null, 150, {
onCancel: actionBarSpy,
});
Expand Down Expand Up @@ -351,7 +351,7 @@ describe('de.array', () => {
const errorFoo = de.error('SOME_ERROR');
const blockFoo = getErrorBlock(errorFoo, 50);

const actionBarSpy = jest.fn();
const actionBarSpy = vi.fn();
const blockBar = getResultBlock(null, 150, {
onCancel: actionBarSpy,
});
Expand Down
2 changes: 2 additions & 0 deletions tests/cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

import * as de from '../lib';

import { waitForValue } from './helpers';
Expand Down
22 changes: 12 additions & 10 deletions tests/cancel.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it, vi } from 'vitest';

import * as de from '../lib';
// --------------------------------------------------------------------------------------------------------------- //

Expand All @@ -6,7 +8,7 @@ describe('de.Cancel', () => {
it('cancel', () => {
const cancel = new de.Cancel();

const spy = jest.fn();
const spy = vi.fn();
cancel.subscribe(spy);

const error = de.error('SOME_ERROR');
Expand All @@ -18,7 +20,7 @@ describe('de.Cancel', () => {
it('cancel with plain object', () => {
const cancel = new de.Cancel();

const spy = jest.fn();
const spy = vi.fn();
cancel.subscribe(spy);

const error = 'SOME_ERROR';
Expand All @@ -32,7 +34,7 @@ describe('de.Cancel', () => {
it('cancel after cancel', () => {
const cancel = new de.Cancel();

const spy = jest.fn();
const spy = vi.fn();
cancel.subscribe(spy);

const error1 = de.error('SOME_ERROR_1');
Expand All @@ -46,7 +48,7 @@ describe('de.Cancel', () => {
it('cancel after close', () => {
const cancel = new de.Cancel();

const spy = jest.fn();
const spy = vi.fn();
cancel.subscribe(spy);

cancel.close();
Expand Down Expand Up @@ -87,7 +89,7 @@ describe('de.Cancel', () => {

cancel.close();

const spy = jest.fn();
const spy = vi.fn();
cancel.subscribe(spy);

expect(spy.mock.calls).toHaveLength(0);
Expand All @@ -99,7 +101,7 @@ describe('de.Cancel', () => {
const error = de.error('SOME_ERROR');
cancel.cancel(error);

const spy = jest.fn();
const spy = vi.fn();
cancel.subscribe(spy);

expect(spy.mock.calls[ 0 ][ 0 ]).toBe(error);
Expand Down Expand Up @@ -149,7 +151,7 @@ describe('de.Cancel', () => {
const parentCancel = new de.Cancel();
const childCancel = parentCancel.create();

const spy = jest.fn();
const spy = vi.fn();
childCancel.subscribe(spy);

const error = de.error('SOME_ERROR');
Expand All @@ -163,7 +165,7 @@ describe('de.Cancel', () => {
parentCancel.close();
const childCancel = parentCancel.create();

const spy = jest.fn();
const spy = vi.fn();
childCancel.subscribe(spy);

const error = de.error('SOME_ERROR');
Expand All @@ -177,7 +179,7 @@ describe('de.Cancel', () => {
parentCancel.close();
const childCancel = parentCancel.create();

const spy = jest.fn();
const spy = vi.fn();
childCancel.subscribe(spy);

const error = de.error('SOME_ERROR');
Expand All @@ -193,7 +195,7 @@ describe('de.Cancel', () => {

const childCancel = parentCancel.create();

const spy = jest.fn();
const spy = vi.fn();
childCancel.subscribe(spy);

expect(spy.mock.calls[ 0 ][ 0 ]).toBe(error);
Expand Down
2 changes: 2 additions & 0 deletions tests/descript.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

import * as de from '../lib';

describe('descript', () => {
Expand Down
2 changes: 2 additions & 0 deletions tests/error.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

/* eslint-disable no-console */
/* eslint-disable jest/no-conditional-expect */

Expand Down
2 changes: 1 addition & 1 deletion tests/expect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { gunzipSync } from 'node:zlib' ;
import { expect } from '@jest/globals';
import { expect } from 'vitest';

expect.extend({
toBeValidGzip(received) {
Expand Down
12 changes: 7 additions & 5 deletions tests/firstBlock.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it, vi } from 'vitest';

/* eslint-disable jest/no-conditional-expect */

import * as de from '../lib';
Expand All @@ -6,7 +8,7 @@ describe('de.first', () => {

it('first block is successful', async() => {
let result1;
const spy1 = jest.fn<any, any>(() => {
const spy1 = vi.fn<(...args: Array<any>) => any>(() => {
result1 = {
a: 1,
};
Expand All @@ -16,7 +18,7 @@ describe('de.first', () => {
block: spy1,
});

const spy2 = jest.fn();
const spy2 = vi.fn();
const block2 = de.func({
block: spy2,
});
Expand All @@ -34,7 +36,7 @@ describe('de.first', () => {

it('first block throws', async() => {
let error1;
const spy1 = jest.fn(() => {
const spy1 = vi.fn(() => {
error1 = de.error({
id: 'ERROR',
});
Expand All @@ -45,7 +47,7 @@ describe('de.first', () => {
});

let result2;
const spy2 = jest.fn<any, any>(() => {
const spy2 = vi.fn<(...args: Array<any>) => any>(() => {
result2 = {
a: 1,
};
Expand All @@ -68,7 +70,7 @@ describe('de.first', () => {

it('second block throws', async() => {
let error1;
const spy1 = jest.fn(() => {
const spy1 = vi.fn(() => {
error1 = de.error({
id: 'ERROR',
});
Expand Down
2 changes: 2 additions & 0 deletions tests/functionBlock.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

import { getErrorBlock, getResultBlock, waitForValue } from './helpers';

import * as de from '../lib';
Expand Down
Loading
Loading