Skip to content

Commit

Permalink
Adds tests for rollup and webpack - e.g. the 'module' and 'sideEffect…
Browse files Browse the repository at this point in the history
…s' options in the package.json
  • Loading branch information
orta committed Sep 29, 2020
1 parent 0ff4aef commit 6aa4b28
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,15 @@ jobs:
- name: "ES Modules Test"
run: |
cd test/esm
cd test/esm-node-native
npm run test
- name: "Rollup Tree-shaking Test"
run: |
cd test/rollup-modules
npm run test
- name: "Webpack Tree-shaking Test"
run: |
cd test/webpack-modules
npm run test
3 changes: 3 additions & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package-lock.json
rollup-modules/output
webpack-modules/dist
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion test/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"dependencies": {
"tslib": "file:.."
"tslib": "file:..",
"rollup": "2.28.2",
"@rollup/plugin-node-resolve": "9.0.0",
"webpack": "4.44.2",
"webpack-cli": "3.3.12"
}
}
7 changes: 7 additions & 0 deletions test/rollup-modules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { __awaiter } from "tslib";

export const testFunction = (textToPrint) => __awaiter(void 0, void 0, void 0, function* () {
console.log(`State: ${textToPrint}`);
});

testFunction("Works")
5 changes: 5 additions & 0 deletions test/rollup-modules/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"scripts": {
"test": "../node_modules/.bin/rollup -c rollup.config.js && output/index.js"
}
}
10 changes: 10 additions & 0 deletions test/rollup-modules/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { nodeResolve } from '@rollup/plugin-node-resolve';

export default {
input: 'index.js',
output: {
dir: 'output',
format: 'cjs'
},
plugins: [nodeResolve()]
};
7 changes: 7 additions & 0 deletions test/webpack-modules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { __awaiter } from "tslib";

export const testFunction = (textToPrint) => __awaiter(void 0, void 0, void 0, function* () {
console.log(`State: ${textToPrint}`);
});

testFunction("Works")
5 changes: 5 additions & 0 deletions test/webpack-modules/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"scripts": {
"test": "../node_modules/.bin/webpack && node dist/main.js"
}
}
4 changes: 4 additions & 0 deletions test/webpack-modules/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
mode: "production",
entry: "./index"
}

0 comments on commit 6aa4b28

Please sign in to comment.