Skip to content

Commit 5b4fac1

Browse files
Actually parse package.json files
Co-authored-by: Vitalij Ryndin <[email protected]>
1 parent fe34ddd commit 5b4fac1

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {pathToFileURL} from 'node:url';
44
import escapeStringRegexp from 'escape-string-regexp';
55
import execa from 'execa';
66

7-
const pkg = fs.readFileSync(new URL('package.json', import.meta.url));
7+
const pkg = JSON.parse(fs.readFileSync(new URL('package.json', import.meta.url)));
88
const help = `See https://github.com/avajs/typescript/blob/v${pkg.version}/README.md`;
99

1010
function isPlainObject(x) {

test/_with-provider.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {fileURLToPath} from 'node:url';
44
import makeProvider from '@ava/typescript';
55

66
const __dirname = path.dirname(fileURLToPath(import.meta.url));
7-
const pkg = fs.readFileSync(new URL('../package.json', import.meta.url));
7+
const pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
88

99
const createProviderMacro = (identifier, avaVersion, projectDir = __dirname) => (t, run) => run(t, makeProvider({
1010
negotiateProtocol(identifiers, {version}) {

test/protocol-ava-3.2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import test from 'ava';
55
import createProviderMacro from './_with-provider.js';
66

77
const __dirname = path.dirname(fileURLToPath(import.meta.url));
8-
const pkg = fs.readFileSync(new URL('../package.json', import.meta.url));
8+
const pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
99
const withProvider = createProviderMacro('ava-3.2', '3.15.0');
1010

1111
const validateConfig = (t, provider, config) => {

0 commit comments

Comments
 (0)