@@ -6,8 +6,8 @@ const fs = require('fs-extra')
6
6
const to = relPath => path . resolve ( __dirname , relPath )
7
7
8
8
test ( 'Generates dot index files' , end => {
9
-
10
9
const config = {
10
+ mode : 'production' ,
11
11
entry : to ( './test-input' ) ,
12
12
output : {
13
13
path : to ( './test-output' ) ,
@@ -28,9 +28,9 @@ test('Generates dot index files', end => {
28
28
29
29
webpack ( config , ( err , stats ) => {
30
30
expect ( err ) . toEqual ( null )
31
- const modules = stats . toJson ( ) . modules
31
+ const modules = stats . toJson ( { source : true } ) . modules
32
32
expect ( modules . length ) . toEqual ( 4 )
33
- const indexFileContent = modules . pop ( ) . source
33
+ const indexFileContent = modules . find ( ( module ) => module . name . includes ( '.index.js' ) ) . source
34
34
expect ( indexFileContent ) . toMatchSnapshot ( )
35
35
end ( )
36
36
} )
@@ -40,6 +40,7 @@ test('Generates dot index files', end => {
40
40
test ( 'Accepts formatExports argument' , end => {
41
41
const toUpperCase = filename => filename . replace ( / - / g, '' ) . toUpperCase ( )
42
42
const config = {
43
+ mode : 'production' ,
43
44
entry : to ( './test-input' ) ,
44
45
output : {
45
46
path : to ( './test-output' ) ,
@@ -60,9 +61,9 @@ test('Accepts formatExports argument', end => {
60
61
61
62
webpack ( config , ( err , stats ) => {
62
63
expect ( err ) . toEqual ( null )
63
- const modules = stats . toJson ( ) . modules
64
+ const modules = stats . toJson ( { source : true } ) . modules
64
65
expect ( modules . length ) . toEqual ( 4 )
65
- const indexFileContent = modules . pop ( ) . source
66
+ const indexFileContent = modules . find ( ( module ) => module . name . includes ( '.index.js' ) ) . source
66
67
expect ( indexFileContent ) . toMatchSnapshot ( )
67
68
end ( )
68
69
} )
0 commit comments