Skip to content

Commit edcf97d

Browse files
committed
Require Node.js 20
1 parent 9f43d97 commit edcf97d

File tree

4 files changed

+26
-29
lines changed

4 files changed

+26
-29
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 16
13+
- 24
14+
- 20
1415
steps:
1516
- uses: actions/checkout@v5
1617
- uses: actions/setup-node@v5

index.test-d.ts

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

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111
"url": "https://sindresorhus.com"
1212
},
1313
"type": "module",
14-
"exports": "./index.js",
15-
"types": "./index.d.ts",
1614
"bin": "./cli.js",
15+
"exports": {
16+
"types": "./index.d.ts",
17+
"default": "./index.js"
18+
},
1719
"sideEffects": false,
1820
"engines": {
19-
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
21+
"node": ">=20"
2022
},
2123
"scripts": {
22-
"test": "xo && ava && tsd"
24+
"test": "xo && node --test"
2325
},
2426
"files": [
2527
"index.js",
@@ -38,10 +40,7 @@
3840
"process"
3941
],
4042
"devDependencies": {
41-
"ava": "^3.15.0",
4243
"esmock": "^2.7.3",
43-
"sinon": "^11.1.2",
44-
"tsd": "^0.17.0",
45-
"xo": "^0.44.0"
44+
"xo": "^1.2.2"
4645
}
4746
}

test.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import test from 'ava';
1+
import {test} from 'node:test';
2+
import {strict as assert} from 'node:assert';
23
import esmock from 'esmock';
34

4-
test('detects Docker via /.dockerenv', async t => {
5+
test('detects Docker via /.dockerenv', async () => {
56
const isDocker = await esmock('./index.js', {
67
'node:fs': {
78
statSync(path) {
@@ -17,10 +18,10 @@ test('detects Docker via /.dockerenv', async t => {
1718
},
1819
});
1920

20-
t.true(isDocker.default());
21+
assert.equal(isDocker.default(), true);
2122
});
2223

23-
test('detects Docker via /proc/self/cgroup', async t => {
24+
test('detects Docker via /proc/self/cgroup', async () => {
2425
const isDocker = await esmock('./index.js', {
2526
'node:fs': {
2627
statSync() {
@@ -36,10 +37,10 @@ test('detects Docker via /proc/self/cgroup', async t => {
3637
},
3738
});
3839

39-
t.true(isDocker.default());
40+
assert.equal(isDocker.default(), true);
4041
});
4142

42-
test('detects Docker via /proc/self/mountinfo', async t => {
43+
test('detects Docker via /proc/self/mountinfo', async () => {
4344
const isDocker = await esmock('./index.js', {
4445
'node:fs': {
4546
statSync() {
@@ -59,10 +60,10 @@ test('detects Docker via /proc/self/mountinfo', async t => {
5960
},
6061
});
6162

62-
t.true(isDocker.default());
63+
assert.equal(isDocker.default(), true);
6364
});
6465

65-
test('not inside Docker container', async t => {
66+
test('not inside Docker container', async () => {
6667
const isDocker = await esmock('./index.js', {
6768
'node:fs': {
6869
statSync() {
@@ -74,10 +75,10 @@ test('not inside Docker container', async t => {
7475
},
7576
});
7677

77-
t.false(isDocker.default());
78+
assert.equal(isDocker.default(), false);
7879
});
7980

80-
test('caching works correctly', async t => {
81+
test('caching works correctly', async () => {
8182
let statSyncCallCount = 0;
8283
let readFileSyncCallCount = 0;
8384

@@ -99,12 +100,12 @@ test('caching works correctly', async t => {
99100
});
100101

101102
// First call
102-
t.true(isDocker.default());
103-
t.is(statSyncCallCount, 1);
104-
t.is(readFileSyncCallCount, 1);
103+
assert.equal(isDocker.default(), true);
104+
assert.equal(statSyncCallCount, 1);
105+
assert.equal(readFileSyncCallCount, 1);
105106

106107
// Second call - should use cache
107-
t.true(isDocker.default());
108-
t.is(statSyncCallCount, 1); // Should not increase
109-
t.is(readFileSyncCallCount, 1); // Should not increase
108+
assert.equal(isDocker.default(), true);
109+
assert.equal(statSyncCallCount, 1); // Should not increase
110+
assert.equal(readFileSyncCallCount, 1); // Should not increase
110111
});

0 commit comments

Comments
 (0)