Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke committed Sep 7, 2024
1 parent 7a4ef02 commit 257cea0
Show file tree
Hide file tree
Showing 16 changed files with 5,217 additions and 1,162 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test
on:
push:

concurrency:
group: branch-node-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20, 'lts/*']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- run: npm ci
- run: npm run build
- run: npm run test
12 changes: 1 addition & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
index.cjs*
index.mjs*
node_modules
package-lock.json
yarn.lock
*.log*
*.result.css
.*
!.editorconfig
!.gitattributes
!.gitignore
!.rollup.js
!.tape.js
!.travis.yml

2 changes: 1 addition & 1 deletion .rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
]
}

function patchBabelPluginSyntaxImportMeta () {
function patchBabelPluginSyntaxImportMeta() {
return {
name: 'patch-babel-plugin-syntax-import-meta',
renderChunk (code, chunk, options) {
Expand Down
64 changes: 52 additions & 12 deletions .tape.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,63 @@
const fixed_browserslist = [
"IE 10",
"ie_mob 10",
"Safari 7",
"iOS 7",
"Chrome 60",
"ChromeAndroid 60",
"Firefox 60",
"FirefoxAndroid 60",
"Edge 16",
"> 0.01%"
]

module.exports = {
/* Test Basic Usage */
'basic-normalize': {
message: 'supports @import-normalize usage'
message: 'supports @import-normalize usage',
options: {
browsers: fixed_browserslist
}
},
'basic-sanitize': {
message: 'supports @import-sanitize usage'
message: 'supports @import-sanitize usage',
options: {
browsers: fixed_browserslist
}
},

/* Test @import Usage */
'import-normalize': {
message: 'supports @import "normalize" usage',
options: {
browsers: fixed_browserslist
},
expect: "normalize.expect.css"
},
'import-normalize-opinionated': {
message: 'supports @import "normalize/opinionated" usage'
message: 'supports @import "normalize/opinionated" usage',
options: {
browsers: fixed_browserslist
}
},
'import-sanitize': {
message: 'supports @import "sanitize" usage',
options: {
browsers: fixed_browserslist
},
expect: "sanitize.expect.css"
},
'import-sanitize-forms': {
message: 'supports @import "sanitize/forms" usage'
message: 'supports @import "sanitize/forms" usage',
options: {
browsers: fixed_browserslist
}
},
'import-sanitize-all': {
message: 'supports @import "sanitize/*" + (forms + page + typography) usage'
message: 'supports @import "sanitize/*" + (forms + page + typography) usage',
options: {
browsers: fixed_browserslist
}
},

/* Test { browsers } Usage */
Expand All @@ -38,44 +72,50 @@ module.exports = {
'force-normalize': {
message: 'supports { forceImport: true }',
options: {
forceImport: true
forceImport: true,
browsers: fixed_browserslist
}
},
'force-sanitize': {
message: 'supports { forceImport: "sanitize" }',
options: {
forceImport: 'sanitize'
forceImport: 'sanitize',
browsers: fixed_browserslist
}
},
'force-sanitize-all': {
message: 'supports { forceImport: "sanitize/*" }',
options: {
forceImport: 'sanitize/*'
forceImport: 'sanitize/*',
browsers: fixed_browserslist
}
},

/* Test { allowDuplicates } Usage */
'duplicates': {
message: 'supports preventing duplicates'
message: 'supports preventing duplicates',
options: {
browsers: fixed_browserslist
}
},
'duplicates:allow': {
message: 'supports allowing duplicates { allowDuplicates: true }',
options: {
allowDuplicates: true
allowDuplicates: true,
browsers: fixed_browserslist
}
},

/* Test PostCSS Import Usage */
'postcss-import': {
message: 'supports PostCSS Import Usage',
source: 'import-normalize.css',
expect: 'import-normalize.expect.css',
plugin: (() => {
const postcss = require('postcss')
const postcssImport = require('postcss-import')
const postcssNormalize = require('.')

const plugin = postcss([ postcssImport(postcssNormalize().postcssImport()) ])
const plugin = postcss([postcssImport(postcssNormalize({ browsers: fixed_browserslist }).postcssImport()) ])

return plugin
})()
Expand Down
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 257cea0

Please sign in to comment.