node.js - SpecReporter is not a constructor error on jasmine -
i try configure simple project on jasmine using node.js. 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 test file:
import {} 'jasmine'; describe ("test", function() { ("should work", function() { console.log('============ main workflow file starts'); }); });
and receive error when i'm running npm test
:
c:\newcheckproject>npm test > newcheck@1.0.0 test c:\\newcheckproject > protractor (node:7492) deprecationwarning: os.tmpdir() 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 not constructor @ onprepare (c:\users\osp\webstormprojects\newcheckproject\protractor.conf.js:30:38) @ q_1.promise (c:\roaming\npm\node_modules\protractor\lib\util.ts:48:39) @ function.promise (c:\roaming\npm\node_modules\protractor\node_modules\q\q.js:682:9) @ object.runfilenameorfn_ (c:\roaming\npm\node_modules\protractor\lib\util.ts:39:10) @ plugins_.onprepare.then (c:\roaming\npm\node_modules\protractor\lib\runner.ts:103:21) @ _fulfilled (c:\roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54) @ self.promisedispatch.done (c:\roaming\npm\node_modules\protractor\node_modules\q\q.js:863:30) @ promise.promise.promisedispatch (c:\roaming\npm\node_modules\protractor\node_modules\q\q.js:796:13) @ c:\roaming\npm\node_modules\protractor\node_modules\q\q.js:556:49 @ runsingle (c:\roaming\npm\node_modules\protractor\node_modules\q\q.js:137:13) [12:47:15] e/launcher - process exited error code 100 npm err! test failed. see above more details.
all answers says should replace in protractor file line: var specreporter = require('jasmine-spec-reporter');
, have it. might problem here?
since 3.0.0, jasmine-spec-reporter module exports specreporter , displayprocessor.
according documentation, need configure this:
const specreporter = require('jasmine-spec-reporter').specreporter; jasmine.getenv().addreporter(new specreporter());
Comments
Post a Comment