-
Notifications
You must be signed in to change notification settings - Fork 5
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
✅ All tests that run the CLI should set the COREPACK_HOME
environment variable to use the test-specific Corepack installation directory
#233
Conversation
We need to know why the `npm config get tag-version-prefix` command failing.
Errors were thrown within the package-version-git-tag/src/utils/config.ts Lines 18 to 26 in 8dbca9f
But, why is the |
c4ca016
to
205c673
Compare
…mand Check to see if the error is caused by the `npm config get ...` command or if npm is throwing an error.
205c673
to
81b45bb
Compare
The error seems to be thrown by the |
Retrying did not resolve this problem. |
…ning tests" This reverts commit a9aa566.
The `task` command may be the cause of the segmentation fault.
This reverts commit 1212228.
…e `tryNpmConfigGet()` function The `pnpm version` command executes the `npm version` command as is. Therefore, the configuration to be used should be obtained by the `npm config get ...` command. `tryNpmConfigGet()` tries the `npm config get ...` command for this purpose. However, if the `npm config get ...` command fails, we should not force termination there. We should be allowed to use the `pnpm config get ...` command instead.
Tests are not terminated by the Try clearing the entire cache of GitHub Actions. |
…uted by the `tryNpmConfigGet()` function" This commit fixes the problem of the `npm config get ...` command being aborted by the `SIGSEGV` signal. However, there may be other ways to do this. We are reverting this commit to try them. This reverts commit 7cee91c.
a19e0f1
to
f133d91
Compare
f133d91
to
14501e5
Compare
So what does this output tell me? |
I did it! Problem fixed! We installed the latest version of npm using Corepack for our "CLI should add Git tag with customized tag prefix" test. However, it seems that the other tests within
The CLI will then attempt to run the Edit: This assumption was correct. I tried the test after deleting the |
…use the `COREPACK_HOME` environment variable All CLI and package manager commands executed within `test/index.ts` should use the `COREPACK_HOME` environment variable. To keep this in mind, we modified our test code as follows: + Add the `execDefaultEnv` option to the `initGit()` function. + Add the `COREPACK_HOME` environment variable to the `execDefaultEnv` option of the `initGit()` function called in `test/index.ts`.
…sync()` function" This reverts commit cd82128.
Why does the test fail on Windows? |
…on should use the `COREPACK_HOME` environment variable" This reverts commit f479280.
Hmm, interesting. |
…()` function should use the `COREPACK_HOME` environment variable"" This reverts commit 5f0bc0d.
…lled for testing The error is as follows: ``` TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined at new NodeError (node:internal/errors:399:5) at validateString (node:internal/validators:163:11) at Object.resolve (node:path:167:9) at ../node_modules/.pnpm/@pnpm+npm-conf@2.0.4/node_modules/@pnpm/npm-conf/lib/defaults.js (D:\a\package-version-git-tag\package-version-git-tag\test\.temp\.corepack\pnpm\7.30.5\dist\pnpm.cjs:15236:23) at __require (D:\a\package-version-git-tag\package-version-git-tag\test\.temp\.corepack\pnpm\7.30.5\dist\pnpm.cjs:12:50) at ../node_modules/.pnpm/@pnpm+npm-conf@2.0.4/node_modules/@pnpm/npm-conf/index.js (D:\a\package-version-git-tag\package-version-git-tag\test\.temp\.corepack\pnpm\7.30.5\dist\pnpm.cjs:15385:21) at __require (D:\a\package-version-git-tag\package-version-git-tag\test\.temp\.corepack\pnpm\7.30.5\dist\pnpm.cjs:12:50) at ../config/config/lib/index.js (D:\a\package-version-git-tag\package-version-git-tag\test\.temp\.corepack\pnpm\7.30.5\dist\pnpm.cjs:26161:39) at __require (D:\a\package-version-git-tag\package-version-git-tag\test\.temp\.corepack\pnpm\7.30.5\dist\pnpm.cjs:12:50) at ../cli/cli-utils/lib/getConfig.js (D:\a\package-version-git-tag\package-version-git-tag\test\.temp\.corepack\pnpm\7.30.5\dist\pnpm.cjs:46134:20) ``` Probably some kind of bug caused by Windows file paths. However, the pnpm versions are the same. The only difference is the directory where pnpm is installed (`D:\a\package-version-git-tag\package-version-git-tag\test\.temp\.corepack` is defined in the `COREPACK_HOME` environment variable). So I am not sure what kind of bug it is.
…pnpm installed for testing" This reverts commit 729f1fd.
I have figured out why the test only fails on Windows. I seem to have accidentally deleted work done in 2613c17. |
56e6585
to
333c03c
Compare
COREPACK_HOME
environment variable to use the test-specific Corepack installation directory
Code Climate has analyzed commit c11a224 and detected 0 issues on this pull request. View more on Code Climate. |
Somehow thenpm config get tag-version-prefix
command executed by the CLI failed, and therefore the automated test also failed.This does not happen in my development environment, so I assume it is caused by the environment in which the GitHub Actions are executed.This pull request tries to fix this problem.All tests in
test/index.ts
except the "CLI should add Git tag with customized tag prefix" test did not set the environment variableCOREPACK_HOME
when running the CLI.As a result, when the CLI tries to run the
npm config get tag-version-prefix
command internally, Corepack downloads npm to the default Corepack installation directory.This caused a segmentation fault and the
npm config get tag-version-prefix
command was aborted by theSIGSEGV
signal.To fix this, set the environment variable
COREPACK_HOME
in all tests withintest/index.ts
and use the test-specific Corepack installation directory.