Skip to content

Commit 257cea0

Browse files
committed
fix tests
1 parent 7a4ef02 commit 257cea0

16 files changed

+5217
-1162
lines changed

.github/workflows/test.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: test
2+
on:
3+
push:
4+
5+
concurrency:
6+
group: branch-node-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node: [18, 20, 'lts/*']
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node }}
20+
21+
- run: npm ci
22+
- run: npm run build
23+
- run: npm run test

.gitignore

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
index.cjs*
2-
index.mjs*
31
node_modules
4-
package-lock.json
5-
yarn.lock
62
*.log*
73
*.result.css
8-
.*
9-
!.editorconfig
10-
!.gitattributes
11-
!.gitignore
12-
!.rollup.js
13-
!.tape.js
14-
!.travis.yml
4+

.rollup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
]
1717
}
1818

19-
function patchBabelPluginSyntaxImportMeta () {
19+
function patchBabelPluginSyntaxImportMeta() {
2020
return {
2121
name: 'patch-babel-plugin-syntax-import-meta',
2222
renderChunk (code, chunk, options) {

.tape.js

+52-12
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,63 @@
1+
const fixed_browserslist = [
2+
"IE 10",
3+
"ie_mob 10",
4+
"Safari 7",
5+
"iOS 7",
6+
"Chrome 60",
7+
"ChromeAndroid 60",
8+
"Firefox 60",
9+
"FirefoxAndroid 60",
10+
"Edge 16",
11+
"> 0.01%"
12+
]
13+
114
module.exports = {
215
/* Test Basic Usage */
316
'basic-normalize': {
4-
message: 'supports @import-normalize usage'
17+
message: 'supports @import-normalize usage',
18+
options: {
19+
browsers: fixed_browserslist
20+
}
521
},
622
'basic-sanitize': {
7-
message: 'supports @import-sanitize usage'
23+
message: 'supports @import-sanitize usage',
24+
options: {
25+
browsers: fixed_browserslist
26+
}
827
},
928

1029
/* Test @import Usage */
1130
'import-normalize': {
1231
message: 'supports @import "normalize" usage',
32+
options: {
33+
browsers: fixed_browserslist
34+
},
1335
expect: "normalize.expect.css"
1436
},
1537
'import-normalize-opinionated': {
16-
message: 'supports @import "normalize/opinionated" usage'
38+
message: 'supports @import "normalize/opinionated" usage',
39+
options: {
40+
browsers: fixed_browserslist
41+
}
1742
},
1843
'import-sanitize': {
1944
message: 'supports @import "sanitize" usage',
45+
options: {
46+
browsers: fixed_browserslist
47+
},
2048
expect: "sanitize.expect.css"
2149
},
2250
'import-sanitize-forms': {
23-
message: 'supports @import "sanitize/forms" usage'
51+
message: 'supports @import "sanitize/forms" usage',
52+
options: {
53+
browsers: fixed_browserslist
54+
}
2455
},
2556
'import-sanitize-all': {
26-
message: 'supports @import "sanitize/*" + (forms + page + typography) usage'
57+
message: 'supports @import "sanitize/*" + (forms + page + typography) usage',
58+
options: {
59+
browsers: fixed_browserslist
60+
}
2761
},
2862

2963
/* Test { browsers } Usage */
@@ -38,44 +72,50 @@ module.exports = {
3872
'force-normalize': {
3973
message: 'supports { forceImport: true }',
4074
options: {
41-
forceImport: true
75+
forceImport: true,
76+
browsers: fixed_browserslist
4277
}
4378
},
4479
'force-sanitize': {
4580
message: 'supports { forceImport: "sanitize" }',
4681
options: {
47-
forceImport: 'sanitize'
82+
forceImport: 'sanitize',
83+
browsers: fixed_browserslist
4884
}
4985
},
5086
'force-sanitize-all': {
5187
message: 'supports { forceImport: "sanitize/*" }',
5288
options: {
53-
forceImport: 'sanitize/*'
89+
forceImport: 'sanitize/*',
90+
browsers: fixed_browserslist
5491
}
5592
},
5693

5794
/* Test { allowDuplicates } Usage */
5895
'duplicates': {
59-
message: 'supports preventing duplicates'
96+
message: 'supports preventing duplicates',
97+
options: {
98+
browsers: fixed_browserslist
99+
}
60100
},
61101
'duplicates:allow': {
62102
message: 'supports allowing duplicates { allowDuplicates: true }',
63103
options: {
64-
allowDuplicates: true
104+
allowDuplicates: true,
105+
browsers: fixed_browserslist
65106
}
66107
},
67108

68109
/* Test PostCSS Import Usage */
69110
'postcss-import': {
70111
message: 'supports PostCSS Import Usage',
71112
source: 'import-normalize.css',
72-
expect: 'import-normalize.expect.css',
73113
plugin: (() => {
74114
const postcss = require('postcss')
75115
const postcssImport = require('postcss-import')
76116
const postcssNormalize = require('.')
77117

78-
const plugin = postcss([ postcssImport(postcssNormalize().postcssImport()) ])
118+
const plugin = postcss([postcssImport(postcssNormalize({ browsers: fixed_browserslist }).postcssImport()) ])
79119

80120
return plugin
81121
})()

.travis.yml

-11
This file was deleted.

0 commit comments

Comments
 (0)