Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds tests for rollup and webpack - e.g. the 'module' and 'sideEffect…
…s' options in the package.json
  • Loading branch information
orta committed Sep 29, 2020
commit ad71efd2aa8370358c11a27725b5d629adcfdf6b
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 && node 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"
}