I am trying to use Jasmine, via NodeJs and Chutzpah to test the javascript in my project. This is in Visual Studio
The Jasmine test looks like
/// <reference path ='../../net5.Ui/wwwroot/Shared/Javascript/helpers.js' />
describe('Helpers test', function () {
it('Test contains', function () {
const result = helpers.isMatch();
expect(result).toBe(true);
});
});
My javascript files all have a similar structure (a singleton approach)
const helpers = new function(){
this.isMatch = function(){ return true; }
}
Visual Studio is able to detect the tests.
Node version 14.15.4
UPDATE
(I have stripped some of my original post as it's no longer valuable)
I have even removed the <reference path>
and replaced it with chutzpah.json
at the root of the project with
{
"Framework": "jasmine",
"References": [
{
"Path": "../../net5.Ui/wwwroot/Shared/Javascript/",
"Include": "*.js",
"Exclude": "*app.js"
}
],
"Tests": [
{
"Path": "Tests/",
"Includes": [ "*Spec.js" ]
}
]
}