diff --git a/.travis.yml b/.travis.yml index 59d5f5d..622d2a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js env: - - SLIMERJSLAUNCHER=$(which firefox) DISPLAY=:99.0 + - DISPLAY=:99.0 CHROME_BIN=chromium-browser branches: only: - master @@ -10,7 +10,3 @@ addons: firefox: latest before_script: - sh -e /etc/init.d/xvfb start - - npm install -g slimerjs qunitjs -script: - - qunit tests - - slimerjs tests/run-qunit.js tests/index.html diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..fedfc5d --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,24 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + + karma: { + unit: { + configFile: 'karma.conf.js' + } + }, + coveralls: { + options: { + coverageDir: 'tests/coverage/', + force: true + } + } + }); + + grunt.loadNpmTasks('grunt-karma'); + grunt.loadNpmTasks('grunt-karma-coveralls'); + + grunt.registerTask('test', ['karma', 'coveralls']); + +}; diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..7887f5d --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,55 @@ +module.exports = function(config) { + var configuration = { + basePath: './tests', + + frameworks: ['qunit'], + + files: [ + '../random/*.js', + '**/*.js' + ], + + exclude: [ + ], + + preprocessors: { + '../!(tests)/*.js': ['coverage'] + }, + + reporters: ['progress', 'coverage'], + + port: 9876, + + colors: true, + + logLevel: config.LOG_INFO, + + autoWatch: true, + + browsers: ['Chrome', 'Firefox'], + + singleRun: true, + + browserNoActivityTimeout: 30000, + + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + + coverageReporter: { + reporters: [ + { type: "lcov", dir: "coverage/" }, + { type: 'text-summary' } + ] + }, + }; + + if (process.env.TRAVIS) { + configuration.browsers = ['Chrome_travis_ci']; + } + + config.set(configuration); +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..d86650e --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "octo", + "devDependencies": { + "grunt": "*", + "grunt-karma": "*", + "grunt-karma-coveralls": "*", + "karma": "*", + "karma-chrome-launcher": "*", + "karma-coverage": "*", + "karma-firefox-launcher": "*", + "karma-qunit": "*", + "qunitjs": "*" + }, + "scripts": { + "test": "grunt test --verbose" + } +} diff --git a/random/mersennetwister.js b/random/mersennetwister.js index f537461..bbd8611 100644 --- a/random/mersennetwister.js +++ b/random/mersennetwister.js @@ -84,5 +84,3 @@ function MersenneTwister() return this.int32() * (1.0 / 4294967296.0); } } - -try{ module.exports.MersenneTwister = MersenneTwister; }catch(e){} diff --git a/tests/index.html b/tests/index.html index 1735602..a1ba9b7 100644 --- a/tests/index.html +++ b/tests/index.html @@ -10,7 +10,11 @@
+ + + +