Scope
Port the byte-identical js/bun/test/mock/mock-module.test.ts corpus and its three TypeScript fixtures. The file contains nine active tests plus one upstream todo.
This is the broader follow-on to #122 and #124, covering:
- async mock factories
- mock.restore and spyOn namespace restoration
- nonexistent package and relative module mocks
- file URL mock resolution
- require/import/require.resolve agreement
- repeated local module replacement with live imported bindings and re-exports
- repeated package replacement through an existing dynamic namespace
- builtin aliasing between fs/promises and node:fs/promises
Baseline
Home currently rewrites the whole file to one native todo:
- 0 pass
- 0 fail
- 0 unsupported
- 1 native todo
Acceptance
- Keep the corpus file and fixtures byte-identical to Bun.
- Run all nine active upstream tests as real tests.
- Preserve the single upstream todo without introducing Home-native todos.
- Implement stable live namespaces, lazy async factory handling, module overlay semantics, spy restoration, canonical builtin mock keys, and consistent require/import mock lookup.
- Add a permanent unchanged-corpus regression.
- Pass the exact file and full home_test gate.
- Commit and push as Chris Breuer with no coauthors.
- Link completion to #66.