From e03e0323edd1e6580a355952d6cfc1a4436b42df Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Mon, 12 Nov 2018 09:36:48 +0100 Subject: started to add es6 tests using svgdom as fallback in case no dom is found --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'package.json') diff --git a/package.json b/package.json index 3c8366e..e89abd7 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "server": "npx http-server ./ -d", "test": "npx karma start .config/karma.conf.js", "test:ci": "karma start .config/karma.conf.saucelabs.js", + "test:quick": "node -r esm ./spec/run.js || true", "build:polyfills": "npx rollup -c .config/rollup.polyfills.js", "prepublishOnly": "npm run build && npm run build:polyfills && npm test", "postPublish": "echo Please upload a zip to the github release containing the dist, license and changelog" @@ -82,7 +83,7 @@ "eslint-plugin-standard": "^4.0.0", "esm": "^3.0.84", "http-server": "^0.11.1", - "innersvg-polyfill": "0.0.2", + "jasmine": "^3.3.0", "jasmine-core": "^3.3.0", "karma": "^3.1.1", "karma-chrome-launcher": "^2.2.0", @@ -97,8 +98,7 @@ "rollup-plugin-node-resolve": "^3.4.0", "rollup-plugin-terser": "^3.0.0", "rollup-plugin-uglify": "^6.0.0", - "rollup-plugin-uglify-es": "0.0.1", - "svgdom": "latest" + "svgdom": "github:svgdotjs/svgdom" }, "browserslist": [ "last 1 version", -- cgit v1.2.3 From 54d407608efec1ca37f18178082bb9703cf8bc1e Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Tue, 13 Nov 2018 10:10:32 +0100 Subject: add config for karma to run es6 tests --- .config/karma.es6.js | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 5 ++- 2 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 .config/karma.es6.js (limited to 'package.json') diff --git a/.config/karma.es6.js b/.config/karma.es6.js new file mode 100644 index 0000000..a831334 --- /dev/null +++ b/.config/karma.es6.js @@ -0,0 +1,115 @@ +// Karma configuration +// Generated on Tue Oct 04 2016 13:53:46 GMT+0200 (CEST) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '../', + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'spec/RAFPlugin.js', + { + pattern: 'spec/fixtures/fixture.css', + included: false, + served: true + }, + { + pattern: 'spec/fixtures/pixel.png', + included: false, + served: true + }, + { + pattern: 'src/**/*.js', + included: false, + served: true, + type: 'modules' + }, + { + pattern: 'spec/helpers.js', + included: false, + served: true, + type: 'module' + }, + { + pattern: 'spec/setupBrowser.js', + included: true, + type: 'module' + }, + { + pattern: 'spec/spec/types/*.js', + included: true, + type: 'module' + } + ], + + proxies: { + '/fixtures/': '/base/spec/fixtures/' + }, + + + // list of files to exclude + exclude: [], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + // 'src/**/*.js': ['coverage'] + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'/*, 'coverage'*/], + + + // configure the coverage reporter + coverageReporter: { + // Specify a reporter type. + type: 'lcov', + dir: 'coverage/', + subdir: function(browser) { + // normalization process to keep a consistent browser name accross different OS + return browser.toLowerCase().split(/[ /-]/)[0]; // output the results into: './coverage/firefox/' + } + }, + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: [/*'ChromeHeadless', */'FirefoxHeadless'], + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/package.json b/package.json index e89abd7..65f38ca 100644 --- a/package.json +++ b/package.json @@ -52,14 +52,15 @@ "typings": "./svg.js.d.ts", "scripts": { "build": "npm run fix && npm run rollup", + "build:polyfills": "npx rollup -c .config/rollup.polyfills.js", "fix": "npx eslint ./src --fix", "lint": "eslint ./src", "rollup": "rollup -c .config/rollup.config.js", "server": "npx http-server ./ -d", "test": "npx karma start .config/karma.conf.js", "test:ci": "karma start .config/karma.conf.saucelabs.js", - "test:quick": "node -r esm ./spec/run.js || true", - "build:polyfills": "npx rollup -c .config/rollup.polyfills.js", + "test:svgdom": "node -r esm ./spec/run.js || true", + "test:es6": "npx karma start .config/karma.es6.js --single-run", "prepublishOnly": "npm run build && npm run build:polyfills && npm test", "postPublish": "echo Please upload a zip to the github release containing the dist, license and changelog" }, -- cgit v1.2.3 From 57d7dd0232b283874f09bb08e6d05ccfc6d1da24 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Tue, 13 Nov 2018 11:19:05 +0100 Subject: make es5 tests --- .gitignore | 1 + package-lock.json | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 + rollup.tests.js | 29 +++++++++ spec/SpecRunner.html | 6 +- 5 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 rollup.tests.js (limited to 'package.json') diff --git a/.gitignore b/.gitignore index 9fa0db9..2b1e47e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ node_modules/ .vscode/ coverage/ fonts/ +spec/es5TestBundle.js .env diff --git a/package-lock.json b/package-lock.json index 95b4822..d51e3ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1356,6 +1356,12 @@ "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, + "async-array-reduce": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/async-array-reduce/-/async-array-reduce-0.2.1.tgz", + "integrity": "sha1-yL4BCitc0A3qlsgRFgNGk9/dgtE=", + "dev": true + }, "async-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", @@ -3309,6 +3315,15 @@ "integrity": "sha512-cebqLtV8KOZfw0UI8TEFWxtczxxC1jvyUvx6H4fyp1K1FN7A4Q+uggVUlOsI1K8AGU0rwOGqP8nCapdrw8CYQg==", "dev": true }, + "expand-tilde": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-1.2.2.tgz", + "integrity": "sha1-C4HrqJflo9MdHD0QL48BRB5VlEk=", + "dev": true, + "requires": { + "os-homedir": "^1.0.1" + } + }, "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", @@ -3647,6 +3662,12 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, + "fs-exists-sync": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz", + "integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=", + "dev": true + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4318,6 +4339,44 @@ } } }, + "global-modules": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-0.2.3.tgz", + "integrity": "sha1-6lo77ULG1s6ZWk+KEmm12uIjgo0=", + "dev": true, + "requires": { + "global-prefix": "^0.1.4", + "is-windows": "^0.2.0" + }, + "dependencies": { + "is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=", + "dev": true + } + } + }, + "global-prefix": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-0.1.5.tgz", + "integrity": "sha1-jTvGuNo8qBEqFg2NSW/wRiv+948=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.0", + "ini": "^1.3.4", + "is-windows": "^0.2.0", + "which": "^1.2.12" + }, + "dependencies": { + "is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=", + "dev": true + } + } + }, "globals": { "version": "11.9.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.9.0.tgz", @@ -4452,6 +4511,15 @@ "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "dev": true }, + "has-glob": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/has-glob/-/has-glob-0.1.1.tgz", + "integrity": "sha1-omHEwqbGZ+DHe3AKfyl8Oe86pYk=", + "dev": true, + "requires": { + "is-glob": "^2.0.1" + } + }, "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -4514,6 +4582,15 @@ "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", "dev": true }, + "homedir-polyfill": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", + "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", + "dev": true, + "requires": { + "parse-passwd": "^1.0.0" + } + }, "hosted-git-info": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.1.tgz", @@ -4884,6 +4961,23 @@ "number-is-nan": "^1.0.0" } }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + } + } + }, "is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -4991,6 +5085,12 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, + "is-valid-glob": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-0.3.0.tgz", + "integrity": "sha1-1LVcafUYhvm2XHDWwmItN+KfSP4=", + "dev": true + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -5330,6 +5430,15 @@ "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, + "lazy-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", + "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", + "dev": true, + "requires": { + "set-getter": "^0.1.0" + } + }, "lazystream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", @@ -5502,6 +5611,34 @@ "object-visit": "^1.0.0" } }, + "matched": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/matched/-/matched-0.4.4.tgz", + "integrity": "sha1-Vte36xgDPwz5vFLrIJD6x9weifo=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "async-array-reduce": "^0.2.0", + "extend-shallow": "^2.0.1", + "fs-exists-sync": "^0.1.0", + "glob": "^7.0.5", + "has-glob": "^0.1.1", + "is-valid-glob": "^0.3.0", + "lazy-cache": "^2.0.1", + "resolve-dir": "^0.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "math-random": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", @@ -6117,6 +6254,12 @@ "error-ex": "^1.2.0" } }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, "parseqs": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", @@ -6891,6 +7034,16 @@ "path-parse": "^1.0.5" } }, + "resolve-dir": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-0.1.1.tgz", + "integrity": "sha1-shklmlYC+sXFxJatiUpujMQwJh4=", + "dev": true, + "requires": { + "expand-tilde": "^1.2.2", + "global-modules": "^0.2.3" + } + }, "resolve-from": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", @@ -7034,6 +7187,15 @@ } } }, + "rollup-plugin-multi-entry": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-multi-entry/-/rollup-plugin-multi-entry-2.0.2.tgz", + "integrity": "sha512-TY72fCVJvcEAQBpBzkXykoYQx2fz0B20EVtcbh0WZaYr5eBu3U1dRPzgMt6aO8MePWWOdcmgoBtG6PhmYJr4Ew==", + "dev": true, + "requires": { + "matched": "^0.4.4" + } + }, "rollup-plugin-node-resolve": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.4.0.tgz", @@ -7298,6 +7460,15 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, + "set-getter": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", + "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", + "dev": true, + "requires": { + "to-object-path": "^0.3.0" + } + }, "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", diff --git a/package.json b/package.json index 65f38ca..b3701fe 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "scripts": { "build": "npm run fix && npm run rollup", "build:polyfills": "npx rollup -c .config/rollup.polyfills.js", + "build:tests": "npx rollup -c rollup.tests.js", "fix": "npx eslint ./src --fix", "lint": "eslint ./src", "rollup": "rollup -c .config/rollup.config.js", @@ -96,6 +97,7 @@ "rollup-plugin-babel": "^4.0.3", "rollup-plugin-commonjs": "^9.2.0", "rollup-plugin-filesize": "^5.0.1", + "rollup-plugin-multi-entry": "^2.0.2", "rollup-plugin-node-resolve": "^3.4.0", "rollup-plugin-terser": "^3.0.0", "rollup-plugin-uglify": "^6.0.0", diff --git a/rollup.tests.js b/rollup.tests.js new file mode 100644 index 0000000..c821a79 --- /dev/null +++ b/rollup.tests.js @@ -0,0 +1,29 @@ +import babel from 'rollup-plugin-babel' +import multiEntry from 'rollup-plugin-multi-entry' + +export default { + input: ['spec/setupBrowser.js', 'spec/spec/types/*.js'], + output: { + file: 'spec/es5TestBundle.js', + name: 'SVGTests', + sourceMap: true, + format: 'iife' + }, + plugins: [ + babel({ + include: 'src/**', + runtimeHelpers: true, + babelrc: false, + presets: [["@babel/preset-env", { + modules: false, + }]], + // plugins: [["@babel/plugin-transform-runtime", { + // corejs: false, + // helpers: true, + // regenerator: true, + // useESModules: true + // }]] + }), + multiEntry() + ] +} diff --git a/spec/SpecRunner.html b/spec/SpecRunner.html index c24aac5..c0bea56 100644 --- a/spec/SpecRunner.html +++ b/spec/SpecRunner.html @@ -56,7 +56,9 @@ - + + + -- cgit v1.2.3