jasmine / jasmine-npm

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

jasmine flags, oneFailurePerSpec and stopSpecOnExpectationFailure don't work well #178

Closed razielron closed 3 years ago

razielron commented 3 years ago

Hi, I am using wdio that uses jasmine under the hood. I have problem when I set any of those flags to the jasmineOpts object in the config file:

oneFailurePerSpec: true,
stopSpecOnExpectationFailure: true,

Those flags do not work properly, they don't stop anything and when I use the flag failFast: true it works but it stops the whole suite on failure and not just the current test.

I need to stop current describe on any error, can any one assist with this?

I am using WebdriverIO v7

sgravrock commented 3 years ago

Jasmine doesn't provide a way to stop an entire describe but not the whole suite. The idea is that each spec is supposed to be independent of the others, so the failure of one spec doesn't necessarily mean that the others can't run and pass. Are you by any chance trying to write a test suite where each spec is a step that depends on the ones before it to set up its preconditions? Jasmine isn't meant to be used that way.

It sounds like you're probably configuring Jasmine through wdio-jasmine-framework. Based on a quick look at that package's source, it looks like both the oneFailurePerSpec and stopSpecOnExpectationFailure flags should have the effect of making Jasmine stop each spec (but not the entire describe) on the first error but continue to run the remaining specs.

sgravrock commented 3 years ago

Closing since we haven't heard anything in some time, and I don't think there's anything to be fixed in Jasmine here.