XRAY-140503 - Fix pnpm config resolver as it does not populate repo details in pnpm.yaml file#1564
Conversation
gauriy-tech
commented
May 26, 2026
…etails
- All tests passed. If this feature is not already covered by the tests, I added new tests.
- All static analysis checks passed.
- This pull request is on the master branch.
- I used gofmt for formatting the code before submitting the pull request.
|
I have read the CLA Document and I hereby sign the CLA |
| assert.Equal(t, "repo-local", config.GetString("deployer.repo")) | ||
| } | ||
|
|
||
| func TestPnpmConfigFile(t *testing.T) { |
There was a problem hiding this comment.
All 4 flags are set in this test, so isInteractive() returns false — handleInteractiveConfigCreation exits at line 156 before reaching case project.Pnpm:. The new branch is not exercised by this test.
| func TestPnpmConfigFile(t *testing.T) { | |
| func TestPnpmConfigFile(t *testing.T) { | |
| // Non-interactive path: all 4 flags set → Interactive=false → handleInteractiveConfigCreation bypassed. | |
| // Set JFROG_CLI_HOME_DIR environment variable | |
| tempDirPath := createTempEnv(t) |
Review generated by xray-pr-review
| assert.Equal(t, "repo", config.GetString("resolver.repo")) | ||
| assert.Equal(t, "depServer", config.GetString("deployer.serverId")) | ||
| assert.Equal(t, "repo-local", config.GetString("deployer.repo")) | ||
| } |
There was a problem hiding this comment.
The file already has 4 near-identical WithDefaultServerId functions (Go:47, Pip:85, Pipenv:125, Npm:196) — adding a 5th extends a Hard Rule 5 #1 violation (3+ near-identical → table-driven). Consider collapsing all five into a single table-driven test and adding pnpm as a row:
func TestConfigFileWithDefaultServerId(t *testing.T) {
types := []project.ProjectType{
project.Go, project.Pip, project.Pipenv, project.Npm, project.Pnpm,
}
for _, confType := range types {
t.Run(confType.String(), func(t *testing.T) {
cleanUp, err := tests.ConfigTestServer(t)
assert.NoError(t, err)
defer cleanUp()
context := createContext(t, resolutionRepo+"=repo", deploymentRepo+"=repo-local")
err = CreateBuildConfig(context, confType)
assert.NoError(t, err)
config := checkCommonAndGetConfiguration(t, confType.String(), os.Getenv(coreutils.HomeDir))
assert.Equal(t, "test", config.GetString("resolver.serverId"))
assert.Equal(t, "repo", config.GetString("resolver.repo"))
assert.Equal(t, "test", config.GetString("deployer.serverId"))
assert.Equal(t, "repo-local", config.GetString("deployer.repo"))
})
}
}Is this PR the right scope for the refactor, or should it be a follow-up?
Review generated by xray-pr-review
|
This PR is not relevant anymore as we are supporting pnpm config natively using RT Set me up steps |