File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11require ( 'chai' ) . should ( ) ;
22var fs = require ( 'fs' ) ;
3+ var execSync = require ( 'child_process' ) . execSync ;
34var gitHooks = require ( '../lib/git-hooks' ) ;
45var fsHelpers = require ( '../lib/fs-helpers' ) ;
56
@@ -89,11 +90,21 @@ describe('git-hook runner', function () {
8990 } ) ;
9091 } ) ;
9192
92- it ( 'should pass standard input to them' , function ( done ) {
93- gitHooks . run ( PRECOMMIT_HOOK_PATH , [ ] , 'I am working properly!' , function ( ) {
94- fs . readFileSync ( logFile ) . toString ( ) . should . equal ( 'Hello, world!\n\nI am working properly!\n' ) ;
93+ describe ( 'if standard input is passed in' , function ( ) {
94+ it ( 'should read it properly' , function ( done ) {
95+ execSync ( 'echo "I am working properly!" | ' + PRECOMMIT_HOOK_PATH ) ;
96+ fs . readFileSync ( logFile ) . toString ( ) . trim ( ) . should . equal ( 'Hello, world!\n\nI am working properly!' ) ;
9597 done ( ) ;
9698 } ) ;
99+
100+ it ( 'should pass it to them' , function ( done ) {
101+ gitHooks . run ( PRECOMMIT_HOOK_PATH , [ ] , 'I am working properly!' , function ( ) {
102+ fs . readFileSync ( logFile ) . toString ( ) . trim ( )
103+ . should . equal ( 'Hello, world!\n\nI am working properly!' ) ;
104+ done ( ) ;
105+ } ) ;
106+ } ) ;
107+
97108 } ) ;
98109
99110 it ( 'should run a hook with success status' , function ( done ) {
You can’t perform that action at this time.
0 commit comments