diff --git a/packages/oncoprintjs/.travis.yml b/packages/oncoprintjs/.travis.yml index 81f811d357a..4f71d6f04e2 100644 --- a/packages/oncoprintjs/.travis.yml +++ b/packages/oncoprintjs/.travis.yml @@ -1,8 +1,10 @@ language: node_js node_js: - '6' -before_deploy: +script: - npm run build +- npm run test +before_deploy: - mv ./dist/oncoprint-bundle.js ./index.js - cp -r ./dist/* ./ - rm -rf dist diff --git a/packages/oncoprintjs/karma.conf.js b/packages/oncoprintjs/karma.conf.js new file mode 100644 index 00000000000..5c9e8143007 --- /dev/null +++ b/packages/oncoprintjs/karma.conf.js @@ -0,0 +1,72 @@ +// Karma configuration +// Generated on Mon Sep 18 2017 14:28:54 GMT-0400 (EDT) + +var argv = require('yargs').argv; + +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: [ + 'dist/oncoprint-bundle.js', + 'src/test/*.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: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: !argv.watch, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/packages/oncoprintjs/package.json b/packages/oncoprintjs/package.json index ffe4f768ef7..e2bc0bddf3b 100644 --- a/packages/oncoprintjs/package.json +++ b/packages/oncoprintjs/package.json @@ -3,7 +3,9 @@ "description": "A data visualization for cancer genomic data.", "scripts": { "clean": "rm -rf dist", - "build": "npm run clean && gulp" + "build": "npm run clean && gulp", + "test": "karma start karma.conf.js", + "test:watch": "npm run test -- --watch" }, "repository": { "type": "git", @@ -37,7 +39,14 @@ "devDependencies": { "browserify": "^14.0.0", "gulp": "^3.9.1", - "gulp-shell": "^0.6.3" + "gulp-shell": "^0.6.3", + "jasmine-core": "^2.8.0", + "karma": "^1.7.1", + "karma-jasmine": "^1.1.0", + "karma-phantomjs-launcher": "^1.0.4", + "phantomjs-polyfill": "0.0.2", + "phantomjs-prebuilt": "^2.1.15", + "yargs": "^9.0.1" }, "dependencies": { "express": "^4.15.3", diff --git a/packages/oncoprintjs/src/test/test.js b/packages/oncoprintjs/src/test/test.js new file mode 100644 index 00000000000..c59e5a80040 --- /dev/null +++ b/packages/oncoprintjs/src/test/test.js @@ -0,0 +1,5 @@ +describe("test", function() { + it("should have oncoprint object", function() { + expect(window.Oncoprint).toBeDefined(); + }); +});