Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c0129d3
Add task to generate v4 importmap and update dependencies
Oct 18, 2025
2f89e28
convert fx to effection v4
jbolda Apr 21, 2025
0096f66
remove outer spawn, not required
jbolda Apr 22, 2025
1f44ad1
Fix dependency in worker/deno.json
Oct 18, 2025
ee0d69b
Include all dependencies in import map
Oct 18, 2025
507f714
Fixed eventemitter test by wrapping event in spawn
Oct 18, 2025
9eb8cba
Give the operation tree 1 tick to setup a subscription before sending…
Oct 18, 2025
5c8ea64
Run timers asyncronously in task-buffer tests
Oct 18, 2025
6d62852
Wrap arrary operations in a spawn in array tests
Oct 18, 2025
e6b6d3c
Wrapped boolean operations in spawn in boolean tests
Oct 18, 2025
6264ccf
Fixed array test by giving the operation tree a tick in array tests
Oct 19, 2025
4c64991
Check for boolean.test.ts updates differently
Oct 19, 2025
f6a8194
Fixed is helper test by giving it 1 tick to setup the operation tree
Oct 19, 2025
355a3e7
Fixed faucet tests by waiting 1 tick for operation tree and convergin…
Oct 19, 2025
24e4ee5
Update generate-importmap to use actual package exports
Oct 19, 2025
32b6312
Fix stream-helpers for effection v4 and remove debug logging
Oct 19, 2025
783d30b
Fix batch stream completion when lastPull times out
Oct 19, 2025
ae1d163
Run v3 and v4 tests
Oct 19, 2025
8c9cd58
Made generate importmap windows compatible
Oct 19, 2025
7353342
remove second loop
cowboyd Oct 20, 2025
770feb3
s/sleep(1)/sleep(0)/
cowboyd Oct 20, 2025
72ed749
Make the sleeps for v3 compat, not v4 compat
cowboyd Oct 20, 2025
b8419eb
Fixed paths in generate importmap script
Oct 28, 2025
ad14a45
Fix formatting
Oct 29, 2025
2f29b4b
Let's have an assertion in 'ignores files in .gitignore' test
Oct 29, 2025
25d8561
Simplify the batch test to remove timing ambiguity
taras Nov 2, 2025
e7af7ce
Make raf test a bit looser
taras Nov 2, 2025
845616f
Removed unnecessary sleep
taras Nov 2, 2025
4aed49e
Fix lint
taras Nov 2, 2025
f1fc2b3
Override effection dependency to v3 & v4
Nov 2, 2025
df2ee37
Try commenting out waiting for operation to complete
Nov 2, 2025
8100215
Refactor inspector into a resource
Nov 3, 2025
994550b
Fix lint
Nov 5, 2025
bc5ed01
convert process to resource
cowboyd Nov 5, 2025
73cb39b
Add sanitization options to test functions
Dec 8, 2025
2597d12
Update test to disable sanitization options for operations and resources
Dec 8, 2025
f8d97b5
Refactor GitHub Actions workflows to use workflow_call for POSIX and …
Dec 8, 2025
c616703
Enhance generate-importmap task to fetch the latest v4 version of eff…
Dec 8, 2025
c306e05
Add testing instructions for compatibility with effection v3 and v4 i…
Dec 8, 2025
7733a58
Update package versions and effection dependency in various modules
Dec 8, 2025
5d5b801
Update README.md to provide comprehensive documentation on process ma…
Dec 8, 2025
6b8458b
Update @effectionx/bdd and related dependencies to version 0.3.0 acro…
Dec 8, 2025
0bdeb12
Update dependencies to use workspace references for @effectionx/bdd, …
Dec 8, 2025
da8cd73
Revert "Update dependencies to use workspace references for @effectio…
Dec 8, 2025
53bd33c
Enhance generate-importmap task to support version argument parsing a…
Dec 8, 2025
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: 10 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ on:
- main

jobs:
verify-posix:
uses: ./.github/workflows/verify-posix.yaml

verify-windows:
uses: ./.github/workflows/verify-windows.yaml

generate-matrix:
needs: [verify-posix, verify-windows]
name: Generate Job Matrix
runs-on: ubuntu-latest
outputs:
Expand All @@ -23,7 +30,7 @@ jobs:
id: set-matrix

jsr:
if: fromJSON(needs.generate-matrix.outputs.exists)
if: github.ref == 'refs/heads/main' && fromJSON(needs.generate-matrix.outputs.exists)
name: Publish ${{ matrix.name }}@${{matrix.version}} to JSR
runs-on: ubuntu-latest

Expand All @@ -46,7 +53,7 @@ jobs:
working-directory: ${{ matrix.workspace }}

npm:
if: fromJSON(needs.generate-matrix.outputs.exists)
if: github.ref == 'refs/heads/main' && fromJSON(needs.generate-matrix.outputs.exists)
name: Publish ${{ matrix.name }}@${{matrix.version}} to NPM
runs-on: ubuntu-latest

Expand Down Expand Up @@ -77,7 +84,7 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

tag:
if: fromJSON(needs.generate-matrix.outputs.exists)
if: github.ref == 'refs/heads/main' && fromJSON(needs.generate-matrix.outputs.exists)
name: "Tag Release"
runs-on: ubuntu-latest
needs: [generate-matrix, jsr, npm]
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/verify-posix.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Verify (POSIX)

on:
push:
branches:
- main
workflow_call:
pull_request:
branches:
- main
Expand Down Expand Up @@ -34,5 +32,11 @@ jobs:
- run: deno fmt --check

- run: deno lint
- run: deno task generate-importmap "^3" v3.importmap.json
- run: deno task generate-importmap v4 v4.importmap.json

- name: V3 Tests
run: deno test --import-map v3.importmap.json --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi

- run: deno test --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi
- name: V4 Tests
run: deno test --import-map v4.importmap.json --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks
37 changes: 28 additions & 9 deletions .github/workflows/verify-windows.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Verify (Windows)

on:
push:
branches:
- main
workflow_call:
pull_request:
branches:
- main
Expand Down Expand Up @@ -41,20 +39,41 @@ jobs:

- run: deno lint

- name: "Test (${{matrix.shell}})"
- run: deno task generate-importmap "^3" v3.importmap.json
- run: deno task generate-importmap v4 v4.importmap.json

- name: "Test V3 (${{matrix.shell}})"
if: matrix.shell == 'powershell' || matrix.shell == 'pwsh'
run: |
$env:SHELL = "${{matrix.shell}}"
deno test --import-map v3.importmap.json --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks

- name: "Test V4 (${{matrix.shell}})"
if: matrix.shell == 'powershell' || matrix.shell == 'pwsh'
run: |
$env:SHELL = "${{matrix.shell}}"
deno test --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks
deno test --import-map v4.importmap.json --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks

- name: "Test (${{matrix.shell}})"
- name: "Test V3 (${{matrix.shell}})"
if: matrix.shell == 'cmd'
run: |
set SHELL=${{matrix.shell}}
deno test --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks
deno test --import-map v3.importmap.json --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks

- name: "Test V4 (${{matrix.shell}})"
if: matrix.shell == 'cmd'
run: |
set SHELL=${{matrix.shell}}
deno test --import-map v4.importmap.json --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks

- name: "Test V3 (${{matrix.shell}})"
if: matrix.shell == 'bash'
run: |
export SHELL=${{matrix.shell}}
deno test --import-map v3.importmap.json --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks

- name: "Test (${{matrix.shell}})"
- name: "Test V4 (${{matrix.shell}})"
if: matrix.shell == 'bash'
run: |
export SHELL=${{matrix.shell}}
deno test --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks
deno test --import-map v4.importmap.json --allow-net --allow-read --allow-write --allow-env --allow-run --allow-ffi --trace-leaks
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/deno.lock
/**/build/
/v3.importmap.json
/v4.importmap.json

.vscode
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,33 @@ more than a few times are welcome.
5. Add doc strings to your source code - they will be used for documentation on
the site.

## Testing

All packages are tested against both effection v3 and v4 to ensure
compatibility.

### Generate import maps

```bash
# Generate v3 import map
deno task generate-importmap "^3" v3.importmap.json

# Generate v4 import map (fetches latest v4 from npm)
deno task generate-importmap v4 v4.importmap.json
```

### Running tests with v3

```bash
deno test --import-map v3.importmap.json -A
```

### Running tests with v4

```bash
deno test --import-map v4.importmap.json -A
```

## To publish a new project

1. Member of [jsr.io/@effectionx](https://jsr.io/@effectionx) has to add that
Expand Down
4 changes: 2 additions & 2 deletions bdd/deno.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@effectionx/bdd",
"exports": "./mod.ts",
"version": "0.2.2",
"version": "0.3.0",
"license": "MIT",
"imports": {
"effection": "npm:effection@^3",
"@effectionx/test-adapter": "jsr:@effectionx/test-adapter@^0.1.0",
"@effectionx/test-adapter": "jsr:@effectionx/test-adapter@^0.5.1",
"@std/testing": "jsr:@std/testing@^1"
}
}
91 changes: 74 additions & 17 deletions bdd/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,65 @@ import {
it as $it,
} from "@std/testing/bdd";

/**
* Sanitization options for test cases and test suites.
* These options control Deno's test sanitizers.
*/
export interface SanitizeOptions {
/** Ensure the test case does not prematurely cause the process to exit. Defaults to true. */
sanitizeExit?: boolean;
/** Check that the number of async completed ops after the test is the same as number of dispatched ops. Defaults to true. */
sanitizeOps?: boolean;
/** Ensure the test case does not "leak" resources - ie. the resource table after the test has exactly the same contents as before the test. Defaults to true. */
sanitizeResources?: boolean;
}

let current: TestAdapter | undefined;

export function describe(name: string, body: () => void) {
export function describe(
name: string,
body: () => void,
options?: SanitizeOptions,
) {
const original = current;
try {
const child = current = createTestAdapter({ name, parent: original });

$describe(name, () => {
$afterAll(() => child.destroy());
body();
$describe({
name,
fn: () => {
$afterAll(() => child.destroy());
body();
},
...options,
});
} finally {
current = original;
}
}

describe.skip = $describe.skip;
describe.only = $describe.only;
describe.only = function (
name: string,
body: () => void,
options?: SanitizeOptions,
): void {
const original = current;
try {
const child = current = createTestAdapter({ name, parent: original });

$describe.only({
name,
fn: () => {
$afterAll(() => child.destroy());
body();
},
...options,
});
} finally {
current = original;
}
};

export function beforeAll(body: () => Operation<void>) {
current?.addOnetimeSetup(body);
Expand All @@ -33,17 +74,25 @@ export function beforeEach(body: () => Operation<void>) {
current?.addSetup(body);
}

export function it(desc: string, body?: () => Operation<void>): void {
export function it(
desc: string,
body?: () => Operation<void>,
options?: SanitizeOptions,
): void {
const adapter = current!;
if (!body) {
$it.skip(desc, () => {});
return;
}
$it(desc, async () => {
const result = await adapter.runTest(body);
if (!result.ok) {
throw result.error;
}
$it({
name: desc,
fn: async () => {
const result = await adapter.runTest(body);
if (!result.ok) {
throw result.error;
}
},
...options,
});
}

Expand All @@ -52,12 +101,20 @@ it.skip = (...args: Parameters<typeof it>): ReturnType<typeof it> => {
return $it.skip(desc, () => {});
};

it.only = (desc: string, body: () => Operation<void>): void => {
it.only = (
desc: string,
body: () => Operation<void>,
options?: SanitizeOptions,
): void => {
const adapter = current!;
$it.only(desc, async () => {
const result = await adapter.runTest(body);
if (!result.ok) {
throw result.error;
}
$it.only({
name: desc,
fn: async () => {
const result = await adapter.runTest(body);
if (!result.ok) {
throw result.error;
}
},
...options,
});
};
2 changes: 1 addition & 1 deletion context-api/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effectionx/context-api",
"version": "0.1.0",
"version": "0.2.0",
"license": "MIT",
"exports": "./mod.ts",
"imports": {
Expand Down
2 changes: 1 addition & 1 deletion deno-deploy/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effectionx/deno-deploy",
"version": "0.2.0",
"version": "0.3.0",
"exports": "./mod.ts",
"license": "MIT",
"imports": {
Expand Down
13 changes: 10 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"effection": "npm:effection@^3",
"@deno/dnt": "jsr:@deno/dnt@0.42.3",
"@std/path": "jsr:@std/path@^1",
"zod": "npm:zod@3.23.8"
"zod": "npm:zod@3.23.8",
"@std/fs": "jsr:@std/fs@^1"
},
"compilerOptions": {
"lib": [
Expand All @@ -20,7 +21,10 @@
"prefer-const",
"require-yield"
]
}
},
"exclude": [
"tasks"
]
},
"workspace": [
"./context-api",
Expand All @@ -39,5 +43,8 @@
"./stream-helpers",
"./signals",
"./process"
]
],
"tasks": {
"generate-importmap": "deno run --allow-read --allow-write --allow-net tasks/generate-importmap.ts"
}
}
2 changes: 1 addition & 1 deletion fx/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effectionx/fx",
"version": "0.2.0",
"version": "0.3.0",
"exports": "./mod.ts",
"license": "MIT",
"imports": {
Expand Down
10 changes: 7 additions & 3 deletions fx/parallel.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it } from "@effectionx/bdd";
import { expect } from "@std/expect";
import { each, Err, Ok, sleep, spawn } from "effection";
import { each, Err, Ok, sleep, spawn, until } from "effection";

import { parallel } from "./parallel.ts";

Expand Down Expand Up @@ -101,7 +101,8 @@ describe("parallel()", () => {
yield* sleep(15);
two.resolve(2);
});
const results = yield* parallel([one, () => two.promise]);

const results = yield* parallel([one, () => until(two.promise)]);
expect(yield* results).toEqual([Ok(1), Ok(2)]);
});

Expand All @@ -112,7 +113,10 @@ describe("parallel()", () => {

function* genFn() {
try {
const results = yield* parallel([() => one.promise, () => two.promise]);
const results = yield* parallel([
() => until(one.promise),
() => until(two.promise),
]);
actual = yield* results;
} catch (_) {
actual = [Err(new Error("should not get hit"))];
Expand Down
Loading