Skip to content

Commit 1d1a3b9

Browse files
committed
Add test
1 parent 4a8a84d commit 1d1a3b9

File tree

8 files changed

+28
-0
lines changed

8 files changed

+28
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ node_modules
1212

1313
# Build files
1414
dist
15+
/test/**/output.*

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"scripts": {
99
"build": "rollup -c",
1010
"dev": "rollup -cw",
11+
"test:simple": "cd test/simple && rm -f output.* && rollup -c && cmp output.js ../expected.js && cmp output.css expected.css && cd ../..",
12+
"test": "npm run test:simple",
1113
"lint": "prettier rollup.config.js src/**",
1214
"prepare": "npm run build",
1315
"prepublish": "npm run build"

test/expected.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('css imported');

test/input.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.rollup {
2+
color: green;
3+
user-select: none;
4+
}

test/input.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './input.css'
2+
3+
console.log('css imported')

test/simple/expected.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.rollup {
2+
color: green;
3+
user-select: none;
4+
}

test/simple/output.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('css imported');

test/simple/rollup.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import css from '../../src/index.js'
2+
3+
export default {
4+
input: '../input.js',
5+
output: {
6+
file: 'output.js',
7+
format: 'esm'
8+
},
9+
plugins: [
10+
css()
11+
]
12+
}

0 commit comments

Comments
 (0)