@@ -11,47 +11,91 @@ function updateFile(content) {
11
11
}
12
12
13
13
describe ( 'development mode' , ( ) => {
14
- describe ( 'should cache calls not in development mode' , ( ) => {
15
- before ( ( ) => {
16
- hook ( ) ;
17
- updateFile ( '.block\n{\n display: block;\n}' ) ;
18
- process . env . NODE_ENV = '' ;
19
- require ( fixture ) ;
20
- updateFile ( '.inline-block\n{\n display: inline-block;\n}' ) ;
21
- } ) ;
14
+ describe ( 'shouldn`t calls cache in development mode' , ( ) => {
15
+ describe ( 'devMode:false options should override NODE_ENV="development"' , ( ) => {
16
+ before ( ( ) => {
17
+ hook ( { devMode : false } ) ;
18
+ updateFile ( '.block\n{\n display: block;\n}' ) ;
19
+ process . env . NODE_ENV = 'development' ;
20
+ require ( fixture ) ;
21
+ updateFile ( '.inline-block\n{\n display: inline-block;\n}' ) ;
22
+ } ) ;
23
+
24
+ after ( ( ) => {
25
+ process . env . NODE_ENV = '' ;
26
+ dropCache ( fixture ) ;
27
+ } ) ;
22
28
23
- after ( ( ) => {
24
- process . env . NODE_ENV = '' ;
25
- dropCache ( fixture ) ;
29
+ it ( 'should retrive data from cache' , ( ) => {
30
+ const tokens = require ( fixture ) ;
31
+ const keys = Object . keys ( tokens ) ;
32
+ equal ( keys . length , 1 ) ;
33
+ equal ( keys . join ( '' ) , 'block' ) ;
34
+ } ) ;
26
35
} ) ;
27
36
28
- it ( 'should retrive data from cache' , ( ) => {
29
- const tokens = require ( fixture ) ;
30
- const keys = Object . keys ( tokens ) ;
31
- equal ( keys . length , 1 ) ;
32
- equal ( keys . join ( '' ) , 'block' ) ;
37
+ describe ( 'should cache calls without any options' , ( ) => {
38
+ before ( ( ) => {
39
+ hook ( ) ;
40
+ updateFile ( '.block\n{\n display: block;\n}' ) ;
41
+ require ( fixture ) ;
42
+ updateFile ( '.inline-block\n{\n display: inline-block;\n}' ) ;
43
+ } ) ;
44
+
45
+ after ( ( ) => {
46
+ dropCache ( fixture ) ;
47
+ } ) ;
48
+
49
+ it ( 'should retrive data from cache' , ( ) => {
50
+ const tokens = require ( fixture ) ;
51
+ const keys = Object . keys ( tokens ) ;
52
+ equal ( keys . length , 1 ) ;
53
+ equal ( keys . join ( '' ) , 'block' ) ;
54
+ } ) ;
33
55
} ) ;
34
56
} ) ;
35
57
36
58
describe ( 'should clear cache in development mode' , ( ) => {
37
- before ( ( ) => {
38
- hook ( ) ;
39
- updateFile ( '.block\n{\n display: block;\n}' ) ;
40
- process . env . NODE_ENV = 'development' ;
41
- require ( fixture ) ;
42
- updateFile ( '.inline-block\n{\n display: inline-block;\n}' ) ;
43
- } ) ;
59
+ describe ( 'devMode:true option should works without NODE_ENV="development"' , ( ) => {
60
+ before ( ( ) => {
61
+ hook ( { devMode : true } ) ;
62
+ updateFile ( '.block\n{\n display: block;\n}' ) ;
63
+ require ( fixture ) ;
64
+ updateFile ( '.inline-block\n{\n display: inline-block;\n}' ) ;
65
+ } ) ;
66
+
67
+ after ( ( ) => {
68
+ dropCache ( fixture ) ;
69
+ } ) ;
44
70
45
- after ( ( ) => {
46
- process . env . NODE_ENV = '' ;
47
- dropCache ( fixture ) ;
71
+ it ( 'should retrive data from fs' , ( ) => {
72
+ const tokens = require ( fixture ) ;
73
+ const keys = Object . keys ( tokens ) ;
74
+ equal ( keys . length , 1 ) ;
75
+ equal ( keys . join ( '' ) , 'inline-block' ) ;
76
+ } ) ;
48
77
} ) ;
49
78
50
- it ( 'should retrive data from fs' , ( ) => {
51
- const tokens = require ( fixture ) ;
52
- const keys = Object . keys ( tokens ) ;
53
- equal ( keys . length , 1 ) ;
54
- equal ( keys . join ( '' ) , 'inline-block' ) ;
79
+ describe ( 'NODE_ENV="development" should works without debug:true option' , ( ) => {
80
+ before ( ( ) => {
81
+ hook ( ) ;
82
+ updateFile ( '.block\n{\n display: block;\n}' ) ;
83
+ process . env . NODE_ENV = 'development' ;
84
+ require ( fixture ) ;
85
+ updateFile ( '.inline-block\n{\n display: inline-block;\n}' ) ;
86
+ } ) ;
87
+
88
+ after ( ( ) => {
89
+ process . env . NODE_ENV = '' ;
90
+ dropCache ( fixture ) ;
91
+ } ) ;
92
+
93
+ it ( 'should retrive data from fs' , ( ) => {
94
+ const tokens = require ( fixture ) ;
95
+ const keys = Object . keys ( tokens ) ;
96
+ equal ( keys . length , 1 ) ;
97
+ equal ( keys . join ( '' ) , 'inline-block' ) ;
98
+ } ) ;
55
99
} ) ;
56
100
} ) ;
57
101
} ) ;
0 commit comments