1
1
'use strict' ;
2
2
/*global describe, it, afterEach, beforeEach, after */
3
3
const load = require ( '../../lib/config/load' ) ;
4
- const utils = require ( '../../lib/utils' )
4
+ const utils = require ( '../../lib/utils' ) ;
5
5
const path = require ( 'path' ) ;
6
6
const testUtils = require ( '../utils' ) ;
7
7
const assert = require ( 'assert' ) ;
@@ -14,16 +14,21 @@ describe('config logging', () => {
14
14
beforeEach ( ( ) => {
15
15
// move to the fixtures directory to allow for config loading
16
16
process . chdir ( path . resolve ( pwd , 'test/fixtures' ) ) ;
17
- utils . home = path . resolve ( pwd , [ 'test' , 'fixtures' , 'global' ] . join ( path . sep ) ) ;
17
+ utils . home = path . resolve (
18
+ pwd ,
19
+ [ 'test' , 'fixtures' , 'global' ] . join ( path . sep )
20
+ ) ;
18
21
} ) ;
19
22
20
23
afterEach ( ( ) => {
21
24
process . chdir ( pwd ) ;
22
25
utils . home = oldHome ;
23
26
} ) ;
24
27
25
- it ( 'should show package is being used' , done => {
26
- process . chdir ( path . resolve ( pwd , 'test/fixtures/packages/package-json-settings' ) ) ;
28
+ it ( 'should show package is being used' , ( done ) => {
29
+ process . chdir (
30
+ path . resolve ( pwd , 'test/fixtures/packages/package-json-settings' )
31
+ ) ;
27
32
const config = { } ;
28
33
29
34
load ( noop , noop , config , ( ) => {
@@ -32,50 +37,42 @@ describe('config logging', () => {
32
37
} ) ;
33
38
} ) ;
34
39
35
- it ( 'should not read package if no nodemonConfig' , done => {
40
+ it ( 'should not read package if no nodemonConfig' , ( done ) => {
36
41
utils . home = process . cwd ( ) ;
37
42
process . chdir ( path . resolve ( pwd , 'test/fixtures' ) ) ;
38
43
const config = { } ;
39
44
40
45
load ( noop , noop , config , ( ) => {
41
- const files = config . loaded . map ( _ => path . relative ( pwd , _ ) ) ;
46
+ const files = config . loaded . map ( ( _ ) => path . relative ( pwd , _ ) ) ;
42
47
assert . equal ( files . length , 1 , 'global nodemon' ) ;
43
48
assert . deepEqual ( files , [ 'test/fixtures/nodemon.json' ] , 'global nodemon' ) ;
44
49
done ( ) ;
45
50
} ) ;
46
51
} ) ;
47
52
48
- it ( 'should ignore legacy if new format is found' , done => {
53
+ it ( 'should ignore legacy if new format is found' , ( done ) => {
49
54
utils . home = process . cwd ( ) ;
50
55
process . chdir ( path . resolve ( pwd , 'test/fixtures/legacy' ) ) ;
51
56
const config = { } ;
52
57
53
58
load ( noop , noop , config , ( ) => {
54
- const loaded = config . loaded . map ( _ => path . relative ( pwd , _ ) ) ;
55
- assert . equal ( loaded . length , 1 , 'global nodemon is loaded and legacy is ignored' ) ;
59
+ const loaded = config . loaded . map ( ( _ ) => path . relative ( pwd , _ ) ) ;
60
+ assert . equal (
61
+ loaded . length ,
62
+ 1 ,
63
+ 'global nodemon is loaded and legacy is ignored'
64
+ ) ;
56
65
done ( ) ;
57
66
} ) ;
58
67
} ) ;
59
68
60
- it ( 'should load legacy if no nodemon.json found' , done => {
61
- utils . home = path . resolve ( pwd , 'test/fixtures/configs' ) ; // no valid nodemon.json files
62
- process . chdir ( path . resolve ( pwd , 'test/fixtures/legacy' ) ) ;
63
- const config = { } ;
64
-
65
- load ( noop , noop , config , ( ) => {
66
- const loaded = config . loaded . map ( _ => path . relative ( pwd , _ ) ) ;
67
- assert . equal ( loaded . length , 1 , 'legacy loaded' ) ;
68
- done ( ) ;
69
- } ) ;
70
- } ) ;
71
-
72
- it ( 'should load nothing if nothing found' , done => {
69
+ it ( 'should load nothing if nothing found' , ( done ) => {
73
70
utils . home = path . resolve ( pwd , 'test/fixtures/configs' ) ; // no valid nodemon.json files
74
71
process . chdir ( pwd ) ;
75
72
const config = { } ;
76
73
77
74
load ( noop , noop , config , ( ) => {
78
- const loaded = config . loaded . map ( _ => path . relative ( pwd , _ ) ) ;
75
+ const loaded = config . loaded . map ( ( _ ) => path . relative ( pwd , _ ) ) ;
79
76
assert . deepEqual ( loaded , [ ] , 'nothing loaded' ) ;
80
77
done ( ) ;
81
78
} ) ;
0 commit comments