Skip to content

Commit

Permalink
WORKING: npm run test
Browse files Browse the repository at this point in the history
  • Loading branch information
1ambda committed Dec 28, 2016
1 parent 94bedef commit ea7f186
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 42 deletions.
8 changes: 0 additions & 8 deletions zeppelin-web/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,18 +597,10 @@ module.exports = function(grunt) {
grunt.task.run([
'clean:server',
'concurrent:webpack',
'postcss',
]);
});

grunt.registerTask('test', [
'clean:server',
'babel',
'wiredep',
'concurrent:test',
'postcss',
'babel:dev',
'connect:test',
'karma'
]);

Expand Down
2 changes: 2 additions & 0 deletions zeppelin-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"karma": "~1.3.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "~1.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.1",
"load-grunt-tasks": "^0.4.0",
"postcss-loader": "^1.2.1",
"raw-loader": "^0.5.1",
Expand Down
25 changes: 17 additions & 8 deletions zeppelin-web/test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Generated on 2014-08-29 using
// generator-karma 0.8.3

var webpackConfig = require('../webpack.config');

module.exports = function(config) {
'use strict';

Expand Down Expand Up @@ -70,12 +72,10 @@ module.exports = function(config) {
'bower_components/ngclipboard/dist/ngclipboard.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
'.tmp/app/app.js',
'.tmp/app/app.controller.js',
'.tmp/app/tabledata/transformation.js',
'.tmp/app/**/*.js',
'.tmp/components/**/*.js',
'test/spec/**/*.js'

'src/index.js',
// 'test/spec/**/*.js',
{pattern: 'test/spec/**/*.js', watched: false},
],

// list of files / patterns to exclude
Expand All @@ -100,8 +100,15 @@ module.exports = function(config) {

reporters: ['coverage','progress'],

webpack: webpackConfig,
webpackMiddleware: {
stats: 'errors-only'
},

preprocessors: {
'src/*/{*.js,!(test)/**/*.js}': 'coverage'
'src/*/{*.js,!(test)/**/*.js}': 'coverage',
'src/index.js': ['webpack', 'sourcemap',],
'test/spec/**/*.js': ['webpack', 'sourcemap',],
},

coverageReporter: {
Expand All @@ -114,7 +121,9 @@ module.exports = function(config) {
plugins: [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-coverage'
'karma-coverage',
'karma-webpack',
'karma-sourcemap-loader',
],

// Continuous Integration mode
Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web/test/spec/controllers/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

describe('Controller: MainCtrl', function() {
beforeEach(module('zeppelinWebApp'));
beforeEach(angular.mock.module('zeppelinWebApp'));

var scope;
var rootScope;
Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web/test/spec/controllers/nav.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
describe('Controller: NavCtrl', function() {
// load the controller's module
beforeEach(module('zeppelinWebApp'));
beforeEach(angular.mock.module('zeppelinWebApp'));
var NavCtrl;
var scope;
// Initialize the controller and a mock scope
Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web/test/spec/controllers/notebook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

describe('Controller: NotebookCtrl', function() {
beforeEach(module('zeppelinWebApp'));
beforeEach(angular.mock.module('zeppelinWebApp'));

var scope;

Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web/test/spec/controllers/notename.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

describe('Controller: NotenameCtrl', function() {
beforeEach(module('zeppelinWebApp'));
beforeEach(angular.mock.module('zeppelinWebApp'));

var scope;
var ctrl;
Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web/test/spec/controllers/paragraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe('Controller: ParagraphCtrl', function() {

beforeEach(module('zeppelinWebApp'));
beforeEach(angular.mock.module('zeppelinWebApp'));

var scope;
var websocketMsgSrvMock = {};
Expand Down
3 changes: 1 addition & 2 deletions zeppelin-web/test/spec/directives/ngenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe('Directive: ngEnter', function() {

// load the directive's module
beforeEach(module('zeppelinWebApp'));
beforeEach(angular.mock.module('zeppelinWebApp'));

var element;
var scope;
Expand All @@ -25,4 +25,3 @@ describe('Directive: ngEnter', function() {
expect(element.text()).toBe('this is the ngEnter directive');
}));*/
});

2 changes: 1 addition & 1 deletion zeppelin-web/test/spec/factory/noteList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Factory: NoteList', function() {
var noteList;

beforeEach(function() {
module('zeppelinWebApp');
angular.mock.module('zeppelinWebApp');

inject(function($injector) {
noteList = $injector.get('noteListDataFactory');
Expand Down
4 changes: 4 additions & 0 deletions zeppelin-web/test/spec/tabledata/tabledata.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@

'use strict';

import zeppelin from '../../../src/app/zeppelin.js';
import '../../../src/app/tabledata/tabledata.js';

describe('TableData build', function() {
var td;

beforeEach(function() {
console.log(zeppelin.TableData);
var TableData = zeppelin.TableData;
td = new TableData();
});
Expand Down
18 changes: 0 additions & 18 deletions zeppelin-web/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,6 @@ module.exports = function makeWebpackConfig () {
}]
};

// ISTANBUL LOADER
// https://github.com/deepsweet/istanbul-instrumenter-loader
// Instrument JS files with istanbul-lib-instrument for subsequent code coverage reporting
// Skips node_modules and files that end with .test
if (isTest) {
config.module.preLoaders.push({
test: /\.js$/,
exclude: [
/node_modules/,
/\.spec\.js$/
],
loader: 'istanbul-instrumenter',
query: {
esModules: true
}
})
}

/**
* PostCSS
* Reference: https://github.com/postcss/autoprefixer-core
Expand Down

0 comments on commit ea7f186

Please sign in to comment.