@@ -23,63 +23,65 @@ describe('Loader', () => {
23
23
} )
24
24
25
25
describe ( 'Watching' , ( ) => {
26
- const files = {
27
- syntaxError : "watch/watching/syntaxError.css" ,
28
- noSyntaxError : "watch/watching/noSyntaxError.css" ,
29
- changingFile : "watch/watching/styleDep.css"
30
- }
26
+ describe ( 'Dependencies' , ( ) => {
27
+ const files = {
28
+ syntaxError : "watch/watching/syntaxError.css" ,
29
+ noSyntaxError : "watch/watching/noSyntaxError.css" ,
30
+ changingFile : "watch/watching/styleDep.css"
31
+ }
31
32
32
- beforeAll ( ( ) => copyFile ( files . noSyntaxError , files . changingFile ) )
33
+ beforeEach ( ( ) => copyFile ( files . noSyntaxError , files . changingFile ) )
33
34
34
- afterAll ( ( ) => deleteFile ( files . changingFile ) )
35
+ afterEach ( ( ) => deleteFile ( files . changingFile ) )
35
36
36
- test ( 'Default' , ( ) => {
37
- const config = {
38
- loader : {
39
- options : {
40
- plugins : [ require ( "postcss-import" ) ] ,
37
+ test ( 'Error' , ( ) => {
38
+ const config = {
39
+ loader : {
40
+ options : {
41
+ plugins : [ require ( "postcss-import" ) ] ,
42
+ }
41
43
}
42
44
}
43
- }
44
45
45
- const steps = [
46
- ( stats ) => {
47
- const { err, src } = loader ( stats )
46
+ const steps = [
47
+ ( stats ) => {
48
+ const { err, src } = loader ( stats )
48
49
49
- expect ( src ) . toMatchSnapshot ( )
50
- expect ( err . length ) . toEqual ( 0 )
50
+ expect ( src ) . toMatchSnapshot ( )
51
+ expect ( err . length ) . toEqual ( 0 )
51
52
52
- return copyFile ( files . syntaxError , files . changingFile )
53
- } ,
54
- ( stats ) => {
55
- const { err, src } = loader ( stats )
53
+ return copyFile ( files . syntaxError , files . changingFile )
54
+ } ,
55
+ ( stats ) => {
56
+ const { err, src } = loader ( stats )
56
57
57
- expect ( src ) . toMatchSnapshot ( )
58
- expect ( err . length ) . toEqual ( 1 )
58
+ expect ( src ) . toMatchSnapshot ( )
59
+ expect ( err . length ) . toEqual ( 1 )
59
60
60
- return copyFile ( files . noSyntaxError , files . changingFile )
61
- } ,
62
- ( stats , close ) => {
63
- const { err, src } = loader ( stats )
61
+ return copyFile ( files . noSyntaxError , files . changingFile )
62
+ } ,
63
+ ( stats , close ) => {
64
+ const { err, src } = loader ( stats )
64
65
65
- expect ( src ) . toMatchSnapshot ( )
66
- expect ( src ) . toEqual ( "module.exports = \"a { color: black }\\n\"" )
67
- expect ( err . length ) . toEqual ( 0 )
66
+ expect ( src ) . toMatchSnapshot ( )
67
+ expect ( src ) . toEqual ( "module.exports = \"a { color: black }\\n\"" )
68
+ expect ( err . length ) . toEqual ( 0 )
68
69
69
- return close ( )
70
- }
71
- ] ;
70
+ return close ( )
71
+ }
72
+ ] ;
72
73
73
- var currentStep = 0
74
+ var currentStep = 0
74
75
75
- const options = {
76
- watch ( err , stats , close ) {
77
- steps [ currentStep ] ( stats , close )
78
- currentStep ++
76
+ const options = {
77
+ watch ( err , stats , close ) {
78
+ steps [ currentStep ] ( stats , close )
79
+ currentStep ++
80
+ }
79
81
}
80
- }
81
82
82
- return webpack ( 'watch/watching/index.js' , config , options )
83
+ return webpack ( 'watch/watching/index.js' , config , options )
84
+ } )
83
85
} )
84
86
} )
85
87
} )
0 commit comments