diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-06-05 17:24:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-05 21:24:52 +0000 |
commit | 566adb7c0a0c0845e90a6e867a2c0ef5d2ada575 (patch) | |
tree | 959bd78188a6964fae3ffb8e3df97a0296c6097f /tests/specs/npm/npmrc_tarball_other_server | |
parent | 0db73f6333639bf74a9c12dfe779287623891ab7 (diff) |
fix(npm): use configured auth for tarball urls instead of scope auth (#24111)
Deno was using the scope auth for the tarball urls, which is not always
correct. We are going to do a release immediately for this issue.
Diffstat (limited to 'tests/specs/npm/npmrc_tarball_other_server')
9 files changed, 63 insertions, 0 deletions
diff --git a/tests/specs/npm/npmrc_tarball_other_server/__test__.jsonc b/tests/specs/npm/npmrc_tarball_other_server/__test__.jsonc new file mode 100644 index 000000000..dfb311c1e --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/__test__.jsonc @@ -0,0 +1,17 @@ +{ + "tempDir": true, + "tests": { + "auth_success": { + "cwd": "success", + "args": "run --node-modules-dir -A main.js", + "output": "success/main.out", + "exitCode": 1 + }, + "auth_fail": { + "cwd": "fail", + "args": "run --node-modules-dir -A main.js", + "output": "fail/main.out", + "exitCode": 1 + } + } +} diff --git a/tests/specs/npm/npmrc_tarball_other_server/fail/.npmrc b/tests/specs/npm/npmrc_tarball_other_server/fail/.npmrc new file mode 100644 index 000000000..de3704b92 --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/fail/.npmrc @@ -0,0 +1,2 @@ +@denotest:registry=http://localhost:4261/ +//localhost:4261/:_authToken=private-reg-token diff --git a/tests/specs/npm/npmrc_tarball_other_server/fail/main.js b/tests/specs/npm/npmrc_tarball_other_server/fail/main.js new file mode 100644 index 000000000..176874aa5 --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/fail/main.js @@ -0,0 +1,3 @@ +import getValue from "@denotest/tarballs-privateserver2"; + +console.log(getValue()); diff --git a/tests/specs/npm/npmrc_tarball_other_server/fail/main.out b/tests/specs/npm/npmrc_tarball_other_server/fail/main.out new file mode 100644 index 000000000..08a84a477 --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/fail/main.out @@ -0,0 +1,11 @@ +Download http://localhost:4261/@denotest/tarballs-privateserver2 +Download http://localhost:4262/@denotest/tarballs-privateserver2/1.0.0.tgz +error: Failed caching npm package '@denotest/tarballs-privateserver2@1.0.0'. + +Caused by: + No auth for tarball URI, but present for scoped registry. + + Tarball URI: http://localhost:4262/@denotest/tarballs-privateserver2/1.0.0.tgz + Scope URI: http://localhost:4261/ + + More info here: https://github.com/npm/cli/wiki/%22No-auth-for-URI,-but-auth-present-for-scoped-registry%22 diff --git a/tests/specs/npm/npmrc_tarball_other_server/fail/package.json b/tests/specs/npm/npmrc_tarball_other_server/fail/package.json new file mode 100644 index 000000000..2effd6bda --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/fail/package.json @@ -0,0 +1,7 @@ +{ + "name": "npmrc_test", + "version": "0.0.1", + "dependencies": { + "@denotest/tarballs-privateserver2": "1.0.0" + } +} diff --git a/tests/specs/npm/npmrc_tarball_other_server/success/.npmrc b/tests/specs/npm/npmrc_tarball_other_server/success/.npmrc new file mode 100644 index 000000000..cc2dde26f --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/success/.npmrc @@ -0,0 +1,3 @@ +@denotest:registry=http://localhost:4261/ +//localhost:4261/:_authToken=private-reg-token +//localhost:4262/:_authToken=private-reg-token2 diff --git a/tests/specs/npm/npmrc_tarball_other_server/success/main.js b/tests/specs/npm/npmrc_tarball_other_server/success/main.js new file mode 100644 index 000000000..176874aa5 --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/success/main.js @@ -0,0 +1,3 @@ +import getValue from "@denotest/tarballs-privateserver2"; + +console.log(getValue()); diff --git a/tests/specs/npm/npmrc_tarball_other_server/success/main.out b/tests/specs/npm/npmrc_tarball_other_server/success/main.out new file mode 100644 index 000000000..d75f26e33 --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/success/main.out @@ -0,0 +1,10 @@ +Download http://localhost:4261/@denotest/tarballs-privateserver2 +Download http://localhost:4262/@denotest/tarballs-privateserver2/1.0.0.tgz +[# This fails on a checksum issue, because the test server isn't smart enough] +[# to serve proper checksums for a package at another registry. That's fine] +[# though because this shows us that we're making it to this step instead of] +[# failing sooner on an auth issue.] +error: Failed caching npm package '@denotest/tarballs-privateserver2@1.0.0'. + +Caused by: + Tarball checksum did not match [WILDCARD] diff --git a/tests/specs/npm/npmrc_tarball_other_server/success/package.json b/tests/specs/npm/npmrc_tarball_other_server/success/package.json new file mode 100644 index 000000000..2effd6bda --- /dev/null +++ b/tests/specs/npm/npmrc_tarball_other_server/success/package.json @@ -0,0 +1,7 @@ +{ + "name": "npmrc_test", + "version": "0.0.1", + "dependencies": { + "@denotest/tarballs-privateserver2": "1.0.0" + } +} |