@@ -23,63 +23,65 @@ describe('Loader', () => {
2323 } )
2424
2525 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+ }
3132
32- beforeAll ( ( ) => copyFile ( files . noSyntaxError , files . changingFile ) )
33+ beforeEach ( ( ) => copyFile ( files . noSyntaxError , files . changingFile ) )
3334
34- afterAll ( ( ) => deleteFile ( files . changingFile ) )
35+ afterEach ( ( ) => deleteFile ( files . changingFile ) )
3536
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+ }
4143 }
4244 }
43- }
4445
45- const steps = [
46- ( stats ) => {
47- const { err, src } = loader ( stats )
46+ const steps = [
47+ ( stats ) => {
48+ const { err, src } = loader ( stats )
4849
49- expect ( src ) . toMatchSnapshot ( )
50- expect ( err . length ) . toEqual ( 0 )
50+ expect ( src ) . toMatchSnapshot ( )
51+ expect ( err . length ) . toEqual ( 0 )
5152
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 )
5657
57- expect ( src ) . toMatchSnapshot ( )
58- expect ( err . length ) . toEqual ( 1 )
58+ expect ( src ) . toMatchSnapshot ( )
59+ expect ( err . length ) . toEqual ( 1 )
5960
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 )
6465
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 )
6869
69- return close ( )
70- }
71- ] ;
70+ return close ( )
71+ }
72+ ] ;
7273
73- var currentStep = 0
74+ var currentStep = 0
7475
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+ }
7981 }
80- }
8182
82- return webpack ( 'watch/watching/index.js' , config , options )
83+ return webpack ( 'watch/watching/index.js' , config , options )
84+ } )
8385 } )
8486 } )
8587} )
0 commit comments