I would suggest setting up a Docker image for Javascript environment consisting of key tools such as grunt, jscs, jshint, typescript, browserify, nodejs etc. Check my page on How to setup Javascript Dev Environment using Dockers.
Set the Jasmine config property (environment variable) pointing to folder where jasmine.json file can be found. As I am executing jasmine from topmost folder (/home/ashukla/js) under which jasmine.json is found, I set the path by executing “export JASMINE_CONFIG_PATH=/home/ashukla/js/jasmine.json”.
Make a directory under with following subfolders and a configuration file will be placed:
{
"spec_dir": "spec",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
}
function Person(){
this.age = 0;
this.isAdult = false;
};
Person.prototype.setAge = function(age) {
this.age = age;
if(this.age > 17) {
this.isAdult = true;
} else {
this.isAdult = false;
}
};
module.exports = Person;
describe("Person", function() {
var Person = require('../lib/Person');
var person;
beforeEach(function() {
person = new Person();
});
it("is not an adult", function() {
expect(person.isAdult).toBe(false);
person.setAge(16);
expect(person.isAdult).toBe(false);
});
it("is an adult", function() {
person.setAge(18);
expect(person.isAdult).toBe(true);
});
});
Last updated: 28th April, 2024 As a data scientist, understanding the nuances of various cost…
Last updated: 28th April, 2024 In this post, you will learn the concepts related to…
Last updated: 26th April, 2024 In this blog post, we will discuss the logistic regression…
Last updated: 22nd April, 2024 As data scientists, we navigate a sea of metrics to…
Last updated: 22nd April, 2024 This post will teach you about the gradient descent algorithm…
Last updated: 19th April, 2024 Among the terminologies used in training machine learning models, the…