Skip to content

XRAY-140503 - Fix pnpm config resolver as it does not populate repo details in pnpm.yaml file#1564

Closed
gauriy-tech wants to merge 1 commit into
jfrog:masterfrom
gauriy-tech:bugfix/XRAY-140503-fix-pnpm-config
Closed

XRAY-140503 - Fix pnpm config resolver as it does not populate repo details in pnpm.yaml file#1564
gauriy-tech wants to merge 1 commit into
jfrog:masterfrom
gauriy-tech:bugfix/XRAY-140503-fix-pnpm-config

Conversation

@gauriy-tech

Copy link
Copy Markdown
Screenshot 2026-05-26 at 9 36 25 AM …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.

@gauriy-tech

Copy link
Copy Markdown
Author

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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All 4 flags are set in this test, so isInteractive() returns falsehandleInteractiveConfigCreation exits at line 156 before reaching case project.Pnpm:. The new branch is not exercised by this test.

Suggested change
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"))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@gauriy-tech gauriy-tech closed this Jun 4, 2026
@gauriy-tech

Copy link
Copy Markdown
Author

This PR is not relevant anymore as we are supporting pnpm config natively using RT Set me up steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants