File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 6
6
},
7
7
"devDependencies" : {
8
8
"ava" : " 0.15.2" ,
9
- "execa" : " 0.4.0"
9
+ "execa" : " 0.4.0" ,
10
+ "strip-ansi" : " 3.0.1"
10
11
}
11
12
}
Original file line number Diff line number Diff line change
1
+ import test from 'ava' ;
2
+ import { default as execa , spawn } from 'execa' ;
3
+ import { readFileSync } from 'fs' ;
4
+ import stripAnsi from 'strip-ansi' ;
5
+
6
+ const kcommand = readFileSync ( '../k.sh' , 'utf-8' ) ;
7
+
8
+ function k ( path = '' ) {
9
+ return execa ( 'eval' , [ kcommand + 'k ' + path ] , { shell : '/bin/zsh' } )
10
+ . then ( ( { stdout} ) => stdout )
11
+ . then ( res => res . split ( '\n' ) ) ;
12
+ }
13
+
14
+ k . stripColors = function ( path ) {
15
+ return k ( path ) . then ( res => res . map ( line => stripAnsi ( line ) ) ) ;
16
+ }
17
+
18
+ test ( 'First proof of concept test' , t => {
19
+ return k . stripColors ( )
20
+ . then ( lines => {
21
+ t . is ( lines [ 0 ] , 'total 8' ) ;
22
+ } ) ;
23
+ } ) ;
You can’t perform that action at this time.
0 commit comments