File tree 4 files changed +30
-19
lines changed
4 files changed +30
-19
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,13 @@ jobs:
10
10
fail-fast : false
11
11
matrix :
12
12
node-version :
13
- - 16
13
+ - 18
14
+ - 20
15
+ - 21
14
16
steps :
15
- - uses : actions/checkout@v2
16
- - uses : actions/setup-node@v2
17
+ - uses : actions/checkout@v4
18
+ - uses : actions/setup-node@v4
17
19
with :
18
20
node-version : ${{ matrix.node-version }}
19
21
- run : npm install
20
- - run : npm test
22
+ - run : script -e -c " npm test"
Original file line number Diff line number Diff line change @@ -29,7 +29,5 @@ if (!input && process.stdin.isTTY) {
29
29
if ( input ) {
30
30
init ( input ) ;
31
31
} else {
32
- ( async ( ) => {
33
- init ( await getStdin ( ) ) ;
34
- } ) ( ) ;
32
+ init ( await getStdin ( ) ) ;
35
33
}
Original file line number Diff line number Diff line change 15
15
"strip-ansi" : " ./cli.js"
16
16
},
17
17
"engines" : {
18
- "node" : " >=12.17 "
18
+ "node" : " >=18 "
19
19
},
20
20
"scripts" : {
21
21
"test" : " xo && ava"
51
51
],
52
52
"dependencies" : {
53
53
"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 "
56
56
},
57
57
"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"
61
61
}
62
62
}
Original file line number Diff line number Diff line change 1
1
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' ;
3
5
4
6
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' ) ;
7
9
} ) ;
8
10
9
11
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 } ) ;
13
13
t . is ( stdout , 'foofoo' ) ;
14
14
} ) ;
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments