Skip to content

Commit

Permalink
fix: test cases error
Browse files Browse the repository at this point in the history
  • Loading branch information
lvqq committed Nov 12, 2022
1 parent e6bbdfc commit 062c253
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/node.resolver/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function resolveNodeVersions (
const pickedVersion = semver.maxSatisfying(
versions.map(({ version }) => version), versionRange, { includePrerelease: true, loose: true })
if (pickedVersion) {
pickedVersions = [pickedVersion]
pickedVersions = [pickedVersion.substring(1)]
}
} else {
pickedVersions = versions.map(({ version }) => version.substring(1)).filter(version => semver.satisfies(version, versionRange, {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-commands-env/src/envList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ export const listRemoteVersions = async (opts: NvmNodeCommandOptions, versionSpe
nodeMirrorBaseUrl,
})
return nodeVersionList
}
}
5 changes: 3 additions & 2 deletions packages/plugin-commands-env/test/envList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ test('list local versions', async () => {
rawConfig: {},
}, ['use', '16.4.0'])

const versions = await listLocalVersions({
const { currentNodeVersion, nodeVersionList } = await listLocalVersions({
bin: process.cwd(),
configDir,
pnpmHomeDir: process.cwd(),
rawConfig: {},
})

expect(versions).toStrictEqual(['16.4.0'])
expect(currentNodeVersion).toEqual('16.4.0')
expect(nodeVersionList).toEqual(['16.4.0'])
})

test('list local versions failed if Node.js directory not found', async () => {
Expand Down

0 comments on commit 062c253

Please sign in to comment.