File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
require ( 'chai' ) . should ( ) ;
2
+ var execSync = require ( 'child_process' ) . execSync ;
2
3
var gitHooks = require ( '../lib/git-hooks' ) ;
3
4
var fsHelpers = require ( '../lib/fs-helpers' ) ;
4
5
5
- var SANDBOX_PATH = __dirname + ' /tmp-sandbox/';
6
+ var SANDBOX_PATH = '/tmp /tmp-sandbox/';
6
7
var GIT_ROOT = SANDBOX_PATH + '.git/' ;
7
8
var GIT_HOOKS = GIT_ROOT + 'hooks' ;
8
9
var GIT_HOOKS_OLD = GIT_ROOT + 'hooks.old' ;
9
10
10
11
describe ( '--install' , function ( ) {
11
12
beforeEach ( function ( ) {
12
- fsHelpers . makeDir ( GIT_ROOT ) ;
13
+ fsHelpers . makeDir ( SANDBOX_PATH ) ;
14
+ execSync ( 'git init' , { cwd : SANDBOX_PATH } ) ;
13
15
} ) ;
14
16
15
17
afterEach ( function ( ) {
@@ -35,10 +37,6 @@ describe('--install', function () {
35
37
} ) ;
36
38
37
39
describe ( 'when some hooks already exist' , function ( ) {
38
- beforeEach ( function ( ) {
39
- fsHelpers . makeDir ( GIT_HOOKS ) ;
40
- } ) ;
41
-
42
40
it ( 'should backup hooks before installation' , function ( ) {
43
41
gitHooks . install ( SANDBOX_PATH ) ;
44
42
fsHelpers . exists ( GIT_HOOKS_OLD ) . should . be . true ;
Original file line number Diff line number Diff line change 1
1
require ( 'chai' ) . should ( ) ;
2
+ var execSync = require ( 'child_process' ) . execSync ;
2
3
var fs = require ( 'fs' ) ;
3
4
var gitHooks = require ( '../lib/git-hooks' ) ;
4
5
var fsHelpers = require ( '../lib/fs-helpers' ) ;
5
6
6
- var SANDBOX_PATH = __dirname + ' /tmp-sandbox/';
7
+ var SANDBOX_PATH = '/tmp /tmp-sandbox/';
7
8
var GIT_ROOT = SANDBOX_PATH + '.git/' ;
8
9
var GIT_HOOKS = GIT_ROOT + 'hooks' ;
9
10
var PRECOMMIT_HOOK_PATH = GIT_HOOKS + '/pre-commit' ;
@@ -16,8 +17,8 @@ function createHook(path, content) {
16
17
17
18
describe ( 'git-hook runner' , function ( ) {
18
19
beforeEach ( function ( ) {
19
- fsHelpers . makeDir ( GIT_ROOT ) ;
20
- gitHooks . install ( SANDBOX_PATH ) ;
20
+ fsHelpers . makeDir ( SANDBOX_PATH ) ;
21
+ execSync ( 'git init' , { cwd : SANDBOX_PATH } ) ;
21
22
} ) ;
22
23
23
24
afterEach ( function ( ) {
You can’t perform that action at this time.
0 commit comments