eugene-sea / karma-cucumber-js

Karma adapter for running Cucumber.js features
10 stars 4 forks source link

When throwing "new Error('someMessage');" the 'someMessage' isn't reported above the stack trace. #15

Closed jfstephe closed 7 years ago

jfstephe commented 7 years ago

If a test throws an Error, then the stack is reported but not the error message, which is often the most useful part! :-)

I currently get:

Step: Then the subscriber should receive a "starting" notification <- src/bootstrapper.feature:8
      get

      run@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:3450:24
      invoke@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:3034:24
      executeStep@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:2609:28
      processStep@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:2604:25
      /var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:2562:29
      run@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:37817:19
      drainQueue@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:37787:45

But expected (note the additional second line):

Step: Then the subscriber should receive a "starting" notification <- src/bootstrapper.feature:8
      Object is not a function (evaluating 'moment()')
      get

      run@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:3450:24
      invoke@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:3034:24
      executeStep@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:2609:28
      processStep@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:2604:25
      /var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:2562:29
      run@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:37817:19
      drainQueue@/var/devProjects/karma-cucumber-js/node_modules/cucumber/release/cucumber.js:37787:45

PR #17 addresses this, if you could merge and and publish to npm that'd be awesome!

Aside - I'm not sure why the file the error originates in isn't being reported in the stack trace but I think that may be a cucumber error - perhaps one to keep an eye on post cucumber upgrade?