Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/package-js-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ jobs:
)
strategy:
matrix:
include:
node-version:
# Always run: Latest Node version (fast feedback on PRs)
- node-version: '22'
- '22'
# Master and full-ci label: Minimum supported Node version (full coverage)
- node-version: '20'
- '20'
exclude:
# Skip minimum dependency matrix on regular PRs (run only on master or with full-ci label)
- node-version: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && needs.detect-changes.outputs.has_full_ci_label != 'true' && '20' || '' }}
Expand Down Expand Up @@ -122,9 +122,11 @@ jobs:
run: script/convert
- name: Install Node modules with pnpm for renderer package
run: |
pnpm install ${{ matrix.node-version == '22' && '--frozen-lockfile' || '' }}
pnpm install ${{ matrix.node-version == '22' && '--frozen-lockfile' || '--no-frozen-lockfile' }}
pnpm add -g yalc
- name: Build Renderer package
run: pnpm build
- name: Run JS unit tests for Renderer package
run: pnpm test
- name: Run JS unit tests for react-on-rails package
run: pnpm --filter react-on-rails test
- name: Run JS unit tests for react-on-rails-pro package
run: pnpm --filter react-on-rails-pro test
40 changes: 29 additions & 11 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
import { createJsWithTsPreset } from 'ts-jest';

const tsconfig = {
// Relative imports in our TS code include `.ts` extensions.
// When compiling the package, TS rewrites them to `.js`,
// but ts-jest runs on the original code where the `.js` files don't exist,
// so this setting needs to be disabled here.
rewriteRelativeImportExtensions: false,
// Override hybrid module kind (Node16/NodeNext) to avoid ts-jest warning
// about requiring isolatedModules: true
module: 'ESNext',
};

const tsJestPreset = createJsWithTsPreset({
tsconfig,
});

// Global Jest configuration for the monorepo
// Contains common settings that all packages inherit
export default {
// === TypeScript Configuration ===
// ts-jest preset with custom TypeScript settings
...createJsWithTsPreset({
tsconfig: {
// Relative imports in our TS code include `.ts` extensions.
// When compiling the package, TS rewrites them to `.js`,
// but ts-jest runs on the original code where the `.js` files don't exist,
// so this setting needs to be disabled here.
rewriteRelativeImportExtensions: false,
},
}),
// ts-jest preset with custom TypeScript settings, extended to handle .cts/.mts files
...tsJestPreset,
transform: {
...tsJestPreset.transform,
// Extend transform to include CommonJS TypeScript (.cts) and ES Module TypeScript (.mts) files
'^.+\\.[cm]?ts$': [
'ts-jest',
{
tsconfig,
},
],
},

// === Test Environment Configuration ===
testEnvironment: 'jsdom',
Expand All @@ -23,5 +40,6 @@ export default {
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],

// === Common Module File Extensions ===
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json'],
// Include cts/mts for CommonJS/ES module TypeScript files
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'cts', 'mts', 'json'],
};
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"publint": "^0.3.4",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-on-rails-rsc": "19.0.2",
"redux": "^4.2.1",
"size-limit": "^12.0.0",
"stylelint": "^16.14.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/react-on-rails-pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
"homepage": "https://github.com/shakacode/react_on_rails#readme",
"devDependencies": {
"@types/mock-fs": "^4.13.4",
"mock-fs": "^5.5.0"
"mock-fs": "^5.5.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-on-rails-rsc": "19.0.2"
}
}
8 changes: 1 addition & 7 deletions packages/react-on-rails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@
},
"peerDependencies": {
"react": ">= 16",
"react-dom": ">= 16",
"react-on-rails-rsc": "19.0.2"
},
"peerDependenciesMeta": {
"react-on-rails-rsc": {
"optional": true
}
"react-dom": ">= 16"
},
"files": [
"lib/**/*.js",
Expand Down
Loading
Loading