Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/package-manager/test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { join, dirname } from 'path';
import { promisify } from 'util';

import readPackageJson from 'read-package-json';
import PackageJson from '@npmcli/package-json';
import stripAnsi from 'strip-ansi';
import which from 'which';

const readPackage = promisify(readPackageJson);

import { createOptions } from '../create-options.js';
import { spawn } from '../spawn.js';
import { timeout } from '../timeout.js';
Expand All @@ -32,7 +29,8 @@ export async function test(packageManager, context) {
);
let data;
try {
data = await readPackage(join(wd, 'package.json'), false);
const pkg = await PackageJson.load(wd);
data = pkg.content;
// Explicitly set the version to the value in the downloaded package.json.
context.module.version = data.version;
} catch {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"license": "MIT",
"dependencies": {
"@npmcli/package-json": "^7.0.0",
"async": "^3.2.6",
"bl": "^6.0.16",
"chalk": "^5.4.0",
Expand All @@ -44,7 +45,6 @@
"npm-package-arg": "^12.0.1",
"npm-which": "^3.0.1",
"pnpm": "^9.15.1",
"read-package-json": "^7.0.1",
"root-check": "^2.0.0",
"semver": "^7.6.3",
"strip-ansi": "^7.1.0",
Expand Down
Loading