Skip to content

Commit 01d32a5

Browse files
committed
test: Matrix on reloadPageOnShallowFalseUpdates true | false
1 parent 3c01f23 commit 01d32a5

File tree

4 files changed

+33
-12
lines changed

4 files changed

+33
-12
lines changed

.github/workflows/ci-cd.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@ jobs:
121121
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
122122

123123
e2e-react:
124-
name: E2E (react)
124+
name: E2E (react-reload-${{ matrix.reload-on-shallow-false }})
125125
runs-on: ubuntu-22.04-arm
126126
needs: [ci-core]
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
reload-on-shallow-false: [false, true]
127131
steps:
128132
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
129133
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
@@ -139,18 +143,19 @@ jobs:
139143
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
140144
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
141145
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }}
146+
RELOAD_ON_SHALLOW_FALSE: ${{ matrix.reload-on-shallow-false }}
142147
- name: Save Cypress artifacts
143148
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08
144149
if: failure()
145150
with:
146151
path: packages/e2e/react/cypress/screenshots
147-
name: ci-react
152+
name: ci-react-reload-${{ matrix.reload-on-shallow-false }}
148153
- uses: 47ng/actions-slack-notify@main
149154
name: Notify on Slack
150155
if: failure()
151156
with:
152157
status: ${{ job.status }}
153-
jobName: react
158+
jobName: react-reload-${{ matrix.reload-on-shallow-false }}
154159
env:
155160
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
156161

packages/e2e/react/src/main.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ enableHistorySync()
88

99
createRoot(document.getElementById('root')!).render(
1010
<StrictMode>
11-
<NuqsAdapter>
11+
<NuqsAdapter
12+
reloadPageOnShallowFalseUpdates={
13+
process.env.RELOAD_ON_SHALLOW_FALSE === 'true'
14+
}
15+
>
1216
<RootLayout>
1317
<Router />
1418
</RootLayout>

packages/e2e/react/vite.config.ts

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
import react from '@vitejs/plugin-react'
2-
import { defineConfig } from 'vite'
2+
import { defineConfig, loadEnv } from 'vite'
33

44
// https://vitejs.dev/config/
5-
export default defineConfig(() => ({
6-
plugins: [react()],
7-
build: {
8-
target: 'es2022',
9-
sourcemap: true
5+
export default defineConfig(({ mode }) => {
6+
const env = loadEnv(mode, process.cwd(), '')
7+
return {
8+
plugins: [react()],
9+
build: {
10+
target: 'es2022',
11+
sourcemap: true
12+
},
13+
define: {
14+
'process.env.RELOAD_ON_SHALLOW_FALSE': JSON.stringify(
15+
env.RELOAD_ON_SHALLOW_FALSE
16+
)
17+
}
1018
}
11-
}))
19+
})

turbo.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
"e2e-react#build": {
3535
"outputs": ["dist/**", "cypress/**"],
3636
"dependsOn": ["^build"],
37-
"env": ["REACT_COMPILER", "E2E_NO_CACHE_ON_RERUN"]
37+
"env": [
38+
"RELOAD_ON_SHALLOW_FALSE",
39+
"REACT_COMPILER",
40+
"E2E_NO_CACHE_ON_RERUN"
41+
]
3842
},
3943
"docs#build": {
4044
"outputs": [".next/**", "!.next/cache/**"],

0 commit comments

Comments
 (0)