--- /dev/null
+'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
--- /dev/null
+// 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'];
+ }
+}
--- /dev/null
+'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()
* @copyright Wout Fierens <wout@woutfierens.com>
* @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) {
+++ /dev/null
-// 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'];
- }
-}
"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",
+++ /dev/null
-'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()