From 00d353d23bee9af1426329f27caae5c3007cfc74 Mon Sep 17 00:00:00 2001 From: Alexander Marks Date: Fri, 10 Jun 2022 11:10:47 -0700 Subject: [PATCH 1/3] Temporary CI fix for npm bug --- .github/workflows/tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dd65c7999..4e4bc9449 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,14 @@ jobs: # We support Node Latest, Active LTS, and the most recent Maintenance LTS. # See https://nodejs.org/en/about/releases/ for Node release schedule. matrix: - version: [14, 16, 18] + version: [ + 14, + # Pin to avoid version with problematic npm. + # See https://github.com/npm/cli/issues/4980. + # TODO(aomarks) Unpin when default version is updated with fix. + 16.15.0, + 18, + ] os: [ubuntu-20.04, macos-11, windows-2022] # Allow all matrix configurations to complete, instead of cancelling as From 0d59f798c07caca04adb0c5bd37680e5aa8651a5 Mon Sep 17 00:00:00 2001 From: Alexander Marks Date: Fri, 10 Jun 2022 13:36:31 -0700 Subject: [PATCH 2/3] Use match instead of equal instead of pinning node 16 --- .github/workflows/tests.yml | 9 +-------- src/test/cache-common.ts | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e4bc9449..dd65c7999 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,14 +8,7 @@ jobs: # We support Node Latest, Active LTS, and the most recent Maintenance LTS. # See https://nodejs.org/en/about/releases/ for Node release schedule. matrix: - version: [ - 14, - # Pin to avoid version with problematic npm. - # See https://github.com/npm/cli/issues/4980. - # TODO(aomarks) Unpin when default version is updated with fix. - 16.15.0, - 18, - ] + version: [14, 16, 18] os: [ubuntu-20.04, macos-11, windows-2022] # Allow all matrix configurations to complete, instead of cancelling as diff --git a/src/test/cache-common.ts b/src/test/cache-common.ts index 3a23a6020..851adeaf4 100644 --- a/src/test/cache-common.ts +++ b/src/test/cache-common.ts @@ -1103,7 +1103,7 @@ export const registerCommonCacheTests = ( const exec = rig.exec('npm run a', {cwd: 'foo'}); const res = await exec.exit; assert.equal(res.code, 1); - assert.equal( + assert.match( removeAciiColors(res.stderr.trim()), ` ❌ package.json:9:17 Output files must be within the package: ${JSON.stringify( From 408cd2a23ba1f8ecb9758a4c8c444948f7df76ca Mon Sep 17 00:00:00 2001 From: Alexander Marks Date: Fri, 10 Jun 2022 14:03:48 -0700 Subject: [PATCH 3/3] Try filtering out the error message --- src/test/cache-common.ts | 2 +- src/test/util/test-rig.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/test/cache-common.ts b/src/test/cache-common.ts index 851adeaf4..3a23a6020 100644 --- a/src/test/cache-common.ts +++ b/src/test/cache-common.ts @@ -1103,7 +1103,7 @@ export const registerCommonCacheTests = ( const exec = rig.exec('npm run a', {cwd: 'foo'}); const res = await exec.exit; assert.equal(res.code, 1); - assert.match( + assert.equal( removeAciiColors(res.stderr.trim()), ` ❌ package.json:9:17 Output files must be within the package: ${JSON.stringify( diff --git a/src/test/util/test-rig.ts b/src/test/util/test-rig.ts index 5808da7eb..d1b9fa613 100644 --- a/src/test/util/test-rig.ts +++ b/src/test/util/test-rig.ts @@ -269,7 +269,15 @@ class ExecResult { code, signal, stdout: this.#stdout, - stderr: this.#stderr, + // TODO(aomarks) Temporary fix for + // https://github.com/npm/cli/issues/4980#issuecomment-1145334203. + // Remove when resolved. + stderr: IS_WINDOWS + ? this.#stderr.replace( + /npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.\n/, + '' + ) + : this.#stderr, }); });