Skip to content

Commit 37552c2

Browse files
fix the running scripts during oldest tests
1 parent d04c5ec commit 37552c2

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

packages/react-on-rails-pro/jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export default {
2828

2929
// Allow Jest to transform react-on-rails package from node_modules
3030
transformIgnorePatterns: ['node_modules/(?!react-on-rails)'],
31-
testEnvironmentOptions: {
32-
customExportConditions: process.env.NODE_CONDITIONS?.split(',') ?? [],
33-
},
31+
testEnvironmentOptions: !!process.env.NODE_CONDITIONS ? {
32+
customExportConditions: process.env.NODE_CONDITIONS.split(','),
33+
} : {},
3434
// Set root directory to current package
3535
rootDir: '.',
3636
};

packages/react-on-rails-pro/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"build": "yarn run clean && yarn run tsc",
88
"build-watch": "yarn run clean && yarn run tsc --watch",
99
"clean": "rm -rf ./lib",
10-
"test": "jest tests",
10+
"test": "jest tests --testPathIgnorePatterns=\".*(ReactOnRailsRSC).*\"",
11+
"test-rsc": "NODE_CONDITIONS=react-server jest tests/ReactOnRailsRSC.test.tsx",
1112
"type-check": "yarn run tsc --noEmit --noErrorTruncation",
1213
"prepack": "nps build.prepack",
1314
"prepare": "nps build.prepack",

script/convert

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ gsub_file_content("../spec/dummy/package.json", /"react": "[^"]*",/, '"react": "
4040
gsub_file_content("../spec/dummy/package.json", /"react-dom": "[^"]*",/, '"react-dom": "18.0.0",')
4141
gsub_file_content(
4242
"../packages/react-on-rails-pro/package.json",
43-
"jest tests",
43+
"jest tests --testPathIgnorePatterns=\\\".*(ReactOnRailsRSC).*\\\"",
4444
'jest tests --testPathIgnorePatterns=\".*(RSC|stream|' \
4545
'registerServerComponent|serverRenderReactComponent|SuspenseHydration).*\"'
4646
)
47+
# Make test-rsc script do nothing
48+
gsub_file_content(
49+
"../packages/react-on-rails-pro/package.json",
50+
/"test-rsc": "(?:\\"|[^"])*",/,
51+
'"test-rsc": "exit 0",',
52+
)
4753
# Keep modern JSX transform for React 18+
4854
# gsub_file_content("../tsconfig.json", "react-jsx", "react")
4955
# gsub_file_content("../spec/dummy/babel.config.js", "runtime: 'automatic'", "runtime: 'classic'")

0 commit comments

Comments
 (0)