Skip to content

Commit 7b00477

Browse files
make the test script run rsc and non-rsc tests
1 parent 36f0a7b commit 7b00477

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
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 --testPathIgnorePatterns=\".*(ReactOnRailsRSC).*\"",
11-
"test-rsc": "NODE_CONDITIONS=react-server jest tests/ReactOnRailsRSC.test.tsx",
10+
"test": "yarn test:non-rsc && yarn test:rsc",
11+
"test:non-rsc": "jest tests --testPathIgnorePatterns=\".*(ReactOnRailsRSC).*\"",
12+
"test:rsc": "NODE_CONDITIONS=react-server jest tests/ReactOnRailsRSC.test.tsx",
1213
"type-check": "yarn run tsc --noEmit --noErrorTruncation",
1314
"prepack": "nps build.prepack",
1415
"prepare": "nps build.prepack",

script/convert

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ 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 --testPathIgnorePatterns=\\\".*(ReactOnRailsRSC).*\\\"",
44-
'jest tests --testPathIgnorePatterns=\".*(RSC|stream|' \
45-
'registerServerComponent|serverRenderReactComponent|SuspenseHydration).*\"'
43+
/"test:non-rsc": "(?:\\"|[^"])*",/,
44+
'"test:non-rsc": "jest tests --testPathIgnorePatterns=\".*(RSC|stream|' \
45+
'registerServerComponent|serverRenderReactComponent|SuspenseHydration).*\"",'
4646
)
47-
# Make test-rsc script do nothing
47+
# Make test:rsc script do nothing
4848
gsub_file_content(
4949
"../packages/react-on-rails-pro/package.json",
50-
/"test-rsc": "(?:\\"|[^"])*",/,
51-
'"test-rsc": "exit 0",'
50+
/"test:rsc": "(?:\\"|[^"])*",/,
51+
'"test:rsc": "exit 0",'
5252
)
5353
# Keep modern JSX transform for React 18+
5454
# gsub_file_content("../tsconfig.json", "react-jsx", "react")

0 commit comments

Comments
 (0)