Skip to content

Fix Jest workspace package resolution to enable tests without build step#6

Merged
hotlong merged 2 commits into
mainfrom
copilot/fix-pnpm-test-failure
Jan 11, 2026
Merged

Fix Jest workspace package resolution to enable tests without build step#6
hotlong merged 2 commits into
mainfrom
copilot/fix-pnpm-test-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 11, 2026

Tests failed when run before building because Jest couldn't resolve workspace package imports (@objectql/types, @objectql/driver-remote, etc.) to their TypeScript source files.

Changes

  • Added moduleNameMapper to map workspace packages to source: '^@objectql/(.*)$': '<rootDir>/../$1/src'
  • Enabled isolatedModules in ts-jest to compile files without cross-package type checking
  • Updated 3 packages: core, driver-knex, driver-mongo to match pattern already used in server
// packages/core/jest.config.js
module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  moduleNameMapper: {
    '^@objectql/(.*)$': '<rootDir>/../$1/src',
  },
  transform: {
    '^.+\\.ts$': ['ts-jest', { isolatedModules: true }],
  },
};

This enables pnpm test to run directly without pnpm build, improving test iteration speed.

Original prompt

pnpm test failed


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix test failures in pnpm Fix Jest workspace package resolution to enable tests without build step Jan 11, 2026
Copilot AI requested a review from hotlong January 11, 2026 07:13
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.

2 participants