From e1b82f51e21b6329d783406cfbc9c847c798ef23 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Wed, 2 Oct 2019 14:32:29 +0200 Subject: [PATCH] add modularity integration test --- js/tests/integration/bundle-modularity.js | 7 ++++ .../integration/rollup.bundle-modularity.js | 17 +++++++++ package-lock.json | 37 +++++++++++++++++++ package.json | 3 +- 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 js/tests/integration/bundle-modularity.js create mode 100644 js/tests/integration/rollup.bundle-modularity.js diff --git a/js/tests/integration/bundle-modularity.js b/js/tests/integration/bundle-modularity.js new file mode 100644 index 0000000000..07c6674e65 --- /dev/null +++ b/js/tests/integration/bundle-modularity.js @@ -0,0 +1,7 @@ +import 'popper.js' +import Tooltip from '../../dist/tooltip' + +window.addEventListener('load', () => { + [...document.querySelectorAll('[data-toggle="tooltip"]')] + .map(tooltipNode => new Tooltip(tooltipNode)) +}) diff --git a/js/tests/integration/rollup.bundle-modularity.js b/js/tests/integration/rollup.bundle-modularity.js new file mode 100644 index 0000000000..68313275bd --- /dev/null +++ b/js/tests/integration/rollup.bundle-modularity.js @@ -0,0 +1,17 @@ +/* eslint-env node */ + +const commonjs = require('rollup-plugin-commonjs') +const configRollup = require('./rollup.bundle') + +const config = { + ...configRollup, + input: 'js/tests/integration/bundle-modularity.js', + output: { + file: 'js/coverage/bundle-modularity.js', + format: 'iife' + } +} + +config.plugins.unshift(commonjs()) + +module.exports = config diff --git a/package-lock.json b/package-lock.json index b1d37c7f6c..55a04c9ed4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6151,6 +6151,15 @@ "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", "dev": true }, + "is-reference": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", + "integrity": "sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==", + "dev": true, + "requires": { + "@types/estree": "0.0.39" + } + }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", @@ -7142,6 +7151,15 @@ "yallist": "^2.1.2" } }, + "magic-string": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.4.tgz", + "integrity": "sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, "make-dir": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", @@ -9867,6 +9885,19 @@ "rollup-pluginutils": "^2.8.1" } }, + "rollup-plugin-commonjs": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz", + "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==", + "dev": true, + "requires": { + "estree-walker": "^0.6.1", + "is-reference": "^1.1.2", + "magic-string": "^0.25.2", + "resolve": "^1.11.0", + "rollup-pluginutils": "^2.8.1" + } + }, "rollup-plugin-istanbul": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/rollup-plugin-istanbul/-/rollup-plugin-istanbul-2.0.1.tgz", @@ -10729,6 +10760,12 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, + "sourcemap-codec": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", + "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", + "dev": true + }, "spdx-correct": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", diff --git a/package.json b/package.json index 703a4dcb77..bb4bc810ea 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "js-test": "npm-run-all --parallel js-test-karma js-test-integration", "js-debug": "cross-env DEBUG=true karma start js/tests/karma.conf.js", "js-test-karma": "karma start js/tests/karma.conf.js", - "js-test-integration": "rollup --config js/tests/integration/rollup.bundle.js", + "js-test-integration": "rollup --config js/tests/integration/rollup.bundle.js && rollup --config js/tests/integration/rollup.bundle-modularity.js", "js-test-cloud": "cross-env BROWSER=true npm run js-test-karma", "lint": "npm-run-all --parallel js-lint css-lint", "docs": "npm-run-all docs-build docs-lint", @@ -125,6 +125,7 @@ "postcss-cli": "^6.1.3", "rollup": "^1.21.4", "rollup-plugin-babel": "^4.3.3", + "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-istanbul": "^2.0.1", "rollup-plugin-node-resolve": "^5.2.0", "serve": "^11.1.0",