Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successful retries don't let test pass #128

Open
Magomogo opened this issue Aug 7, 2018 · 0 comments
Open

Successful retries don't let test pass #128

Magomogo opened this issue Aug 7, 2018 · 0 comments

Comments

@Magomogo
Copy link

Magomogo commented Aug 7, 2018

Mocha test runner has--retries flag that makes failed tests to retry. However successful try doesn't make chakram think that the test suite is successful.

example, this test will pass only with the second attempt (file ./retries.js):

const chakram = require('chakram'),
    expect = chakram.expect;

let tryNumber = 0;

beforeEach(() => {
    tryNumber++;
});

it('will pass on second try', () => {
    const response = chakram.get(
        'http://example.com/' + (tryNumber === 2 ? '' : '/notexisting')
    );

    return expect(response).to.have.status(200)
});

execution log:

$ mocha --retries 1 ./retries.js


  1) will pass on second try
  ✓ will pass on second try (300ms)

  1 passing (669ms)
  1 failing

  1) will pass on second try:
     Error: Some expectation promises were not fulfilled before the test finished. Ensure you are waiting for all the expectations to run
      at Context.warnUser (node_modules/chakram/lib/chakram.js:148:25)
      at Context.checkForUnfulfilledExpectations (node_modules/chakram/lib/chakram.js:155:22)
      at Context.<anonymous> (node_modules/chakram/lib/chakram.js:162:37)

I expect that this test suite will be successful, in other case --retries feature is useless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant