@@ -26,17 +26,17 @@ describe('Settings', () => {
26
26
expect ( settings . settings ) . toEqual ( expect . any ( Object ) ) ;
27
27
} ) ;
28
28
29
- it ( 'reads and parses the configs ' , ( ) => {
29
+ it ( '[jest 20] reads and parses the config ' , ( ) => {
30
30
const workspace = new ProjectWorkspace (
31
31
'root_path' ,
32
32
'path_to_jest' ,
33
33
'test' ,
34
34
1000 ,
35
35
) ;
36
36
const completed = jest . fn ( ) ;
37
- const configs = [ { cacheDirectory : '/tmp/jest' , name : '[md5 hash]' } ] ;
37
+ const config = { cacheDirectory : '/tmp/jest' , name : '[md5 hash]' } ;
38
38
const json = {
39
- configs ,
39
+ config ,
40
40
version : '19.0.0' ,
41
41
} ;
42
42
@@ -46,16 +46,16 @@ describe('Settings', () => {
46
46
const buffer = makeBuffer ( JSON . stringify ( json ) ) ;
47
47
const settings = new Settings ( workspace , { createProcess} ) ;
48
48
49
- settings . getConfigs ( completed ) ;
49
+ settings . getConfig ( completed ) ;
50
50
settings . getConfigProcess . stdout . emit ( 'data' , buffer ) ;
51
51
settings . getConfigProcess . emit ( 'close' ) ;
52
52
53
53
expect ( completed ) . toHaveBeenCalled ( ) ;
54
54
expect ( settings . jestVersionMajor ) . toBe ( 19 ) ;
55
- expect ( settings . settings ) . toEqual ( configs ) ;
55
+ expect ( settings . settings ) . toEqual ( config ) ;
56
56
} ) ;
57
57
58
- it ( 'reads and parses the config' , ( ) => {
58
+ it ( '[jest 21] reads and parses the config' , ( ) => {
59
59
const workspace = new ProjectWorkspace (
60
60
'root_path' ,
61
61
'path_to_jest' ,
@@ -66,7 +66,7 @@ describe('Settings', () => {
66
66
const configs = [ { cacheDirectory : '/tmp/jest' , name : '[md5 hash]' } ] ;
67
67
const json = {
68
68
configs,
69
- version : '19 .0.0' ,
69
+ version : '21 .0.0' ,
70
70
} ;
71
71
72
72
const mockProcess : any = new EventEmitter ( ) ;
@@ -80,10 +80,39 @@ describe('Settings', () => {
80
80
settings . getConfigProcess . emit ( 'close' ) ;
81
81
82
82
expect ( completed ) . toHaveBeenCalled ( ) ;
83
- expect ( settings . jestVersionMajor ) . toBe ( 19 ) ;
83
+ expect ( settings . jestVersionMajor ) . toBe ( 21 ) ;
84
84
expect ( settings . settings ) . toEqual ( configs [ 0 ] ) ;
85
85
} ) ;
86
86
87
+ it ( '[jest 21] reads and parses the configs' , ( ) => {
88
+ const workspace = new ProjectWorkspace (
89
+ 'root_path' ,
90
+ 'path_to_jest' ,
91
+ 'test' ,
92
+ 1000 ,
93
+ ) ;
94
+ const completed = jest . fn ( ) ;
95
+ const configs = [ { cacheDirectory : '/tmp/jest' , name : '[md5 hash]' } ] ;
96
+ const json = {
97
+ configs,
98
+ version : '21.0.0' ,
99
+ } ;
100
+
101
+ const mockProcess : any = new EventEmitter ( ) ;
102
+ mockProcess . stdout = new EventEmitter ( ) ;
103
+ const createProcess = ( ) => mockProcess ;
104
+ const buffer = makeBuffer ( JSON . stringify ( json ) ) ;
105
+ const settings = new Settings ( workspace , { createProcess} ) ;
106
+
107
+ settings . getConfigs ( completed ) ;
108
+ settings . getConfigProcess . stdout . emit ( 'data' , buffer ) ;
109
+ settings . getConfigProcess . emit ( 'close' ) ;
110
+
111
+ expect ( completed ) . toHaveBeenCalled ( ) ;
112
+ expect ( settings . jestVersionMajor ) . toBe ( 21 ) ;
113
+ expect ( settings . configs ) . toEqual ( configs ) ;
114
+ } ) ;
115
+
87
116
it ( 'calls callback even if no data is sent' , ( ) => {
88
117
const workspace = new ProjectWorkspace (
89
118
'root_path' ,
0 commit comments