1
- module . exports = {
1
+ const postcssTape = require ( '../../packages/postcss-tape/dist/index.cjs' ) ;
2
+ const plugin = require ( 'postcss-custom-media' ) ;
3
+ const fs = require ( 'fs' ) ;
4
+
5
+ postcssTape ( plugin ) ( {
2
6
'basic' : {
3
7
message : 'supports basic usage'
4
8
} ,
@@ -8,6 +12,15 @@ module.exports = {
8
12
preserve : true
9
13
}
10
14
} ,
15
+ 'examples/example' : {
16
+ message : 'minimal example' ,
17
+ } ,
18
+ 'examples/example:preserve' : {
19
+ message : 'minimal example' ,
20
+ options : {
21
+ preserve : true
22
+ }
23
+ } ,
11
24
'import' : {
12
25
message : 'supports { importFrom: { customMedia: { ... } } } usage' ,
13
26
options : {
@@ -86,7 +99,7 @@ module.exports = {
86
99
'import:css-from-type' : {
87
100
message : 'supports { importFrom: [ { from: "test/import-media.css", type: "css" } ] } usage' ,
88
101
options : {
89
- importFrom : [ { from : 'test/import-media.css' , type : 'css' } ]
102
+ importFrom : [ { from : 'test/import-media.css' , type : 'css' } ]
90
103
} ,
91
104
expect : 'import.expect.css' ,
92
105
result : 'import.result.css'
@@ -148,10 +161,10 @@ module.exports = {
148
161
expect : 'basic.expect.css' ,
149
162
result : 'basic.result.css' ,
150
163
before ( ) {
151
- global . __exportMediaString = require ( 'fs' ) . readFileSync ( 'test/export-media.json' , 'utf8' ) ;
164
+ global . __exportMediaString = fs . readFileSync ( 'test/export-media.json' , 'utf8' ) ;
152
165
} ,
153
166
after ( ) {
154
- if ( global . __exportMediaString !== require ( 'fs' ) . readFileSync ( 'test/export-media.json' , 'utf8' ) ) {
167
+ if ( global . __exportMediaString !== fs . readFileSync ( 'test/export-media.json' , 'utf8' ) ) {
155
168
throw new Error ( 'The original file did not match the freshly exported copy' ) ;
156
169
}
157
170
}
@@ -164,10 +177,10 @@ module.exports = {
164
177
expect : 'basic.expect.css' ,
165
178
result : 'basic.result.css' ,
166
179
before ( ) {
167
- global . __exportMediaString = require ( 'fs' ) . readFileSync ( 'test/export-media.js' , 'utf8' ) ;
180
+ global . __exportMediaString = fs . readFileSync ( 'test/export-media.js' , 'utf8' ) ;
168
181
} ,
169
182
after ( ) {
170
- if ( global . __exportMediaString !== require ( 'fs' ) . readFileSync ( 'test/export-media.js' , 'utf8' ) ) {
183
+ if ( global . __exportMediaString !== fs . readFileSync ( 'test/export-media.js' , 'utf8' ) ) {
171
184
throw new Error ( 'The original file did not match the freshly exported copy' ) ;
172
185
}
173
186
}
@@ -180,10 +193,10 @@ module.exports = {
180
193
expect : 'basic.expect.css' ,
181
194
result : 'basic.result.css' ,
182
195
before ( ) {
183
- global . __exportMediaString = require ( 'fs' ) . readFileSync ( 'test/export-media.mjs' , 'utf8' ) ;
196
+ global . __exportMediaString = fs . readFileSync ( 'test/export-media.mjs' , 'utf8' ) ;
184
197
} ,
185
198
after ( ) {
186
- if ( global . __exportMediaString !== require ( 'fs' ) . readFileSync ( 'test/export-media.mjs' , 'utf8' ) ) {
199
+ if ( global . __exportMediaString !== fs . readFileSync ( 'test/export-media.mjs' , 'utf8' ) ) {
187
200
throw new Error ( 'The original file did not match the freshly exported copy' ) ;
188
201
}
189
202
}
@@ -196,10 +209,10 @@ module.exports = {
196
209
expect : 'basic.expect.css' ,
197
210
result : 'basic.result.css' ,
198
211
before ( ) {
199
- global . __exportMediaString = require ( 'fs' ) . readFileSync ( 'test/export-media.css' , 'utf8' ) ;
212
+ global . __exportMediaString = fs . readFileSync ( 'test/export-media.css' , 'utf8' ) ;
200
213
} ,
201
214
after ( ) {
202
- if ( global . __exportMediaString !== require ( 'fs' ) . readFileSync ( 'test/export-media.css' , 'utf8' ) ) {
215
+ if ( global . __exportMediaString !== fs . readFileSync ( 'test/export-media.css' , 'utf8' ) ) {
203
216
throw new Error ( 'The original file did not match the freshly exported copy' ) ;
204
217
}
205
218
}
@@ -212,10 +225,10 @@ module.exports = {
212
225
expect : 'basic.expect.css' ,
213
226
result : 'basic.result.css' ,
214
227
before ( ) {
215
- global . __exportMediaString = require ( 'fs' ) . readFileSync ( 'test/export-media.css' , 'utf8' ) ;
228
+ global . __exportMediaString = fs . readFileSync ( 'test/export-media.css' , 'utf8' ) ;
216
229
} ,
217
230
after ( ) {
218
- if ( global . __exportMediaString !== require ( 'fs' ) . readFileSync ( 'test/export-media.css' , 'utf8' ) ) {
231
+ if ( global . __exportMediaString !== fs . readFileSync ( 'test/export-media.css' , 'utf8' ) ) {
219
232
throw new Error ( 'The original file did not match the freshly exported copy' ) ;
220
233
}
221
234
}
@@ -228,12 +241,12 @@ module.exports = {
228
241
expect : 'basic.expect.css' ,
229
242
result : 'basic.result.css' ,
230
243
before ( ) {
231
- global . __exportMediaString = require ( 'fs' ) . readFileSync ( 'test/export-media.css' , 'utf8' ) ;
244
+ global . __exportMediaString = fs . readFileSync ( 'test/export-media.css' , 'utf8' ) ;
232
245
} ,
233
246
after ( ) {
234
- if ( global . __exportMediaString !== require ( 'fs' ) . readFileSync ( 'test/export-media.css' , 'utf8' ) ) {
247
+ if ( global . __exportMediaString !== fs . readFileSync ( 'test/export-media.css' , 'utf8' ) ) {
235
248
throw new Error ( 'The original file did not match the freshly exported copy' ) ;
236
249
}
237
250
}
238
251
}
239
- } ;
252
+ } ) ;
0 commit comments