Skip to content

Commit f6a9d04

Browse files
Require Node.js 18 (#5)
1 parent 5ed811e commit f6a9d04

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed

.github/workflows/main.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 16
13+
- 18
14+
- 20
15+
- 21
1416
steps:
15-
- uses: actions/checkout@v2
16-
- uses: actions/setup-node@v2
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
1719
with:
1820
node-version: ${{ matrix.node-version }}
1921
- run: npm install
20-
- run: npm test
22+
- run: script -e -c "npm test"

cli.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,5 @@ if (!input && process.stdin.isTTY) {
2929
if (input) {
3030
init(input);
3131
} else {
32-
(async () => {
33-
init(await getStdin());
34-
})();
32+
init(await getStdin());
3533
}

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"strip-ansi": "./cli.js"
1616
},
1717
"engines": {
18-
"node": ">=12.17"
18+
"node": ">=18"
1919
},
2020
"scripts": {
2121
"test": "xo && ava"
@@ -51,12 +51,12 @@
5151
],
5252
"dependencies": {
5353
"get-stdin": "^9.0.0",
54-
"meow": "^10.1.1",
55-
"strip-ansi": "^7.0.1"
54+
"meow": "^13.1.0",
55+
"strip-ansi": "^7.1.0"
5656
},
5757
"devDependencies": {
58-
"ava": "^3.15.0",
59-
"execa": "^5.1.1",
60-
"xo": "^0.44.0"
58+
"ava": "^6.1.0",
59+
"execa": "^8.0.1",
60+
"xo": "^0.56.0"
6161
}
6262
}

test.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
import test from 'ava';
2-
import execa from 'execa';
2+
import {execa} from 'execa';
3+
4+
const fixture = '\u001B[0m\u001B[4m\u001B[42m\u001B[31mfoo\u001B[39m\u001B[49m\u001B[24mfoo\u001B[0m';
35

46
test('main', async t => {
5-
const {stdout} = await execa('./cli.js', ['--version']);
6-
t.true(stdout.length > 0);
7+
const {stdout} = await execa('./cli.js', [fixture]);
8+
t.is(stdout, 'foofoo');
79
});
810

911
test('stdin', async t => {
10-
const {stdout} = await execa('./cli.js', {
11-
input: '\u001B[0m\u001B[4m\u001B[42m\u001B[31mfoo\u001B[39m\u001B[49m\u001B[24mfoo\u001B[0m',
12-
});
12+
const {stdout} = await execa('./cli.js', {input: fixture});
1313
t.is(stdout, 'foofoo');
1414
});
15+
16+
// NOTE: This test assumes AVA is run in a TTY environment
17+
test('no input', async t => {
18+
/** @type {import('execa').ExecaError} */
19+
const error = await t.throwsAsync(execa('./cli.js', {stdin: 'inherit'}));
20+
21+
t.like(error, {
22+
stderr: 'Input required',
23+
exitCode: 1,
24+
});
25+
});

0 commit comments

Comments
 (0)