Skip to content

Commit

Permalink
Merge pull request cBioPortal#30 from cBioPortal/testing-framework
Browse files Browse the repository at this point in the history
Set up karma testing for oncoprint
  • Loading branch information
adamabeshouse authored and onursumer committed May 18, 2022
1 parent 77bbc4d commit 794b497
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/oncoprintjs/.travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
72 changes: 72 additions & 0 deletions packages/oncoprintjs/karma.conf.js
Original file line number Diff line number Diff line change
@@ -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
})
}
13 changes: 11 additions & 2 deletions packages/oncoprintjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions packages/oncoprintjs/src/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe("test", function() {
it("should have oncoprint object", function() {
expect(window.Oncoprint).toBeDefined();
});
});

0 comments on commit 794b497

Please sign in to comment.