Skip to content

Commit ad71efd

Browse files
committed
Adds tests for rollup and webpack - e.g. the 'module' and 'sideEffects' options in the package.json
1 parent 0ff4aef commit ad71efd

File tree

11 files changed

+57
-2
lines changed

11 files changed

+57
-2
lines changed

.github/workflows/CI.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,15 @@ jobs:
2222
2323
- name: "ES Modules Test"
2424
run: |
25-
cd test/esm
25+
cd test/esm-node-native
26+
npm run test
27+
28+
- name: "Rollup Tree-shaking Test"
29+
run: |
30+
cd test/rollup-modules
31+
npm run test
32+
33+
- name: "Webpack Tree-shaking Test"
34+
run: |
35+
cd test/webpack-modules
2636
npm run test

test/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package-lock.json
2+
rollup-modules/output
3+
webpack-modules/dist
File renamed without changes.
File renamed without changes.

test/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"dependencies": {
3-
"tslib": "file:.."
3+
"tslib": "file:..",
4+
"rollup": "2.28.2",
5+
"@rollup/plugin-node-resolve": "9.0.0",
6+
"webpack": "4.44.2",
7+
"webpack-cli": "3.3.12"
48
}
59
}

test/rollup-modules/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { __awaiter } from "tslib";
2+
3+
export const testFunction = (textToPrint) => __awaiter(void 0, void 0, void 0, function* () {
4+
console.log(`State: ${textToPrint}`);
5+
});
6+
7+
testFunction("Works")

test/rollup-modules/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"scripts": {
3+
"test": "../node_modules/.bin/rollup -c rollup.config.js && node output/index.js"
4+
}
5+
}

test/rollup-modules/rollup.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { nodeResolve } from '@rollup/plugin-node-resolve';
2+
3+
export default {
4+
input: 'index.js',
5+
output: {
6+
dir: 'output',
7+
format: 'cjs'
8+
},
9+
plugins: [nodeResolve()]
10+
};

test/webpack-modules/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { __awaiter } from "tslib";
2+
3+
export const testFunction = (textToPrint) => __awaiter(void 0, void 0, void 0, function* () {
4+
console.log(`State: ${textToPrint}`);
5+
});
6+
7+
testFunction("Works")

test/webpack-modules/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"scripts": {
3+
"test": "../node_modules/.bin/webpack && node dist/main.js"
4+
}
5+
}

0 commit comments

Comments
 (0)