@@ -9,19 +9,26 @@ let normalize = ( str ) => {
9
9
return str . replace ( / \r \n ? / g, "\n" ) ;
10
10
}
11
11
12
- describe ( "test-cases" , ( ) => {
13
- let testDir = path . join ( __dirname , "test-cases" )
14
- fs . readdirSync ( testDir ) . forEach ( testCase => {
15
- if ( fs . existsSync ( path . join ( testDir , testCase , "source.css" ) ) ) {
16
- it ( "should " + testCase . replace ( / - / g, " " ) , done => {
17
- let expected = normalize ( fs . readFileSync ( path . join ( testDir , testCase , "expected.css" ) , "utf-8" ) )
18
- let loader = new FileSystemLoader ( testDir )
19
- let expectedTokens = JSON . parse ( fs . readFileSync ( path . join ( testDir , testCase , "expected.json" ) , "utf-8" ) )
20
- loader . fetch ( `${ testCase } /source.css` , "/" ) . then ( tokens => {
21
- assert . equal ( loader . finalSource , expected )
22
- assert . equal ( JSON . stringify ( tokens ) , JSON . stringify ( expectedTokens ) )
23
- } ) . then ( done , done )
24
- } ) ;
25
- }
12
+ const pipelines = {
13
+ "test-cases" : undefined ,
14
+ "cssi" : [ ]
15
+ }
16
+
17
+ Object . keys ( pipelines ) . forEach ( dirname => {
18
+ describe ( dirname , ( ) => {
19
+ let testDir = path . join ( __dirname , dirname )
20
+ fs . readdirSync ( testDir ) . forEach ( testCase => {
21
+ if ( fs . existsSync ( path . join ( testDir , testCase , "source.css" ) ) ) {
22
+ it ( "should " + testCase . replace ( / - / g, " " ) , done => {
23
+ let expected = normalize ( fs . readFileSync ( path . join ( testDir , testCase , "expected.css" ) , "utf-8" ) )
24
+ let loader = new FileSystemLoader ( testDir , pipelines [ dirname ] )
25
+ let expectedTokens = JSON . parse ( fs . readFileSync ( path . join ( testDir , testCase , "expected.json" ) , "utf-8" ) )
26
+ loader . fetch ( `${ testCase } /source.css` , "/" ) . then ( tokens => {
27
+ assert . equal ( loader . finalSource , expected )
28
+ assert . equal ( JSON . stringify ( tokens ) , JSON . stringify ( expectedTokens ) )
29
+ } ) . then ( done , done )
30
+ } ) ;
31
+ }
32
+ } ) ;
26
33
} ) ;
27
- } ) ;
34
+ } )
0 commit comments