TDD Workflow
GJSify welcomes contributions! This page describes how we port new Node.js or Web APIs to GJS. It is a strict test-driven workflow that keeps both Node.js and GJS implementations honest.
If you have not set up the monorepo yet, start with Development Setup.
TDD workflow
Section titled “TDD workflow”GJSify follows a test-driven development approach:
- Study the API: read
refs/node/lib/<name>.jsfor the canonical Node.js implementation (or the relevantrefs/deno/ext/…file for Web APIs) - Port tests: write tests in
*.spec.tsusing@gjsify/unit - Verify on Node.js:
gjsify run test:node(in the package). Tests should pass against the real Node.js implementation first - Test on GJS:
gjsify run test:gjs, and expect failures, then fix the GJSify implementation - Implement: use
@girs/*types, consultrefs/{deno,bun,quickjs,workerd}/for reference - Iterate: until both platforms pass
Testing rules
Section titled “Testing rules”- Tests must pass on both Node.js and GJS
- Never weaken tests to accommodate GJS limitations. Fix the implementation instead
- Web API packages have a third test axis:
tests/browser/runs theirtest.browser.mtsbundles under Playwright (Firefox, the same SpiderMonkey engine as GJS) to verify our implementation claims against the real browser platform - Use the
node:prefix for all Node.js imports in tests - Use
@gjsify/unitas the test framework; shared matchers:toBe,toEqual,toBeTruthy,toBeFalsy,toContain,toMatch,toThrow - Platform-specific test logic belongs in a separate
*.gjs.spec.tsfile or inside anon('Gjs', …)block, not sprinkled through the shared spec
Full validation
Section titled “Full validation”Before opening a pull request, run the full validation sequence:
gjs -m install.mjs # published gjsify, SHA-256 verifiedgjsify install --immutablegjsify run build:infra # produces the CLI the next line usesPATH="$PWD/node_modules/.bin:$PATH"gjsify run clear && gjsify run build && gjsify run check && gjsify run testThis mirrors what CI does and catches most integration issues before review.
Where to start
Section titled “Where to start”- Browse the Packages Overview for modules that are still Partial or Stub
- Check open issues on GitHub
- Improve documentation: this very site is in
website/src/content/docs/