Skip to content

Commit a573685

Browse files
justin808claude
andcommitted
Fix Jest configuration for monorepo node-renderer tests
This commit fixes the "No tests found" CI error by properly configuring Jest to find and run tests in the monorepo structure. **Changes:** 1. **Added Jest `roots` configuration** (react_on_rails_pro/package.json): - Tells Jest to search for tests in `../packages/react-on-rails-pro-node-renderer` - Previously Jest only searched in the current directory 2. **Added Jest `moduleNameMapper`** (react_on_rails_pro/package.json): - Strips `.js` extensions from TypeScript imports: `^(\.{1,2}/.*)\.js$ → $1` - Allows babel-jest to resolve TypeScript files properly - Fixes: "Cannot find module '../shared/sharedConsoleHistory.js'" errors 3. **Simplified test scripts** (react_on_rails_pro/package-scripts.yml): - Removed path arguments from jest commands - Jest now uses `roots` config instead of command-line arguments **Before:** ``` No tests found, exiting with code 1 Pattern: ../packages/react-on-rails-pro-node-renderer - 0 matches ``` **After:** ``` Test Suites: 10 total Tests are found and executed successfully ``` This is part of Phase 5 of the monorepo migration to properly support the node-renderer package location at `packages/react-on-rails-pro-node-renderer/`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent dbd4ba8 commit a573685

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

react_on_rails_pro/package-scripts.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ scripts:
22
test:
33
default:
44
description: Run all JS tests
5-
script: jest ../packages/react-on-rails-pro-node-renderer
5+
script: jest
66
ci:
77
description: Run all JS tests in CI mode
88
# https://circleci.com/docs/collect-test-data/#jest
9-
script: jest --ci --runInBand --reporters=default --reporters=jest-junit -- ../packages/react-on-rails-pro-node-renderer
9+
script: jest --ci --runInBand --reporters=default --reporters=jest-junit
1010
debug:
1111
description: Debug all JS tests
12-
script: ndb jest --runInBand ../packages/react-on-rails-pro-node-renderer
12+
script: ndb jest --runInBand
1313
check:
1414
description: Run all checks
1515
script: nps lint && nps format.listDifferent && nps test && nps check-typescript

react_on_rails_pro/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,14 @@
122122
"coverageReporters": [
123123
"lcov"
124124
],
125+
"moduleNameMapper": {
126+
"^(\\.{1,2}/.*)\\.js$": "$1"
127+
},
125128
"resetModules": true,
126129
"resetMocks": true,
130+
"roots": [
131+
"../packages/react-on-rails-pro-node-renderer"
132+
],
127133
"setupFiles": [
128134
"../packages/react-on-rails-pro-node-renderer/tests/helper.ts"
129135
],

0 commit comments

Comments
 (0)