summaryrefslogtreecommitdiffstats
path: root/.config
diff options
context:
space:
mode:
authordotnetCarpenter <jon.ronnenberg@gmail.com>2016-10-08 17:18:25 -0200
committerdotnetCarpenter <jon.ronnenberg@gmail.com>2016-10-08 17:18:25 -0200
commit5c18e89d271fd515eaa2cbd2fb393fe133fb0bbc (patch)
tree66e97344ddc12e57138eec480d0e9c7f96c88007 /.config
parent74aab4ca721acdb34ec16e5413e906ad24b1b5c9 (diff)
downloadsvg.js-5c18e89d271fd515eaa2cbd2fb393fe133fb0bbc.tar.gz
svg.js-5c18e89d271fd515eaa2cbd2fb393fe133fb0bbc.zip
halt dev of chrome base solution
Diffstat (limited to '.config')
-rw-r--r--.config/chrome_linux.js42
-rw-r--r--.config/karma.conf.js91
-rw-r--r--.config/pretest.js20
3 files changed, 153 insertions, 0 deletions
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()