Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eranturgeman committed Aug 1, 2023
1 parent 73df1a7 commit bc2bf55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build/utils/yarn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ func checkGetYarnDependenciesUninstalled(t *testing.T, versionToSet string) {

// Deleting yarn.lock content to make imitate the reverse action of 'yarn install'
lockFilePath := filepath.Join(projectSrcPath, "yarn.lock")
yarnLockFile, err := os.OpenFile(lockFilePath, os.O_WRONLY|os.O_TRUNC, 0666)
assert.NoError(t, err, "could not open yarn.lock file or could not truncate the file's content")
yarnLockFile, err := os.OpenFile(lockFilePath, os.O_WRONLY, 0666)
assert.NoError(t, err, "could not open yarn.lock file")
defer func() {
assert.NoError(t, yarnLockFile.Close())
}()
err = yarnLockFile.Truncate(0) // This line erases the file's content without deleting the file itself
assert.NoError(t, err, "could not erase yarn.lock file content")

pacInfo := PackageInfo{Name: "build-info-go-tests"}
_, _, err = GetYarnDependencies(executablePath, projectSrcPath, &pacInfo, &utils.NullLog{})
Expand Down

0 comments on commit bc2bf55

Please sign in to comment.