-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
node: Add tests for custom registries
This adds a test-time dependency on a running Verdaccio instance. Signed-off-by: Ryan Gonzalez <[email protected]>
- Loading branch information
Showing
15 changed files
with
188 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"@flatpak-node-generator-tests:registry" = "http://localhost:4873" |
13 changes: 13 additions & 0 deletions
13
node/tests/data/packages/custom-registry/package-lock.v1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "@flatpak-node-generator-tests/custom-registry", | ||
"version": "1.0.0", | ||
"lockfileVersion": 1, | ||
"requires": true, | ||
"dependencies": { | ||
"@flatpak-node-generator-tests/registry-package": { | ||
"version": "1.0.0", | ||
"resolved": "http://localhost:4873/@flatpak-node-generator-tests%2fregistry-package/-/registry-package-1.0.0.tgz", | ||
"integrity": "sha512-dyHOPsVMVjCUtyL7jeqs+ISkpRnXV88lkObwNJvYl33f/nWiKj/luzfoE4wgYOcmRuYwLNgAV/Y2SD19aHWDng==" | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
node/tests/data/packages/custom-registry/package-lock.v2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "@flatpak-node-generator-tests/custom-registry", | ||
"version": "1.0.0", | ||
"lockfileVersion": 2, | ||
"requires": true, | ||
"packages": { | ||
"": { | ||
"name": "@flatpak-node-generator-tests/custom-registry", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"@flatpak-node-generator-tests/registry-package": "*" | ||
} | ||
}, | ||
"node_modules/@flatpak-node-generator-tests/registry-package": { | ||
"version": "1.0.0", | ||
"resolved": "http://localhost:4873/@flatpak-node-generator-tests%2fregistry-package/-/registry-package-1.0.0.tgz", | ||
"integrity": "sha512-dyHOPsVMVjCUtyL7jeqs+ISkpRnXV88lkObwNJvYl33f/nWiKj/luzfoE4wgYOcmRuYwLNgAV/Y2SD19aHWDng==" | ||
} | ||
}, | ||
"dependencies": { | ||
"@flatpak-node-generator-tests/registry-package": { | ||
"version": "1.0.0", | ||
"resolved": "http://localhost:4873/@flatpak-node-generator-tests%2fregistry-package/-/registry-package-1.0.0.tgz", | ||
"integrity": "sha512-dyHOPsVMVjCUtyL7jeqs+ISkpRnXV88lkObwNJvYl33f/nWiKj/luzfoE4wgYOcmRuYwLNgAV/Y2SD19aHWDng==" | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
node/tests/data/packages/custom-registry/package-lock.v3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@flatpak-node-generator-tests/custom-registry", | ||
"version": "1.0.0", | ||
"lockfileVersion": 3, | ||
"requires": true, | ||
"packages": { | ||
"": { | ||
"name": "@flatpak-node-generator-tests/custom-registry", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"@flatpak-node-generator-tests/registry-package": "*" | ||
} | ||
}, | ||
"node_modules/@flatpak-node-generator-tests/registry-package": { | ||
"version": "1.0.0", | ||
"resolved": "http://localhost:4873/@flatpak-node-generator-tests%2fregistry-package/-/registry-package-1.0.0.tgz", | ||
"integrity": "sha512-dyHOPsVMVjCUtyL7jeqs+ISkpRnXV88lkObwNJvYl33f/nWiKj/luzfoE4wgYOcmRuYwLNgAV/Y2SD19aHWDng==" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "@flatpak-node-generator-tests/custom-registry", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"@flatpak-node-generator-tests/registry-package": "*" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
node/tests/data/packages/custom-registry/registry-package/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const fs = require('fs') | ||
|
||
module.exports = { | ||
sayHello: () => { | ||
fs.writeFileSync('hello.txt', 'Hello!') | ||
}, | ||
} |
4 changes: 4 additions & 0 deletions
4
node/tests/data/packages/custom-registry/registry-package/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "@flatpak-node-generator-tests/registry-package", | ||
"version": "1.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@flatpak-node-generator-tests/registry-package@*": | ||
version "1.0.0" | ||
resolved "http://localhost:4873/@flatpak-node-generator-tests%2fregistry-package/-/registry-package-1.0.0.tgz#1c677ccdfe9442572d73b64b4f01268fa3f302a9" | ||
integrity sha512-dyHOPsVMVjCUtyL7jeqs+ISkpRnXV88lkObwNJvYl33f/nWiKj/luzfoE4wgYOcmRuYwLNgAV/Y2SD19aHWDng== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
REGISTRY=localhost:4873 | ||
|
||
curl -X PUT http://$REGISTRY/-/user/org.couchdb.user:test \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{"name": "test", "password": "test"}' | ||
echo | ||
|
||
pkg_path="$(dirname "$0")/../tests/data/packages/custom-registry/registry-package" | ||
|
||
tmpdir=$(mktemp -d) | ||
trap 'rm -rf -- "$tmpdir"' EXIT | ||
|
||
cp -r "$pkg_path/"* "$tmpdir" | ||
|
||
cat > "$tmpdir/.npmrc" <<EOF | ||
registry = http://$REGISTRY | ||
_auth = $(echo -n test:test | base64) | ||
EOF | ||
|
||
(set -x; flatpak run \ | ||
--command=bash \ | ||
--cwd="$tmpdir" \ | ||
--filesystem="$tmpdir" \ | ||
--share=network \ | ||
org.freedesktop.Sdk//22.08 \ | ||
-c ". /usr/lib/sdk/node16/enable.sh \ | ||
&& npm publish --loglevel verbose --registry http://$REGISTRY") |