diff --git a/package-lock.json b/package-lock.json index f569b6e..fcb67ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,12 +5,12 @@ "requires": true, "dependencies": { "@babel/runtime": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.3.tgz", - "integrity": "sha512-kq6anf9JGjW8Nt5rYfEuGRaEAaH1mkv3Bbu6rYvLOpPh/RusSJXuKPEAoZ7L7gybZkchE8+NV5g9vKF4AGAtsA==", + "version": "7.23.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.1.tgz", + "integrity": "sha512-hC2v6p8ZSI/W0HUzh3V8C5g+NwSKzKPtJwSpTjwl0o297GP9+ZLQSkdvHz46CM3LqyoXxq+5G9komY+eSqSO0g==", "dev": true, "requires": { - "regenerator-runtime": "^0.13.2" + "regenerator-runtime": "^0.14.0" } }, "@mparticle/web-kit-wrapper": { @@ -22,9 +22,9 @@ } }, "@mparticle/web-sdk": { - "version": "2.11.5", - "resolved": "https://registry.npmjs.org/@mparticle/web-sdk/-/web-sdk-2.11.5.tgz", - "integrity": "sha512-GAo+CcGpz+jbdfBJ0foBOBPK9MyTB+4DQR4DFPwpIe2WbFCIFqlssjGXFkwX9yEjuj//c5ZFTdPf9snU1UJvVQ==", + "version": "2.23.4", + "resolved": "https://registry.npmjs.org/@mparticle/web-sdk/-/web-sdk-2.23.4.tgz", + "integrity": "sha512-jJb0DYiXPy2bAKGjiMn+oH0iIN5fDmL+YCJ1Uy7r6kyIMDaOaXWXLk6ctzO8yOdDCwGuR6shRaY5dwrmP9N8lQ==", "dev": true, "requires": { "@babel/runtime": "^7.6.0", @@ -3585,9 +3585,9 @@ } }, "regenerator-runtime": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", - "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==", + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", "dev": true }, "regex-not": { @@ -3910,9 +3910,9 @@ "dev": true }, "slugify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.4.0.tgz", - "integrity": "sha512-FtLNsMGBSRB/0JOE2A0fxlqjI6fJsgHGS13iTuVT28kViI4JjUiNqp/vyis0ZXYcMnpR3fzGNkv+6vRlI2GwdQ==", + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.6.tgz", + "integrity": "sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==", "dev": true }, "snapdragon": { diff --git a/package.json b/package.json index 77c888c..423fbe5 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,14 @@ "scripts": { "testKarma": "node test/boilerplate/test-karma.js", "build": "rollup --config rollup.config.js", + "build:test": "ENVIRONMENT=production rollup --config rollup.test.config.js", "watch": "rollup --config rollup.config.js -w", + "test": "npm run build && npm run build:test && DEBUG=false karma start test/karma.config.js", + "test:debug": "npm run build && npm run build:test && DEBUG=true karma start test/karma.config.js", "testEndToEnd": "browserify node_modules/@mparticle/web-kit-wrapper/end-to-end-testapp/index.js -v -o test/end-to-end-testapp/build/compilation.js && open http://localhost:8082/node_modules/@mparticle/web-kit-wrapper/end-to-end-testapp/index.html && node node_modules/@mparticle/web-kit-wrapper/end-to-end-testapp/server" }, "devDependencies": { - "@mparticle/web-sdk": "^2.11.1", + "@mparticle/web-sdk": "^2.23.4", "chai": "^4.2.0", "karma": "^5.1.0", "karma-chai": "^0.1.0", diff --git a/rollup.test.config.js b/rollup.test.config.js new file mode 100644 index 0000000..ab7e925 --- /dev/null +++ b/rollup.test.config.js @@ -0,0 +1,14 @@ +const { ENVIRONMENT } = process.env; + +import resolve from 'rollup-plugin-node-resolve'; +import commonjs from 'rollup-plugin-commonjs'; + +export default { + input: 'test/tests.js', + output: { + file: 'test/test-bundle.js', + format: 'iife', + name: 'mParticleTests', + }, + plugins: [resolve(), commonjs()], +}; diff --git a/test/config.js b/test/config.js new file mode 100644 index 0000000..c854739 --- /dev/null +++ b/test/config.js @@ -0,0 +1,3 @@ +window.mParticle.addForwarder = function(forwarder) { + window.mParticle.forwarder = new forwarder.constructor(); +}; diff --git a/test/karma.config.js b/test/karma.config.js new file mode 100644 index 0000000..c21117b --- /dev/null +++ b/test/karma.config.js @@ -0,0 +1,39 @@ +const { DEBUG } = process.env || 'false'; + +const files = [ + '../node_modules/@mparticle/web-sdk/dist/mparticle.js', + '../node_modules/mocha/mocha.js', + '../node_modules/should/should.js', + 'config.js', + '../dist/DoubleClick-Kit.iife.js', + 'lib/mockhttprequest.js', + './test-bundle.js', +]; + +let browsers = ['ChromeHeadless', 'FirefoxHeadless']; +let singleRun = true; + +if (DEBUG === 'true') { + browsers = ['Chrome']; + singleRun = false; +} + +module.exports = function(config) { + config.set({ + frameworks: ['mocha', 'chai'], + files, + reporters: ['progress'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + browsers, + concurrency: Infinity, + customLaunchers: { + FirefoxHeadless: { + base: 'Firefox', + flags: ['-headless'], + }, + }, + singleRun, + }); +};