Unverified Commit 13b32ba9 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Ensure PATH env matches CI locally (#45376)

Since the tests are run with `pnpm test` locally this adds the repo's
`node_modules/.bin` to the PATH env variable although in CI `node
run-tests.js` is used which doesn't augment PATH like this so this
strips these from the env when running isolated tests to match behavior.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1674913457101449)
parent 1df93002
...@@ -65,6 +65,17 @@ export class NextInstance { ...@@ -65,6 +65,17 @@ export class NextInstance {
constructor(opts: NextInstanceOpts) { constructor(opts: NextInstanceOpts) {
Object.assign(this, opts) Object.assign(this, opts)
this.env = {
...this.env,
// remove node_modules/.bin repo path from env
// to match CI $PATH value and isolate further
PATH: process.env.PATH.split(path.delimiter)
.filter((part) => {
return !part.includes(path.join('node_modules', '.bin'))
})
.join(path.delimiter),
}
} }
protected async writeInitialFiles() { protected async writeInitialFiles() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment