I'm trying to install the jasmine plugin "jasmine-ajax" in an angular-cli project. The instructions seem pretty standard, but I keeping getting this error:
"ERROR in src/app/app.component.spec.ts(8,13): error TS2339: Property 'Ajax' does not exist on type 'typeof jasmine'."
I keep seeing an error on jasmine.Ajax.install()
In my karma.conf.js file, I have this:
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine-ajax', 'jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma'),
require('karma-jasmine-ajax')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
I also tried to add the plugin using the helpers section in the jasmine.json. This is what my jasmine.json file looks like:
{
"spec_dir": "spec",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js",
"../../../node_modules/jasmine-ajax/lib/mock-ajax.js"
],
"stopSpecOnExpectationFailure": false,
"random": true
}
Has anyone installed the jasmine-ajax plugin successfully lately?
Could it be the version of jasmine-ajax?