Skip to content

Commit 2d95fef

Browse files
authored
chore: restore reverting package.json change when testing non-latest version (#336)
* chore: restore reverting package.json change * test: restore package.json revert in prepare, reapply update when coppying fixture in integration, move version updating to shared utility * chore: remove duplicated log * chore: remove pnpm lock files and use packageManager field to decide on package manager to install deps * chore: make integration fixture setup not output next version adjusting related logs * remove locks from smoke fixtures * adjust smoke fixtures to depend on latest to match other fixtures * add some logs about actually resolved version for latest/canary * fixup next version resolve id mess * run next version resolution in bash * add failure to cleanup error log
1 parent 5919aa0 commit 2d95fef

File tree

21 files changed

+152
-10556
lines changed

21 files changed

+152
-10556
lines changed

.github/workflows/run-tests.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,19 @@ jobs:
8787
- name: Install Playwright Browsers
8888
if: steps.playwright-cache.outputs.cache-hit != 'true'
8989
run: npx playwright install --with-deps
90+
- name: Resolve Next.js version
91+
id: resolve-next-version
92+
shell: bash
93+
run: |
94+
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
95+
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
96+
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
9097
- name: Run Playwright tests
9198
run: npm run e2e:ci -- --shard=${{ matrix.shard }}/4
9299
env:
93100
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
94101
NEXT_VERSION: ${{ matrix.version }}
102+
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
95103
- name: Upload blob report to GitHub Actions Artifacts
96104
uses: actions/upload-artifact@v4
97105
if: always()
@@ -135,9 +143,13 @@ jobs:
135143
run: |
136144
npm i -g netlify-cli
137145
netlify login
138-
- name: Get actual Next.js version
139-
id: actual-next-version
140-
run: echo "version=$(npm view next@${{ matrix.version }} version)" >> $GITHUB_OUTPUT
146+
- name: Resolve Next.js version
147+
id: resolve-next-version
148+
shell: bash
149+
run: |
150+
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
151+
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
152+
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
141153
- name: Compute Fixtures Cache Key
142154
id: fixture-cache-key
143155
# Fixtures only need to be rebuilt if anything in the tests/fixtures directory changes,
@@ -152,18 +164,20 @@ jobs:
152164
with:
153165
path: tests/fixtures
154166
key:
155-
integration-fixtures-${{ runner.os }}-${{steps.next-version.outputs.version}}-${{
167+
integration-fixtures-${{ runner.os }}-${{steps.resolve-next-version.outputs.version}}-${{
156168
steps.fixture-cache-key.outputs.key }}
157169
- name: 'Prepare Fixtures'
158170
if: steps.cache-fixtures.outputs.cache-hit != 'true'
159171
run: npm run pretest
160172
env:
161173
NEXT_VERSION: ${{ matrix.version }}
174+
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
162175
- name: 'Test'
163176
run: npm run test:ci -- --shard=${{ matrix.shard }}/8
164177
env:
165178
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
166179
NEXT_VERSION: ${{ matrix.version }}
180+
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
167181
TEMP: ${{ github.workspace }}/..
168182
merge-reports:
169183
if: always()

.github/workflows/test-e2e.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,6 @@ jobs:
6969
- name: setup pnpm/yarn
7070
run: corepack enable
7171

72-
- name: get pnpm store
73-
id: pnpm-store
74-
run: echo "PATH=$(pnpm store path --silent)" >> ${GITHUB_OUTPUT}
75-
76-
- name: cache pnpm deps
77-
uses: actions/cache@v4
78-
with:
79-
path: ${{ steps.pnpm-store.outputs.PATH }}
80-
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
81-
restore-keys: |
82-
pnpm-store-
83-
8472
- name: get npm cache
8573
id: npm-cache
8674
run: echo "PATH=$(npm config get cache)" >> ${GITHUB_OUTPUT}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ deno.lock
1414
.eslintcache
1515
/report/index.html
1616
.DS_Store
17-
tests/fixtures/**/package-lock.json
17+
tests/**/package-lock.json
18+
tests/**/pnpm-lock.yaml
19+
tests/**/yarn.lock

tests/e2e/e2e-helpers.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/e2e/edge-middleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from '@playwright/test'
2+
import { nextVersionSatisfies } from '../utils/next-version-helpers.mjs'
23
import { test } from '../utils/playwright-helpers.js'
34
import { getImageSize } from 'next/dist/server/image-optimizer.js'
4-
import { nextVersionSatisfies } from './e2e-helpers.js'
55

66
test('Runs edge middleware', async ({ page, middleware }) => {
77
await page.goto(`${middleware.url}/test/redirect`)

tests/e2e/simple-app.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type Locator, expect } from '@playwright/test'
2+
import { nextVersionSatisfies } from '../utils/next-version-helpers.mjs'
23
import { test } from '../utils/playwright-helpers.js'
3-
import { nextVersionSatisfies } from './e2e-helpers.js'
44

55
const expectImageWasLoaded = async (locator: Locator) => {
66
expect(await locator.evaluate((img: HTMLImageElement) => img.naturalHeight)).toBeGreaterThan(0)

tests/fixtures/nx-integrated/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
"nx": "17.3.0",
2626
"ts-node": "10.9.1",
2727
"typescript": "~5.3.2"
28-
}
28+
},
29+
"packageManager": "pnpm@8.9.0"
2930
}

0 commit comments

Comments
 (0)