From: dotnetCarpenter Date: Sat, 8 Oct 2016 19:18:25 +0000 (-0200) Subject: halt dev of chrome base solution X-Git-Tag: 2.3.5~5^2~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5c18e89d271fd515eaa2cbd2fb393fe133fb0bbc;p=svg.js.git halt dev of chrome base solution --- diff --git a/.config/chrome_linux.js b/.config/chrome_linux.js new file mode 100644 index 0000000..5820a19 --- /dev/null +++ b/.config/chrome_linux.js @@ -0,0 +1,42 @@ +'use strict' + +if(process.platform === 'linux') { + const child_process = require('child_process') + const exec = child_process.exec + const execSync = bind2(child_process.execSync, { encoding: 'utf8' })//spawnSync + const browsers = ['google-chrome', 'chromium-browser'] + + const findBrowser = msg => { + console.log(msg) + const browserString = /\/(.*)$/ + const browser = msg.match(browserString) + console.log(browsers) + if(browsers[browser]) browsers[browser] = true + } + + const tryCompose = (f, parameter) => { + //FIXME: + const x = f.splice(0, 1)[0] + if(Array.isArray(f) && f.length > 0) return tryCompose(f, parameter) + // + + try { + return x(parameter) + } + catch(e) { + console.warn(e.message) + } + } + + tryCompose([findBrowser, execSync], 'which google-chrome') + //findBrowser(execSync('which chromium-browser')) + + if(browsers[0]) return + if(!browsers[0] && browsers[1]) exec('export CHROME_BIN=chromium-browser') + if(browsers.every(b => !b)) console.warn('You need to install either Chrome or Chromium to run the test suite.') + +} + +function bind2(f, bound) { + return (parameter) => f(parameter, bound) +} \ No newline at end of file diff --git a/.config/karma.conf.js b/.config/karma.conf.js new file mode 100644 index 0000000..2a7dae4 --- /dev/null +++ b/.config/karma.conf.js @@ -0,0 +1,91 @@ +// 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: [ + '.config/pretest.js', + { + pattern: 'spec/fixture.css', + included: false, + served: true + }, + { + pattern: 'spec/fixture.svg', + included: false, + served: true + }, + 'dist/svg.js', + 'spec/spec/**/*.js' + ], + + + // 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: {}, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // 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: ['Chrome'], + + + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + + + // 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 + }) + + if(process.env.TRAVIS){ + config.browsers = ['Chrome_travis_ci']; + } +} diff --git a/.config/pretest.js b/.config/pretest.js new file mode 100644 index 0000000..1ccaf89 --- /dev/null +++ b/.config/pretest.js @@ -0,0 +1,20 @@ +'use strict' + +function get(uri) { + var xhr = new XMLHttpRequest() + xhr.open('GET', uri, false) + xhr.send() + if(xhr.status !== 200) + console.error('SVG.js fixture could not be loaded. Tests will fail.') + return xhr.responseText +} + +function main() { + var style = document.createElement("style") + document.head.appendChild(style) + style.sheet.insertRule( get('/base/spec/fixture.css'), 0 ) + + document.body.innerHTML = get('/base/spec/fixture.svg') +} + +main() diff --git a/dist/svg.js b/dist/svg.js index 595da34..4cda13a 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7 +6,7 @@ * @copyright Wout Fierens * @license MIT * -* BUILT: Tue Oct 04 2016 15:03:44 GMT+0200 (CEST) +* BUILT: Wed Oct 05 2016 15:27:51 GMT+0200 (CEST) */ (function(root, factory) { if (typeof define === 'function' && define.amd) { diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index e2ecc37..0000000 --- a/karma.conf.js +++ /dev/null @@ -1,91 +0,0 @@ -// 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/pretest.js', - { - pattern: 'spec/fixture.css', - included: false, - served: true - }, - { - pattern: 'spec/fixture.svg', - included: false, - served: true - }, - 'dist/svg.js', - 'spec/spec/**/*.js' - ], - - - // 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: {}, - - - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], - - - // 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: ['Chrome'], - - - customLaunchers: { - Chrome_travis_ci: { - base: 'Chrome', - flags: ['--no-sandbox'] - } - }, - - - // 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 - }) - - if(process.env.TRAVIS){ - config.browsers = ['Chrome_travis_ci']; - } -} diff --git a/package.json b/package.json index 0158eae..cee6ee6 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,8 @@ "typings": "./svg.js.d.ts", "scripts": { "build": "gulp", - "test": "karma start karma.conf.js --single-run" + "pretest": "node .config/chrome_linux.js", + "test": "karma start .config/karma.conf.js --single-run" }, "devDependencies": { "del": "^2.2.0", diff --git a/spec/pretest.js b/spec/pretest.js deleted file mode 100644 index 1ccaf89..0000000 --- a/spec/pretest.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict' - -function get(uri) { - var xhr = new XMLHttpRequest() - xhr.open('GET', uri, false) - xhr.send() - if(xhr.status !== 200) - console.error('SVG.js fixture could not be loaded. Tests will fail.') - return xhr.responseText -} - -function main() { - var style = document.createElement("style") - document.head.appendChild(style) - style.sheet.insertRule( get('/base/spec/fixture.css'), 0 ) - - document.body.innerHTML = get('/base/spec/fixture.svg') -} - -main()