-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(CLI): Trying to rewrite the cli test script in AVA.
- Loading branch information
Anadian
committed
Jun 11, 2020
1 parent
8d31e24
commit 256abb2
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const ChildProcess = require('child_process'); | ||
function test(t){ | ||
var expected_stdout_string = '\\(simple\\)\\= regex'; | ||
var stdout_string = ''; | ||
var something = 'something'; | ||
var process_object = ChildProcess.spawnSync( 'node', ['source/main.js', '--input-regex-string', 'pcre/(simple)? regex/replace/vim', '-o'], { stdio: ['pipe', 'pipe', 'pipe'] } ); | ||
console.log(process_object); | ||
if( process_object.status === 0 ){ | ||
try{ | ||
console.log(process_object.output[1]); | ||
stdout_string = process_object.output[1].toString('utf8'); | ||
console.log(stdout_string, something); | ||
console.log('stdout_string: %s %s', stdout_string, something); | ||
//t.is(stdout_string,expected_stdout_string); | ||
} catch(error){ | ||
return_error = new Error(`process_object.toString threw an error: ${error}`); | ||
throw return_error; | ||
} | ||
} else{ | ||
//t.fail(); | ||
} | ||
} | ||
|
||
test(null); |