Skip to content

Commit

Permalink
test: verify tree-shaking works
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku authored and fake-join[bot] committed Mar 10, 2021
1 parent 8287965 commit 0021db9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test/bundling/bundled.js
dist
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
dist
test/bundling/bundled.js
53 changes: 53 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"bundle": "rollup -c",
"bundle:checksize": "bundlesize",
"copy": "cpx -v lib/*.d.ts dist",
"distro": "run-s copy bundle test:integration bundle:checksize",
"distro": "run-s copy bundle test:integration test:bundle bundle:checksize",
"dev": "npm test -- --watch",
"lint": "eslint .",
"prepublishOnly": "run-s distro",
"test": "mocha -r @babel/register -r source-map-support/register --full-trace test/*.spec.js",
"test:bundle": "rollup -c test/bundling/rollup.config.js",
"test:integration": "mocha --full-trace test/integration/*.spec.js"
},
"repository": {
Expand All @@ -40,6 +41,7 @@
"@babel/preset-env": "^7.13.10",
"@babel/register": "^7.13.8",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"bundlesize": "^0.18.1",
"chai": "^4.3.3",
"cpx": "^1.5.0",
Expand All @@ -57,6 +59,10 @@
{
"path": "./dist/min-dash.min.js",
"maxSize": "2 kB"
},
{
"path": "./test/bundling/bundled.js",
"maxSize": "300 B"
}
]
}
7 changes: 7 additions & 0 deletions test/bundling/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {
has
} from '../..';

export function foo(a, b) {
return has(a, b);
}
13 changes: 13 additions & 0 deletions test/bundling/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import resolve from '@rollup/plugin-node-resolve';

export default [
{
input: 'test/bundling/index.js',
output: [
{ file: 'test/bundling/bundled.js', format: 'es' }
],
plugins: [
resolve()
]
}
];

0 comments on commit 0021db9

Please # to comment.