Last active
May 8, 2016 03:59
-
-
Save codegirl-007/8c42bf4adfd7627bdf017be726bd5989 to your computer and use it in GitHub Desktop.
Setting up Browserify and Jasmine with NPM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.getName = function(name) { | |
return name; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("Name", function() { | |
var Name = require("../js/name"); | |
it("should return a name", function() { | |
expect(Name.getName("James")).toEqual("James"); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "app", | |
"version": "1.0.0", | |
"description": "A personal app", | |
"main": "index.js", | |
"scripts": { | |
"build": "browserify js/main.js > js/bundle.js", | |
"test" : "node jasmine-runner.js" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"browserify": "^13.0.0", | |
"browserify-shim": "^3.8.12", | |
"jasmine": "^2.4.1", | |
"jasmine-spec-reporter": "^2.4.0", | |
"jshint": "^2.9.2", | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Jasmine = require('jasmine'); | |
var SpecReporter = require('jasmine-spec-reporter'); | |
var noop = function() {}; | |
var jrunner = new Jasmine(); | |
jrunner.configureDefaultReporter({print: noop}); // remove default reporter logs | |
jasmine.getEnv().addReporter(new SpecReporter()); // add jasmine-spec-reporter | |
jrunner.loadConfigFile(); // load jasmine.json configuration | |
jrunner.execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment