My Folder Structure is as below:
Root
|- Scripts
|- ViewScripts
|- Feature_1
|- feature_1.js
|- Jasmine
|- Helpers
|- jasmine.js
|- Spy.js
|- mock-ajax.js
|- jasmine-jquery.js
|- Tests
|- Feature_1_Tests
|- feature_1.tests.js
|- chutzpah.json
|- gulpfile.js
|- package.json
Content of chutzpah.json is :
{ "Framework": "jasmine", "References": [
{ "Path": "Scripts/jquery-1.10.2.js" },
{ "Path": "Scripts/Jasmine/Helpers/jasmine.js" },
{ "Path": "Scripts/Jasmine/Helpers/jasmine-html.js" },
{ "Path": "Scripts/Jasmine/Helpers/boot.js" },
{ "Path": "Scripts/Jasmine/Helpers/mock-ajax.js" },
{ "Path": "Scripts/Jasmine/Helpers/Spy.js" },
{ "Path": "Scripts/Jasmine/Helpers/jasmine-jquery.js" } ] }
Content of gulpfile.js is :
const gulp = require('gulp');
const jasmine = require('gulp-jasmine');
gulp.task('tests', () =>
gulp
.src('Tests/**/*.tests.js')
.pipe(jasmine())
);
Content of package.json file is :
{
"name": "myapp",
"version": "1.0.0",
"description": "",
"main": "",
"scripts": {
"test": "gulp tests"
},
"author": "Jai Kumar",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.0",
"gulp-jasmine": "^4.0.0"
}
}
When i do gulp tests from cmd then :
- All test cases failing.
- I'm seeing following error for each test case - ReferenceError: functionNameWhichIHaveSpyOn is not defined
- After all test cases ran and failed, message in the bottom of cmd is there Error in plugin "gulp-jasmine"
But when i'm running same test cases using chutzpah in Visual Studio Test Explorer all test cases passed.
Please help me on this issue. Thanks in advance.