Skip to content

Commit 2f73490

Browse files
committed
Require Node.js 20
Fixes #33
1 parent a3732e2 commit 2f73490

4 files changed

Lines changed: 45 additions & 82 deletions

File tree

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 24
1314
- 20
14-
- 18
1515
steps:
16-
- uses: actions/checkout@v4
17-
- uses: actions/setup-node@v4
16+
- uses: actions/checkout@v5
17+
- uses: actions/setup-node@v6
1818
with:
1919
node-version: ${{ matrix.node-version }}
2020
- run: npm install

index.test-d.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
},
1818
"sideEffects": false,
1919
"engines": {
20-
"node": ">=18"
20+
"node": ">=20"
2121
},
2222
"scripts": {
23-
"test": "xo && tsd && cd test && ava"
23+
"test": "xo && cd test && node --test test.js"
2424
},
2525
"files": [
2626
"index.js",
@@ -38,15 +38,13 @@
3838
"normalize"
3939
],
4040
"dependencies": {
41-
"@types/normalize-package-data": "^2.4.3",
42-
"normalize-package-data": "^6.0.0",
43-
"parse-json": "^8.0.0",
44-
"type-fest": "^4.6.0",
45-
"unicorn-magic": "^0.1.0"
41+
"@types/normalize-package-data": "^2.4.4",
42+
"normalize-package-data": "^8.0.0",
43+
"parse-json": "^8.3.0",
44+
"type-fest": "^5.2.0",
45+
"unicorn-magic": "^0.3.0"
4646
},
4747
"devDependencies": {
48-
"ava": "^5.3.1",
49-
"tsd": "^0.29.0",
50-
"xo": "^0.56.0"
48+
"xo": "^1.2.3"
5149
}
5250
}

test/test.js

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
11
import {fileURLToPath, pathToFileURL} from 'node:url';
22
import path from 'node:path';
3-
import test from 'ava';
3+
import {test} from 'node:test';
4+
import assert from 'node:assert/strict';
45
import {readPackage, readPackageSync, parsePackage} from '../index.js';
56

6-
const dirname = path.dirname(fileURLToPath(test.meta.file));
7+
const dirname = path.dirname(fileURLToPath(import.meta.url));
78
const rootCwd = path.join(dirname, '..');
89

9-
test('async', async t => {
10+
test('async', async () => {
1011
const package_ = await readPackage();
11-
t.is(package_.name, 'unicorn');
12-
t.truthy(package_._id);
12+
assert.strictEqual(package_.name, 'unicorn');
13+
assert.ok(package_._id);
1314
});
1415

15-
test('async - cwd option', async t => {
16+
test('async - cwd option', async () => {
1617
const package_ = await readPackage({cwd: rootCwd});
17-
t.is(package_.name, 'read-pkg');
18-
t.deepEqual(
18+
assert.strictEqual(package_.name, 'read-pkg');
19+
assert.deepStrictEqual(
1920
await readPackage({cwd: pathToFileURL(rootCwd)}),
2021
package_,
2122
);
2223
});
2324

24-
test('async - normalize option', async t => {
25+
test('async - normalize option', async () => {
2526
const package_ = await readPackage({normalize: false});
26-
t.is(package_.name, 'unicorn ');
27+
assert.strictEqual(package_.name, 'unicorn ');
2728
});
2829

29-
test('sync', t => {
30+
test('sync', () => {
3031
const package_ = readPackageSync();
31-
t.is(package_.name, 'unicorn');
32-
t.truthy(package_._id);
32+
assert.strictEqual(package_.name, 'unicorn');
33+
assert.ok(package_._id);
3334
});
3435

35-
test('sync - cwd option', t => {
36+
test('sync - cwd option', () => {
3637
const package_ = readPackageSync({cwd: rootCwd});
37-
t.is(package_.name, 'read-pkg');
38-
t.deepEqual(
38+
assert.strictEqual(package_.name, 'read-pkg');
39+
assert.deepStrictEqual(
3940
readPackageSync({cwd: pathToFileURL(rootCwd)}),
4041
package_,
4142
);
4243
});
4344

44-
test('sync - normalize option', t => {
45+
test('sync - normalize option', () => {
4546
const package_ = readPackageSync({normalize: false});
46-
t.is(package_.name, 'unicorn ');
47+
assert.strictEqual(package_.name, 'unicorn ');
4748
});
4849

4950
const pkgJson = {
@@ -52,53 +53,53 @@ const pkgJson = {
5253
type: 'module',
5354
};
5455

55-
test('parsePackage - json input', t => {
56+
test('parsePackage - json input', () => {
5657
const package_ = parsePackage(pkgJson);
57-
t.is(package_.name, 'unicorn');
58-
t.deepEqual(
58+
assert.strictEqual(package_.name, 'unicorn');
59+
assert.deepStrictEqual(
5960
readPackageSync(),
6061
package_,
6162
);
6263
});
6364

64-
test('parsePackage - string input', t => {
65+
test('parsePackage - string input', () => {
6566
const package_ = parsePackage(JSON.stringify(pkgJson));
66-
t.is(package_.name, 'unicorn');
67-
t.deepEqual(
67+
assert.strictEqual(package_.name, 'unicorn');
68+
assert.deepStrictEqual(
6869
readPackageSync(),
6970
package_,
7071
);
7172
});
7273

73-
test('parsePackage - normalize option', t => {
74+
test('parsePackage - normalize option', () => {
7475
const package_ = parsePackage(pkgJson, {normalize: false});
75-
t.is(package_.name, 'unicorn ');
76-
t.deepEqual(
76+
assert.strictEqual(package_.name, 'unicorn ');
77+
assert.deepStrictEqual(
7778
readPackageSync({normalize: false}),
7879
package_,
7980
);
8081
});
8182

82-
test('parsePackage - errors on invalid input', t => {
83-
t.throws(
83+
test('parsePackage - errors on invalid input', () => {
84+
assert.throws(
8485
() => parsePackage(['foo', 'bar']),
8586
{message: '`packageFile` should be either an `object` or a `string`.'},
8687
);
8788

88-
t.throws(
89+
assert.throws(
8990
() => parsePackage(null),
9091
{message: '`packageFile` should be either an `object` or a `string`.'},
9192
);
9293

93-
t.throws(
94+
assert.throws(
9495
() => parsePackage(() => ({name: 'unicorn'})),
9596
{message: '`packageFile` should be either an `object` or a `string`.'},
9697
);
9798
});
9899

99-
test('parsePackage - does not modify source object', t => {
100+
test('parsePackage - does not modify source object', () => {
100101
const pkgObject = {name: 'unicorn', version: '1.0.0'};
101102
const package_ = parsePackage(pkgObject);
102103

103-
t.not(pkgObject, package_);
104+
assert.notStrictEqual(pkgObject, package_);
104105
});

0 commit comments

Comments
 (0)