I try to configure simple project on jasmine using node.js. I got following files:
/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'**/*.testdev.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'foo',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 60000,
print: function() {}
},
useAllAngular2AppRoots: true,
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e'
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
}
};
Then a test file:
import {} from 'jasmine';
describe ("test", function() {
it ("should work", function() {
console.log('============ Main Workflow file starts');
});
});
And I receive error when I'm running npm test:
C:\newcheckproject>npm test
> [email protected] test C:\\newcheckproject
> protractor
(node:7492) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[12:47:12] I/launcher - Running 1 instances of WebDriver
[12:47:12] I/direct - Using ChromeDriver directly...
[12:47:15] E/launcher - Error: TypeError: SpecReporter is not a constructor
at onPrepare (C:\Users\OSP\WebstormProjects\newcheckproject\protractor.conf.js:30:38)
at q_1.Promise (C:\Roaming\npm\node_modules\protractor\lib\util.ts:48:39)
at Function.promise (C:\Roaming\npm\node_modules\protractor\node_modules\q\q.js:682:9)
at Object.runFilenameOrFn_ (C:\Roaming\npm\node_modules\protractor\lib\util.ts:39:10)
at plugins_.onPrepare.then (C:\Roaming\npm\node_modules\protractor\lib\runner.ts:103:21)
at _fulfilled (C:\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13)
at C:\Roaming\npm\node_modules\protractor\node_modules\q\q.js:556:49
at runSingle (C:\Roaming\npm\node_modules\protractor\node_modules\q\q.js:137:13)
[12:47:15] E/launcher - Process exited with error code 100
npm ERR! Test failed. See above for more details.
All answers says that I should replace in the protractor file a line: var SpecReporter = require('jasmine-spec-reporter');, but I do have it. What might also a problem here?
Since 3.0.0, jasmine-spec-reporter module exports SpecReporter and DisplayProcessor.
According to the documentation, you need to configure it like this: