This repository was archived by the owner on Dec 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ program.parse(process.argv)
17
17
18
18
var input = program . args [ 0 ] ? path . resolve ( program . args [ 0 ] ) : null
19
19
var output = program . args [ 1 ] ? path . resolve ( program . args [ 1 ] ) : null
20
+ if ( input && ! fs . existsSync ( input ) ) {
21
+ console . error ( colors . red ( "Unable to read file" ) , input )
22
+ process . exit ( 1 )
23
+ }
24
+
20
25
function transform ( ) {
21
26
require ( "read-file-stdin" ) ( input , function ( err , buffer ) {
22
27
if ( err ) {
Original file line number Diff line number Diff line change @@ -99,6 +99,12 @@ test("cli", function(t) {
99
99
} )
100
100
planned += 1
101
101
102
+ exec ( "bin/cssnext test/cli/wtf.css" , function ( err , stdout , stderr ) {
103
+ t . ok ( err && err . code === 1 , "should return an error when input file is unreadable" )
104
+ t . ok ( contains ( stderr , "Unable to read file" ) , "should show that the input file is not found" )
105
+ } )
106
+ planned += 2
107
+
102
108
exec ( "bin/cssnext test/cli/error.css" , function ( err , stdout , stderr ) {
103
109
t . ok ( err && err . code === 2 , "should throw an error" )
104
110
t . ok ( contains ( stderr , "encounters an error" ) , "should output a readable error" )
You can’t perform that action at this time.
0 commit comments