Skip to content

Commit

Permalink
chore: use pnpm install in tests (vercel#37712)
Browse files Browse the repository at this point in the history
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
  • Loading branch information
2 people authored and aboqasem committed Jun 18, 2022
1 parent 8daa705 commit 6c2aa71
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 21 deletions.
54 changes: 51 additions & 3 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ jobs:
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
with:
node-version: 16
check-latest: true
Expand Down Expand Up @@ -227,6 +226,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: node run-tests.js --type unit
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -268,6 +270,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -320,6 +325,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -377,6 +385,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -434,6 +445,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -489,6 +503,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -531,6 +548,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -578,6 +598,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -625,6 +648,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -671,6 +697,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -716,7 +745,10 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: cd test/integration/with-electron/app && yarn
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: cd test/integration/with-electron/app && yarn install
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: xvfb-run node run-tests.js test/integration/with-electron/test/index.test.js
Expand Down Expand Up @@ -771,6 +803,7 @@ jobs:
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
# test rsc hydration on firefox due to limited support of TransformStream api
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
- run: xvfb-run pnpm testheadless test/integration/react-streaming-and-server-components/test/index.test.js -t "should handle streaming server components correctly"
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -811,6 +844,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

# TODO: use macos runner so that we can use playwright to test against
# PRs instead of only running on canary?
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || npm i -g browserstack-local@1.4.0'
Expand Down Expand Up @@ -856,6 +892,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || npm i -g browserstack-local@1.4.0'
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -887,6 +926,8 @@ jobs:
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
- run: npx playwright install-deps && npx playwright install firefox
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
- run: node run-tests.js test/integration/production/test/index.test.js
Expand Down Expand Up @@ -965,6 +1006,9 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
name: Install pnpm

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
name: Install playwright dependencies

Expand Down Expand Up @@ -1166,6 +1210,9 @@ jobs:
- run: node ./scripts/setup-wasm.mjs
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: TEST_WASM=true xvfb-run node run-tests.js test/integration/production/test/index.test.js
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

Expand Down Expand Up @@ -1529,7 +1576,8 @@ jobs:
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_react_experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
path: ./*
key: ${{ github.sha }}-react-experimental

- run: npm i -g pnpm@latest

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps

- run: node run-tests.js --timings -g ${{ matrix.group }}/6
2 changes: 2 additions & 0 deletions .github/workflows/test_react_next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
path: ./*
key: ${{ github.sha }}-react-next

- run: npm i -g pnpm@latest

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps

- run: node run-tests.js --timings -g ${{ matrix.group }}/6
7 changes: 2 additions & 5 deletions test/lib/create-next-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,10 @@ async function createNextInstall(
stdio: ['ignore', 'inherit', 'inherit'],
})
} else {
await execa('yarn', ['install'], {
await execa('pnpm', ['install', '--strict-peer-dependencies=false'], {
cwd: installDir,
stdio: ['ignore', 'inherit', 'inherit'],
env: {
...process.env,
YARN_CACHE_FOLDER: path.join(installDir, '.yarn-cache'),
},
env: process.env,
})
}

Expand Down
1 change: 1 addition & 0 deletions test/production/jest/relay/relay-jest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe('next/jest', () => {
'babel-plugin-relay': '^13.2.0',
jsdom: '^19.0.0',
'relay-compiler': '^13.0.1',
'relay-runtime': '^13.0.2',
'relay-test-utils': '^13.0.2',
typescript: '^4.6.3',
},
Expand Down
5 changes: 3 additions & 2 deletions test/production/middleware-with-dynamic-code/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { createNext, FileRef } from 'e2e-utils'
import { join } from 'path'
import { NextInstance } from 'test/lib/next-modes/base'

const DYNAMIC_CODE_EVAL_ERROR = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Middleware middleware`
describe('Middleware with Dynamic code invocations', () => {
const DYNAMIC_CODE_EVAL_ERROR = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Middleware middleware`

describe('Middleware with Dynamic code invokations', () => {
let next: NextInstance

beforeAll(async () => {
Expand All @@ -31,6 +31,7 @@ describe('Middleware with Dynamic code invokations', () => {
has: 'latest',
qs: 'latest',
},
installCommand: 'yarn install',
})
await next.stop()
})
Expand Down
11 changes: 0 additions & 11 deletions test/production/pnpm-support/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-env jest */
import path from 'path'
import execa from 'execa'
import fs from 'fs-extra'
import webdriver from 'next-webdriver'
import { createNext, FileRef } from 'e2e-utils'
Expand All @@ -15,15 +14,6 @@ import {
describe('pnpm support', () => {
let next: NextInstance | undefined

beforeAll(async () => {
try {
const version = await execa('pnpm', ['--version'])
console.warn(`using pnpm version`, version.stdout)
} catch (_) {
// install pnpm if not available
await execa('npm', ['i', '-g', 'pnpm@latest'])
}
})
afterEach(async () => {
try {
await next?.destroy()
Expand All @@ -44,7 +34,6 @@ describe('pnpm support', () => {
start: 'next start',
},
},
installCommand: 'pnpm install',
buildCommand: 'pnpm run build',
})

Expand Down
1 change: 1 addition & 0 deletions test/production/typescript-basic/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('TypeScript basic', () => {
'@types/node': 'latest',
'@types/react': 'latest',
'@types/react-dom': 'latest',
'styled-jsx': 'latest',
},
})
})
Expand Down

0 comments on commit 6c2aa71

Please sign in to comment.