Skip to content

Conversation

@taras
Copy link
Member

@taras taras commented Dec 11, 2025

Motivation

Add Node.js support to the effectionx repository, starting with the @effectionx/bdd package. This enables running tests and using effectionx packages in Node.js environments alongside the existing Deno support.

Approach

Node.js Support for BDD Package

  • Create bdd.ts with shared createBDD factory function that abstracts over platform-specific test runners
  • Add mod.deno.ts for Deno (uses @std/testing/bdd)
  • Add mod.node.ts for Node.js (uses node:test)
  • Add package.json with conditional exports (denomod.deno.ts, nodemod.node.ts)

npm Workspace Configuration

  • Add root package.json with npm workspaces for bdd and test-adapter
  • Add test-adapter/package.json for dependency resolution
  • Add node_modules/ and package-lock.json to .gitignore

CI Testing

  • Add verify-node.yaml workflow for Node.js testing on Node 20/22 across ubuntu/macos
  • Each package with Node support has its own test script in package.json
  • Root npm test runs npm test --workspaces --if-present

Documentation

  • Update README with Node.js testing instructions and how to add Node.js support to new packages

- Extract shared BDD logic into bdd.ts with createBDD factory function
- Add mod.deno.ts for Deno with SanitizeOptions support
- Add mod.node.ts for Node.js using node:test
- Add package.json with conditional exports for Node/Deno
- Update deno.json to export mod.deno.ts
- Add root package.json with npm workspaces for bdd and test-adapter
- Add test-adapter/package.json for Node.js resolution
- Update bdd/package.json to use npm-compatible dependency syntax
- Add node_modules and package-lock.json to .gitignore
- Add verify-node.yaml workflow for Node.js CI on ubuntu/macos with Node 20/22
- Add bdd/bdd.test.ts for testing the BDD package
- Add test scripts using npm workspaces (npm test --workspaces --if-present)
- Update README with Node.js testing documentation
@taras taras force-pushed the tm/bdd-node-support branch 4 times, most recently from 3d88e7d to 8bbaa44 Compare December 11, 2025 02:08
- Add nodeModulesDir: "none" to deno.json to prevent Deno from
  using node_modules when package.json is present
- Add pnpm-workspace.yaml for pnpm workspace configuration
- Add package.json with Volta pinned versions and packageManager field
- Update bdd/package.json to use workspace:* for local deps
- Update CI to use pnpm/action-setup and actions/setup-node
- Update README with Volta installation instructions
@taras taras force-pushed the tm/bdd-node-support branch from 8bbaa44 to b1a80ab Compare December 11, 2025 02:11
- Add explicit type imports for node:http (IncomingMessage, ServerResponse)
- Add custom FSWatcherWithEvents interface to properly type chokidar watcher
  with EventEmitter methods that aren't exposed in the base type

These explicit types ensure consistent type checking across different
Deno environments and caching states.
@taras taras force-pushed the tm/bdd-node-support branch from f4d0329 to ed141d1 Compare December 11, 2025 02:37
- Create package.json with npm exports and dependencies
- Add tinyexec to pnpm workspace
Explicitly use --frozen-lockfile to ensure reproducible builds
and fail CI if lockfile is out of sync with package.json files.
- Create package.json with npm exports and dependencies
- Add timebox to pnpm workspace
- Create package.json with npm exports and dependencies
- Add context-api to pnpm workspace
- Create package.json with npm exports and dependencies
- Add fx to pnpm workspace
- Create package.json with npm exports and dependencies
- Add signals to pnpm workspace
- Add afterEachTest hook to BDD for assertion state cleanup
- Implement assertion state checking in mod.node.ts
- Add @std/expect and @std/internal via JSR registry (.npmrc)
- Add test scripts to context-api, fx, signals, timebox packages
- All 43 tests now pass on Node.js with expect.assertions() support
Copy link
Member

@cowboyd cowboyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. My only question is if we should extends the packages to be compatible with e4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants