New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(node): run tests against multiple package managers #648
Conversation
7cf3c57
to
94ad4cd
Compare
30360d6
to
082eb13
Compare
Closes #625 (possibly) |
082eb13
to
6910e3e
Compare
@legobeat I suppose we could also add yarn berry, but I know it won't be so easy. I would like to better understand how exactly this package is consumed by yarn berry users. |
94ad4cd
to
1f13e6e
Compare
b82d7e5
to
c66024b
Compare
c66024b
to
dc9c9da
Compare
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
dc9c9da
to
c64c8e2
Compare
b4c7ca5
to
9dddc50
Compare
8766e95
to
e780f61
Compare
now that we're no longer supporting node 14 this should be smooth |
e780f61
to
e10da2d
Compare
e10da2d
to
255bfd5
Compare
This now targets #729 and I removed the terrible garbage I had to add for v14. |
9bb74cd
to
f42003e
Compare
255bfd5
to
0d7bd14
Compare
f42003e
to
6c17c97
Compare
0d7bd14
to
9faedbb
Compare
a0c494b
to
1643a69
Compare
1643a69
to
6fa40d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we forgot about his one. Without node14 it looks nice and clean.
This changes how `lavamoat` runs its tests. To prepare the tests, `test/prepare.js` is run. This invokes [corepack](https://npm.im/corepack) to switch between package managers and performs a clean install and setup using each. The package manager can be changed via environment variable. Motivation: After changing from Yarn to npm, we were concerned about breaking compat. This should ease our nerves a bit! Notes: - a new policy file was created in project `2` for `atob`; I'm not sure what caused this change. - Yarn _must_ have lockfiles or it will get confused about workspaces.
6fa40d3
to
8e3daa8
Compare
"test": "npm run test:npm && npm run test:yarn1", | ||
"test:prepare": "node ./test/prepare.js", | ||
"test:npm": "cross-env LAVAMOAT_PM=npm@latest npm run test:prepare && ava", | ||
"test:yarn1": "cross-env LAVAMOAT_PM=yarn@1 npm run test:prepare && ava", | ||
"lint:deps": "depcheck" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"test": "npm run test:npm && npm run test:yarn1", | |
"test:prepare": "node ./test/prepare.js", | |
"test:npm": "cross-env LAVAMOAT_PM=npm@latest npm run test:prepare && ava", | |
"test:yarn1": "cross-env LAVAMOAT_PM=yarn@1 npm run test:prepare && ava", | |
"lint:deps": "depcheck" | |
"lint:deps": "depcheck", | |
"test": "npm run test:npm && npm run test:yarn1", | |
"test:npm": "cross-env LAVAMOAT_PM=npm@latest npm run test:prepare && ava", | |
"test:prepare": "node ./test/prepare.js", | |
"test:yarn1": "cross-env LAVAMOAT_PM=yarn@1 npm run test:prepare && ava" |
nit: alphabetic order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a prettier plugin to sort package.json
. I suggest we use it
}, | ||
"dependencies": { | ||
"keccak": "3.0.0" | ||
}, | ||
"devDependencies": { | ||
"patch-package": "^6.2.2" | ||
"patch-package": "6.2.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we're pinning, could we do so on 6.5.1
? (Latest for ^6.2.2
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to go with "no" for now, because it doesn't work on my machine:
Command failed: /Users/boneskull/projects/lavamoat/lavamoat/packages/node/test/../src/cli.js ./index.js
Error: No native build was found for platform=darwin arch=arm64 runtime=node abi=115 uv=1 armv=8 libc=glibc node=20.9.0
loaded from: /Users/boneskull/projects/lavamoat/lavamoat/packages/node/test/projects/2/node_modules/keccak
at load.resolve.load.path (/Users/boneskull/projects/lavamoat/lavamoat/packages/node/test/projects/2/node_modules/node-gyp-build/node-gyp-build.js:61:9)
at Object.eval (/Users/boneskull/projects/lavamoat/lavamoat/packages/node/test/projects/2/node_modules/keccak/bindings.js:2:73)
at internalRequire (LavaMoat/core/kernel:896:27)
at requireRelative (LavaMoat/core/kernel:941:27)
at requireRelativeWithContext (LavaMoat/core/kernel:909:18)
at Object.eval (/Users/boneskull/projects/lavamoat/lavamoat/packages/node/test/projects/2/node_modules/keccak/index.js:2:18)
at internalRequire (LavaMoat/core/kernel:896:27)
at requireRelative (LavaMoat/core/kernel:941:27)
at requireRelativeWithContext (LavaMoat/core/kernel:909:18)
at Object.eval (/Users/boneskull/projects/lavamoat/lavamoat/packages/node/test/projects/2/index.js:11:26)
@@ -30,8 +31,12 @@ | |||
"type-fest": "^2.19.0", | |||
"typescript": "^5.2.2" | |||
}, | |||
"optionalDependencies": { | |||
"corepack": "0.20.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(could) slightly loosen range to not have to manually apply any future non-breaking changes/fixes:
"corepack": "0.20.0" | |
"corepack": "~0.20.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's nothing to upgrade to. corepack
is on v0.22.0 now, and requires Node.js v18.
This changes how
lavamoat
runs its tests.To prepare the tests,
test/prepare.js
is run. This invokes corepack to switch between package managers and performs a clean install and setup using each. The package manager can be changed via environment variable.Motivation: After changing from Yarn to npm, we were concerned about breaking compat. This should ease our nerves a bit!
Notes:
2
foratob
; I'm not sure what caused this change.corepack
is seemingly broken in Node.js v14 (segfaults); if this is the case, we just try to use the system package managerchore(core,node): add some types for scenarios and options