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
10,469 changes: 3,120 additions & 7,349 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"core-js-pure": "^3.38.1",
"expect": "^29.7.0",
"mocha": "^10.7.3",
"resolve-cwd": "^3.0.0",
"sinon": "^19.0.2"
},
"dependencies": {
Expand Down
40 changes: 0 additions & 40 deletions packages/iter-fest/jest.config.json

This file was deleted.

10 changes: 3 additions & 7 deletions packages/iter-fest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@
"prepack": "cp ../../CHANGELOG.md . && cp ../../LICENSE . && cp ../../README.md .",
"start": "npm run build -- --onSuccess \"touch ../pages/package.json\" --watch",
"switch": "cat package.json | jq --arg SWITCH_NAME $SWITCH_NAME -r '(.[\"switch:\" + $SWITCH_NAME] // {}) as $TEMPLATE | .devDependencies += ($TEMPLATE.devDependencies // {}) | .dependencies += ($TEMPLATE.dependencies // {})' | tee ./package.json.tmp && mv ./package.json.tmp ./package.json",
"test": "jest"
"test": "node --test ${CI:---watch} **/*.{spec,test}.{[jt]s,[jt]sx,c[jt]s,m[jt]s}"
},
"repository": {
"type": "git",
Expand All @@ -564,17 +564,13 @@
"core-js-pure": "^3.37.1"
},
"devDependencies": {
"@babel/preset-env": "^7.25.8",
"@babel/preset-typescript": "^7.25.7",
"@testing-library/react": "^16.0.1",
"@tsconfig/recommended": "^1.0.7",
"@tsconfig/strictest": "^2.0.5",
"@types/jest": "^29.5.13",
"@types/node": "^22.7.5",
"core-js-pure": "^3.38.1",
"esbuild": "^0.25.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"expect": "^30.2.0",
"jest-mock": "^30.2.0",
"prettier": "^3.3.3",
"publint": "^0.2.11",
"tsup": "^8.3.5",
Expand Down
25 changes: 14 additions & 11 deletions packages/iter-fest/src/Observable.fromOf.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { expect } from 'expect';
import { fn, type Mock } from 'jest-mock';
import { beforeEach, describe, test } from 'node:test';
import {
Observable,
type CompleteFunction,
Expand All @@ -7,22 +10,22 @@ import {
type StartFunction,
type Subscription
} from './Observable.ts';
import { type JestMockOf } from './private/JestMockOf.js';
import { describeEach } from './private/describeEach.ts';

describe('comprehensive', () => {
let complete: JestMockOf<CompleteFunction>;
let error: JestMockOf<ErrorFunction>;
let next: JestMockOf<NextFunction<number>>;
let start: JestMockOf<StartFunction>;
let complete: Mock<CompleteFunction>;
let error: Mock<ErrorFunction>;
let next: Mock<NextFunction<number>>;
let start: Mock<StartFunction>;

beforeEach(() => {
complete = jest.fn();
error = jest.fn();
next = jest.fn();
start = jest.fn();
complete = fn();
error = fn();
next = fn();
start = fn();
});

describe.each([['from' as const], ['of' as const]])('Observable.%s()', type => {
describeEach([['from' as const], ['of' as const]])('Observable.%s()', type => {
let observable: Observable<number>;

beforeEach(() => {
Expand All @@ -33,7 +36,7 @@ describe('comprehensive', () => {
}
});

describe.each([['interface' as const], ['functions' as const]])('subscribe via %s', type => {
describeEach([['interface' as const], ['functions' as const]])('subscribe via %s', type => {
let subscription: Subscription;

beforeEach(() => {
Expand Down
31 changes: 17 additions & 14 deletions packages/iter-fest/src/Observable.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { expect } from 'expect';
import { fn, type Mock } from 'jest-mock';
import { beforeEach, describe, test } from 'node:test';
import {
Observable,
type CompleteFunction,
Expand All @@ -9,30 +12,30 @@ import {
type Subscription
} from './Observable.ts';
import { SymbolObservable } from './SymbolObservable.ts';
import { type JestMockOf } from './private/JestMockOf.ts';
import { describeEach } from './private/describeEach.ts';

describe('comprehensive', () => {
let complete: JestMockOf<CompleteFunction>;
let error: JestMockOf<ErrorFunction>;
let next: JestMockOf<NextFunction<number>>;
let complete: Mock<CompleteFunction>;
let error: Mock<ErrorFunction>;
let next: Mock<NextFunction<number>>;
let observable: Observable<number>;
let start: JestMockOf<StartFunction>;
let subscriberFunction: JestMockOf<SubscriberFunction<number>>;
let closeSubscription: JestMockOf<() => void>;
let start: Mock<StartFunction>;
let subscriberFunction: Mock<SubscriberFunction<number>>;
let closeSubscription: Mock<() => void>;

beforeEach(() => {
closeSubscription = jest.fn();
complete = jest.fn();
error = jest.fn();
next = jest.fn();
start = jest.fn();
subscriberFunction = jest.fn();
closeSubscription = fn();
complete = fn();
error = fn();
next = fn();
start = fn();
subscriberFunction = fn();
subscriberFunction.mockImplementation(() => closeSubscription);

observable = new Observable<number>(subscriberFunction);
});

describe.each([['interface' as const], ['functions' as const]])('subscribe via %s', type => {
describeEach([['interface' as const], ['functions' as const]])('subscribe via %s', type => {
let subscription: Subscription;

beforeEach(() => {
Expand Down
15 changes: 9 additions & 6 deletions packages/iter-fest/src/asyncGeneratorWithLastValue.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { asyncGeneratorWithLastValue, type AsyncGeneratorWithLastValue } from './asyncGeneratorWithLastValue';
import { expect } from 'expect';
import { fn } from 'jest-mock';
import { beforeEach, describe, test } from 'node:test';
import { asyncGeneratorWithLastValue, type AsyncGeneratorWithLastValue } from './asyncGeneratorWithLastValue.ts';

test('usage', async () => {
const generator = asyncGeneratorWithLastValue<number, 'end', void>(
Expand Down Expand Up @@ -83,7 +86,7 @@ describe('comprehensive', () => {
});

test('passthrough next', async () => {
const next = jest.fn<void, [boolean]>();
const next = fn<(value: boolean) => void>();

const generator = asyncGeneratorWithLastValue<number, void, boolean>(
(async function* () {
Expand All @@ -105,7 +108,7 @@ test('passthrough next', async () => {
});

test('passthrough return', async () => {
const shouldNotCall = jest.fn<void, []>();
const shouldNotCall = fn<() => void>();

const generator = asyncGeneratorWithLastValue<number, boolean, unknown>(
(async function* () {
Expand All @@ -131,8 +134,8 @@ test('passthrough return', async () => {
});

test('passthrough throw', async () => {
const throw_ = jest.fn<void, [unknown]>();
const shouldNotCall = jest.fn<void, []>();
const throw_ = fn<(reason: unknown) => void>();
const shouldNotCall = fn<() => void>();

const generator = asyncGeneratorWithLastValue(
(async function* () {
Expand Down Expand Up @@ -193,7 +196,7 @@ test('return in try-finally', async () => {
});

test('passthrough asyncDispose', async () => {
const dispose = jest.fn();
const dispose = fn<() => PromiseLike<void>>();
const symbolAsyncDispose: typeof Symbol.asyncDispose = Symbol.asyncDispose || Symbol.for('Symbol.asyncDispose');

const generator = (async function* () {})();
Expand Down
4 changes: 3 additions & 1 deletion packages/iter-fest/src/asyncIteratorDrop.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { asyncIteratorDrop } from './asyncIteratorDrop';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorDrop } from './asyncIteratorDrop.ts';

test('should follow TC39 proposal sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
6 changes: 4 additions & 2 deletions packages/iter-fest/src/asyncIteratorEvery.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { asyncIteratorEvery } from './asyncIteratorEvery';
import { asyncIteratorTake } from './asyncIteratorTake';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorEvery } from './asyncIteratorEvery.ts';
import { asyncIteratorTake } from './asyncIteratorTake.ts';

test('should work with TC39 sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
4 changes: 3 additions & 1 deletion packages/iter-fest/src/asyncIteratorFilter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { asyncIteratorFilter } from './asyncIteratorFilter';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorFilter } from './asyncIteratorFilter.ts';

test('should work with TC39 sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
4 changes: 3 additions & 1 deletion packages/iter-fest/src/asyncIteratorFind.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { asyncIteratorFind } from './asyncIteratorFind';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorFind } from './asyncIteratorFind.ts';

test('should work with TC39 sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
6 changes: 4 additions & 2 deletions packages/iter-fest/src/asyncIteratorFlatMap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { asyncIteratorFlatMap } from './asyncIteratorFlatMap';
import { iteratorToAsync } from './iteratorToAsync';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorFlatMap } from './asyncIteratorFlatMap.ts';
import { iteratorToAsync } from './iteratorToAsync.ts';

test('should follow TC39 proposal sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
6 changes: 4 additions & 2 deletions packages/iter-fest/src/asyncIteratorForEach.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { asyncIteratorForEach } from './asyncIteratorForEach';
import { iteratorToAsync } from './iteratorToAsync';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorForEach } from './asyncIteratorForEach.ts';
import { iteratorToAsync } from './iteratorToAsync.ts';

test('should work with TC39 sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
4 changes: 3 additions & 1 deletion packages/iter-fest/src/asyncIteratorFrom.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { asyncIteratorFrom } from './asyncIteratorFrom';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorFrom } from './asyncIteratorFrom.ts';

test('should follow TC39 proposal sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
4 changes: 3 additions & 1 deletion packages/iter-fest/src/asyncIteratorMap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { asyncIteratorMap } from './asyncIteratorMap';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorMap } from './asyncIteratorMap.ts';

test('should work with TC39 sample (from sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
6 changes: 4 additions & 2 deletions packages/iter-fest/src/asyncIteratorReduce.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { asyncIteratorReduce } from './asyncIteratorReduce';
import { asyncIteratorTake } from './asyncIteratorTake';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorReduce } from './asyncIteratorReduce.ts';
import { asyncIteratorTake } from './asyncIteratorTake.ts';

test('should work with TC39 sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
6 changes: 4 additions & 2 deletions packages/iter-fest/src/asyncIteratorSome.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { asyncIteratorSome } from './asyncIteratorSome';
import { asyncIteratorTake } from './asyncIteratorTake';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorSome } from './asyncIteratorSome.ts';
import { asyncIteratorTake } from './asyncIteratorTake.ts';

test('should work with TC39 sample', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
4 changes: 3 additions & 1 deletion packages/iter-fest/src/asyncIteratorTake.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { asyncIteratorTake } from './asyncIteratorTake';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorTake } from './asyncIteratorTake.ts';

test('should follow TC39 proposal sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
6 changes: 4 additions & 2 deletions packages/iter-fest/src/asyncIteratorToArray.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { asyncIteratorTake } from './asyncIteratorTake';
import { asyncIteratorToArray } from './asyncIteratorToArray';
import { expect } from 'expect';
import { test } from 'node:test';
import { asyncIteratorTake } from './asyncIteratorTake.ts';
import { asyncIteratorToArray } from './asyncIteratorToArray.ts';

test('should follow TC39 proposal sample (sync)', async () => {
// Copied from https://github.com/tc39/proposal-iterator-helpers.
Expand Down
4 changes: 3 additions & 1 deletion packages/iter-fest/src/asyncIteratorToAsyncIterable.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { asyncIteratorToAsyncIterable } from './asyncIteratorToAsyncIterable';
import { expect } from 'expect';
import { beforeEach, describe, test } from 'node:test';
import { asyncIteratorToAsyncIterable } from './asyncIteratorToAsyncIterable.ts';

describe('passing an async iterator-compatible generator', () => {
let asyncIterable: AsyncIterableIterator<number>;
Expand Down
13 changes: 8 additions & 5 deletions packages/iter-fest/src/generatorWithLastValue.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { generatorWithLastValue, type GeneratorWithLastValue } from './generatorWithLastValue';
import { expect } from 'expect';
import { fn } from 'jest-mock';
import { beforeEach, describe, test } from 'node:test';
import { generatorWithLastValue, type GeneratorWithLastValue } from './generatorWithLastValue.ts';

test('usage', () => {
const generator = generatorWithLastValue<number, 'end', void>(
Expand Down Expand Up @@ -77,7 +80,7 @@ describe('comprehensive', () => {
});

test('passthrough next', () => {
const next = jest.fn<void, [boolean]>();
const next = fn<(value: boolean) => void>();

const generator = generatorWithLastValue<number, void, boolean>(
(function* () {
Expand All @@ -95,7 +98,7 @@ test('passthrough next', () => {
});

test('passthrough return', () => {
const shouldNotCall = jest.fn<void, []>();
const shouldNotCall = fn<() => void>();

const generator = generatorWithLastValue<number, boolean, unknown>(
(function* () {
Expand All @@ -114,8 +117,8 @@ test('passthrough return', () => {
});

test('passthrough throw', () => {
const throw_ = jest.fn<void, [unknown]>();
const shouldNotCall = jest.fn<void, []>();
const throw_ = fn<(error: unknown) => void>();
const shouldNotCall = fn<() => void>();

const generator = generatorWithLastValue(
(function* () {
Expand Down
10 changes: 6 additions & 4 deletions packages/iter-fest/src/iterableWritableStream.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { IterableWritableStream } from './iterableWritableStream';
import { type JestMockOf } from './private/JestMockOf';
import { expect } from 'expect';
import { fn, type Mock } from 'jest-mock';
import { beforeEach, describe, test } from 'node:test';
import { IterableWritableStream } from './iterableWritableStream.ts';

describe('comprehensive', () => {
let done: JestMockOf<() => void>;
let done: Mock<() => void>;
let values: number[];
let writer: WritableStreamDefaultWriter<number>;

beforeEach(() => {
done = jest.fn();
done = fn();

const iterable = new IterableWritableStream<number>();

Expand Down
Loading