Skip to content

Error tests for Jasmine 2.X are not working properly when a timeout has occurred before #18

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

Closed
juliemr opened this issue Mar 11, 2015 · 1 comment · Fixed by #19
Closed

Comments

@juliemr
Copy link
Member

juliemr commented Mar 11, 2015

The errors for

  it('should pass errors from done callback', function(done) {
    done.fail('an error');
  });

  it('should fail normal synchronous tests', function() {
    expect(true).toBe(false);
  });

are getting merged into one failure.

@juliemr
Copy link
Member Author

juliemr commented Mar 11, 2015

Note that this only fails if a test times out earlier:

describe('Timeout cases', function() {
  it('should timeout after 200ms', function(done) {
    expect(fakeDriver.getValueA()).toEqual('a');
  }, 200);

  it('should pass errors from done callback', function(done) {
    done.fail('an error');
  });

  it('should fail normal synchronous tests', function() {
    expect(true).toBe(false);
  });
});

This causes the output:

Failures:
1) Timeout cases should timeout after 200ms
  Message:
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
  Stack:
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
        at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

2) things that should fail should fail normal synchronous tests
  Message:
    Failed: Error: an error
  Stack:
    Error: Failed: Error: an error
        at /Users/ralphj/jasminewd/index.js:104:16
        at promise.ControlFlow.runInFrame_ (/Users/ralphj/jasminewd/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)
        at promise.Callback_.goog.defineClass.notify (/Users/ralphj/jasminewd/node_modules/selenium-webdriver/lib/webdriver/promise.js:2464:25)
        at promise.Promise.notify_ (/Users/ralphj/jasminewd/node_modules/selenium-webdriver/lib/webdriver/promise.js:563:12)
  Message:
    Expected true to be false.
  Stack:
    Error: Failed expectation
        at Env.<anonymous> (/Users/ralphj/jasminewd/spec/errorSpec.js:38:18)
        at /Users/ralphj/jasminewd/index.js:95:14
        at promise.ControlFlow.runInFrame_ (/Users/ralphj/jasminewd/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)
        at promise.ControlFlow.runEventLoop_ (/Users/ralphj/jasminewd/node_modules/selenium-webdriver/lib/webdriver/promise.js:1755:8)
        at null.<anonymous> (/Users/ralphj/jasminewd/node_modules/selenium-webdriver/lib/webdriver/promise.js:2056:12)
        at goog.async.run.processWorkQueue [as _onTimeout] (/Users/ralphj/jasminewd/node_modules/selenium-webdriver/lib/goog/async/run.js:125:21)
        at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

3 specs, 2 failures
Finished in 5.016 seconds

@juliemr juliemr changed the title Error tests for Jasmine 2.X are not working properly - Error tests for Jasmine 2.X are not working properly when a timeout has occurred before Mar 11, 2015
juliemr added a commit to juliemr/jasminewd that referenced this issue Mar 17, 2015
Add some console logging, remove useless info about the last running
task in the control flow, and fix error where problems reported
from done.fail were getting pushed into the following spec.

Closes angular#18
@juliemr juliemr closed this as completed Mar 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant