jasmine / jasmine-npm

A jasmine runner for node projects.
MIT License
376 stars 145 forks source link

getting an error jasmine.getEnv is not a function #193

Closed praveenngp15 closed 2 years ago

praveenngp15 commented 2 years ago

using jasmine.getEnv with wdio for getting spec status.

Getting a below error jasmine.getEnv is not a function.

My code var Jasmine = require('jasmine'); var jasmine = new Jasmine(); jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));

sgravrock commented 2 years ago

Your local variable jasmine is shadowing the global jasmine. Try either renaming it or using jasmine.env rather than jasmine.getEnv().

sgravrock commented 2 years ago

Actually, if adding a reporter is your only reason for accessing the env, you can just do jasmine.addReporter(...). See https://jasmine.github.io/setup/nodejs.html and https://jasmine.github.io/api/npm/4.1/Jasmine.html .