Skip to content

Commit

Permalink
Actually parse package.json files
Browse files Browse the repository at this point in the history
Co-authored-by: Vitalij Ryndin <[email protected]>
  • Loading branch information
novemberborn and crashmax-dev authored Nov 16, 2021
1 parent fe34ddd commit 5b4fac1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {pathToFileURL} from 'node:url';
import escapeStringRegexp from 'escape-string-regexp';
import execa from 'execa';

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

function isPlainObject(x) {
Expand Down
2 changes: 1 addition & 1 deletion test/_with-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {fileURLToPath} from 'node:url';
import makeProvider from '@ava/typescript';

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

const createProviderMacro = (identifier, avaVersion, projectDir = __dirname) => (t, run) => run(t, makeProvider({
negotiateProtocol(identifiers, {version}) {
Expand Down
2 changes: 1 addition & 1 deletion test/protocol-ava-3.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import test from 'ava';
import createProviderMacro from './_with-provider.js';

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

const validateConfig = (t, provider, config) => {
Expand Down

0 comments on commit 5b4fac1

Please sign in to comment.