33// MODULES //
44
55var resolve = require ( 'path' ) . resolve ;
6+ var join = require ( 'path' ) . join ;
67var exec = require ( 'child_process' ) . exec ;
78var tape = require ( 'tape' ) ;
89var IS_BROWSER = require ( '@stdlib/assert/is-browser' ) ;
@@ -22,6 +23,7 @@ var opts = {
2223// FIXTURES //
2324
2425var PKG_VERSION = require ( './../package.json' ) . version ;
26+ var REQUIRES = readFileSync ( join ( __dirname , './fixtures/requires.txt' ) ) ;
2527
2628
2729// TESTS //
@@ -144,8 +146,16 @@ tape( 'the command-line interface prints import and require paths', opts, functi
144146} ) ;
145147
146148tape ( 'the command-line interface supports use as a standard stream' , opts , function test ( t ) {
147- var cmd = [
148- 'cat ./examples/index.js' ,
149+ var str ;
150+ var cmd ;
151+
152+ str = REQUIRES . toString ( ) ;
153+
154+ // Replace single quotes with double quotes:
155+ str = replace ( str , '\'' , '"' ) ;
156+
157+ cmd = [
158+ 'echo -n \'' + str + '\'' ,
149159 '|' ,
150160 process . execPath ,
151161 fpath
@@ -157,7 +167,7 @@ tape( 'the command-line interface supports use as a standard stream', opts, func
157167 if ( error ) {
158168 t . fail ( error . message ) ;
159169 } else {
160- t . strictEqual ( stdout . toString ( ) , '{"literals":["./../lib" ],"expressions":[]}\n' , 'expected value' ) ;
170+ t . strictEqual ( stdout . toString ( ) , '{"literals":["beep","./boop.js","b","bar","foobar" ],"expressions":["\\"./../b\\"+\\"op.js\\"" ]}\n' , 'expected value' ) ;
161171 t . strictEqual ( stderr . toString ( ) , '' , 'does not print to `stderr`' ) ;
162172 }
163173 t . end ( ) ;
0 commit comments