Skip to content
This repository has been archived by the owner on Jun 5, 2021. It is now read-only.

Commit

Permalink
setup istanbul
Browse files Browse the repository at this point in the history
i’m manually instrumenting the code and requiring it, per what is
discussed here:

karma-runner/karma-coverage#16
  • Loading branch information
Robert committed Jul 7, 2014
1 parent 687055a commit 30f26e5
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ npm-debug.log
*.iml
.idea
.DS_Store
.tmp

13 changes: 10 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ module.exports = function (grunt) {
}
}
},

clean: ['./.tmp'],
instrument: {
files: 'lib/**/*.js',
options: {
lazy: true,
basePath: '.tmp/instrumented/'
}
},
watch: {
js:{
files: ['lib/**/*.js','test/**/*.js'],
tasks: ['karma:liveunit:run','build']
files: ['lib/**/*.js','test/spec/**/*.js'],
tasks: ['clean','instrument','karma:liveunit:run']
}
},
// Test settings
Expand Down
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ module.exports = function(config) {


preprocessors: {
'test/**/*.js': ['browserify']
'test/spec/*.js': ['browserify']
},

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


// Continuous Integration mode
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"karma-chrome-launcher": "^0.1.4",
"karma-browserify": "^0.2.1",
"chai": "^1.9.1",
"karma-chai": "^0.1.0"
"karma-chai": "^0.1.0",
"karma-coverage": "^0.2.4",
"grunt-istanbul": "^0.3.0",
"grunt-contrib-clean": "^0.5.0"
},
"dependencies": {
"Base64": "^0.3.0"
Expand Down
1 change: 1 addition & 0 deletions test/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"globals": {
"after": false,
"afterEach": false,
"assert": false,
"angular": false,
"before": false,
"beforeEach": false,
Expand Down
3 changes: 3 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
stormpath: require('../.tmp/instrumented/lib')
};
26 changes: 26 additions & 0 deletions test/spec/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

var stormpathJs = require('../common').stormpath;

describe('Client', function () {


describe('instantiation', function () {
describe('without a JWT in the url', function () {
var result;
before(function(done){
new stormpathJs.Client(function(err,res){
result = [err,res];
done();
});
});
it('should err because jwt was not found',function(){
assert.instanceOf(result[0],Error);
});
});


});


});
6 changes: 3 additions & 3 deletions test/spec/lib.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

describe('lib', function () {
var stormpath = require('../common').stormpath;

var stormpath;
describe('lib', function () {

it('should be require-able',function(){
stormpath = require('../../');
stormpath = require('../../.tmp/instrumented/lib');
});

it('should be an object', function () {
Expand Down

0 comments on commit 30f26e5

Please sign in to comment.