Skip to content

Instantly share code, notes, and snippets.

@codegirl-007
Last active May 8, 2016 03:59
Show Gist options
  • Save codegirl-007/8c42bf4adfd7627bdf017be726bd5989 to your computer and use it in GitHub Desktop.
Save codegirl-007/8c42bf4adfd7627bdf017be726bd5989 to your computer and use it in GitHub Desktop.
Setting up Browserify and Jasmine with NPM
exports.getName = function(name) {
return name;
}
describe("Name", function() {
var Name = require("../js/name");
it("should return a name", function() {
expect(Name.getName("James")).toEqual("James");
});
});
{
"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",
}
}
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