1
1
const importWithProps = require ( './test/import' ) ;
2
+ const assert = require ( 'assert' ) . strict ;
2
3
3
4
module . exports = {
4
5
'basic' : {
@@ -80,6 +81,17 @@ module.exports = {
80
81
expect : 'basic.import.expect.css' ,
81
82
result : 'basic.import.result.css'
82
83
} ,
84
+ 'basic:import-cjs' : {
85
+ message : 'supports { importFrom: "test/import-properties{-2}?.cjs" } usage' ,
86
+ options : {
87
+ importFrom : [
88
+ 'test/import-properties.cjs' ,
89
+ 'test/import-properties-2.cjs'
90
+ ]
91
+ } ,
92
+ expect : 'basic.import.expect.css' ,
93
+ result : 'basic.import.result.css'
94
+ } ,
83
95
'basic:import-css' : {
84
96
message : 'supports { importFrom: "test/import-properties{-2}?.css" } usage' ,
85
97
options : {
@@ -153,6 +165,25 @@ module.exports = {
153
165
expect : 'basic.import-override.expect.css' ,
154
166
result : 'basic.import-override.result.css'
155
167
} ,
168
+ 'basic:import-override:inverse' : {
169
+ message : 'importFrom with { preserve: false, overrideImportFromWithRoot: true } should override importFrom properties' ,
170
+ options : {
171
+ preserve : false ,
172
+ overrideImportFromWithRoot : true ,
173
+ importFrom : {
174
+ customProperties : {
175
+ '--color' : 'rgb(0, 0, 0)' ,
176
+ '--color-2' : 'yellow' ,
177
+ '--ref-color' : 'var(--color)' ,
178
+ '--margin' : '0 10px 20px 30px' ,
179
+ '--shadow-color' : 'rgb(0,0,0)' ,
180
+ '--z-index' : 10
181
+ }
182
+ }
183
+ } ,
184
+ expect : 'basic.import-override.inverse.expect.css' ,
185
+ result : 'basic.import-override.inverse.result.css'
186
+ } ,
156
187
'basic:export' : {
157
188
message : 'supports { exportTo: { customProperties: { ... } } } usage' ,
158
189
options : {
@@ -207,9 +238,7 @@ module.exports = {
207
238
global . __exportPropertiesString = require ( 'fs' ) . readFileSync ( 'test/export-properties.scss' , 'utf8' ) ;
208
239
} ,
209
240
after ( ) {
210
- if ( global . __exportPropertiesString !== require ( 'fs' ) . readFileSync ( 'test/export-properties.scss' , 'utf8' ) ) {
211
- throw new Error ( 'The original file did not match the freshly exported copy' ) ;
212
- }
241
+ assert . strictEqual ( global . __exportPropertiesString , require ( 'fs' ) . readFileSync ( 'test/export-properties.scss' , 'utf8' ) ) ;
213
242
}
214
243
} ,
215
244
'basic:export-json' : {
@@ -223,9 +252,7 @@ module.exports = {
223
252
global . __exportPropertiesString = require ( 'fs' ) . readFileSync ( 'test/export-properties.json' , 'utf8' ) ;
224
253
} ,
225
254
after ( ) {
226
- if ( global . __exportPropertiesString !== require ( 'fs' ) . readFileSync ( 'test/export-properties.json' , 'utf8' ) ) {
227
- throw new Error ( 'The original file did not match the freshly exported copy' ) ;
228
- }
255
+ assert . strictEqual ( global . __exportPropertiesString , require ( 'fs' ) . readFileSync ( 'test/export-properties.json' , 'utf8' ) ) ;
229
256
}
230
257
} ,
231
258
'basic:export-js' : {
@@ -239,9 +266,7 @@ module.exports = {
239
266
global . __exportPropertiesString = require ( 'fs' ) . readFileSync ( 'test/export-properties.js' , 'utf8' ) ;
240
267
} ,
241
268
after ( ) {
242
- if ( global . __exportPropertiesString !== require ( 'fs' ) . readFileSync ( 'test/export-properties.js' , 'utf8' ) ) {
243
- throw new Error ( 'The original file did not match the freshly exported copy' ) ;
244
- }
269
+ assert . strictEqual ( global . __exportPropertiesString , require ( 'fs' ) . readFileSync ( 'test/export-properties.js' , 'utf8' ) ) ;
245
270
}
246
271
} ,
247
272
'basic:export-mjs' : {
@@ -255,9 +280,7 @@ module.exports = {
255
280
global . __exportPropertiesString = require ( 'fs' ) . readFileSync ( 'test/export-properties.mjs' , 'utf8' ) ;
256
281
} ,
257
282
after ( ) {
258
- if ( global . __exportPropertiesString !== require ( 'fs' ) . readFileSync ( 'test/export-properties.mjs' , 'utf8' ) ) {
259
- throw new Error ( 'The original file did not match the freshly exported copy' ) ;
260
- }
283
+ assert . strictEqual ( global . __exportPropertiesString , require ( 'fs' ) . readFileSync ( 'test/export-properties.mjs' , 'utf8' ) ) ;
261
284
}
262
285
} ,
263
286
'basic:export-css' : {
@@ -271,9 +294,7 @@ module.exports = {
271
294
global . __exportPropertiesString = require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ;
272
295
} ,
273
296
after ( ) {
274
- if ( global . __exportPropertiesString !== require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ) {
275
- throw new Error ( 'The original file did not match the freshly exported copy' ) ;
276
- }
297
+ assert . strictEqual ( global . __exportPropertiesString , require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ) ;
277
298
}
278
299
} ,
279
300
'basic:export-css-to' : {
@@ -287,9 +308,7 @@ module.exports = {
287
308
global . __exportPropertiesString = require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ;
288
309
} ,
289
310
after ( ) {
290
- if ( global . __exportPropertiesString !== require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ) {
291
- throw new Error ( 'The original file did not match the freshly exported copy' ) ;
292
- }
311
+ assert . strictEqual ( global . __exportPropertiesString , require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ) ;
293
312
}
294
313
} ,
295
314
'basic:export-css-to-type' : {
@@ -303,9 +322,7 @@ module.exports = {
303
322
global . __exportPropertiesString = require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ;
304
323
} ,
305
324
after ( ) {
306
- if ( global . __exportPropertiesString !== require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ) {
307
- throw new Error ( 'The original file did not match the freshly exported copy' ) ;
308
- }
325
+ assert . strictEqual ( global . __exportPropertiesString , require ( 'fs' ) . readFileSync ( 'test/export-properties.css' , 'utf8' ) ) ;
309
326
}
310
327
} ,
311
328
'basic:import-is-empty' : {
0 commit comments