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

Empty it throws an error #27

Closed
sjelin opened this issue Jun 8, 2015 · 6 comments
Closed

Empty it throws an error #27

sjelin opened this issue Jun 8, 2015 · 6 comments

Comments

@sjelin
Copy link
Contributor

sjelin commented Jun 8, 2015

See angular/protractor#1852

Reproduced with the following commands in a node shell:

var JasmineRunner = require('jasmine');
var jrunner = new JasmineRunner();
require('jasminewd2');
jrunner.addSpecFile('~/sandbox/spec.js')
jrunner.execute();

Where ~/sandbox/spec.js is as follows:

describe("hello", function() {
  it("world");
});

This produces the message:

Started
F

Failures:
1) hello encountered a declaration exception
  Message:
    Error: undefined is not a function
  Stack:
    Error: undefined is not a function
        at Error (native)
        at validateFunction (~/protractor/node_modules/jasminewd2/index.js:32:36)
        at ~/protractor/node_modules/jasminewd2/index.js:111:16
        at Suite.<anonymous> (~/sandbox/spec.js:2:3)
        at Object.<anonymous> (~/sandbox/spec.js:1:63)
        at Module._compile (module.js:460:26)
        at Object.Module._extensions..js (module.js:478:10)

Removing require('jasminewd2'); gets rid of the error

@sjelin
Copy link
Contributor Author

sjelin commented Jun 8, 2015

The error appears to be basically that our validation code is wrong. We see undefined and throw an error, where as we should just ignore it.

@sporkthrower
Copy link

This also impacts tests marked pending with the Jasmine2 pending() function:

Spec with pending(' pending fix for platform display DR13-488'); in its body produces the following output.

F

Failures:
1)  app detail app info bar will display the platform if available
  Message:
    Failed: => marked Pending pending fix for platform display DR13-488
  Stack:
    Error: Failed: => marked Pending pending fix for platform display DR13-488

@juliemr juliemr self-assigned this Oct 1, 2015
@juliemr
Copy link
Member

juliemr commented Oct 2, 2015

I have a fix for the empty it issue, that's rather easy.

Getting pending to work is tougher, because it doesn't play well with asynchronous tests. The way that Jasmine implements pending is throw specialString and then it searches for that specialString when catching errors. However, this all only works if the error is thrown in the same turn of the event loop.

But because we're running everything async, by the time we get the specialString error, it's already the next turn, and it's too late to throw the error on to Jasmine.

I'm looking into whether we can force Jasmine to mark the spec as pending in some other way.

@juliemr
Copy link
Member

juliemr commented Oct 2, 2015

In the current Jasmine version, there's no way to mark a spec as pending if it's already running asynchronously, which is how jasminewd always runs specs (inside their own controlFlow#execute block). Filed a Jasmine feature request at jasmine/jasmine#937 - but I'm aware that this is probably a strange use case for the pending feature.

@juliemr
Copy link
Member

juliemr commented Oct 2, 2015

Made pending its own issue - #32

@juliemr
Copy link
Member

juliemr commented Oct 2, 2015

Closed with #31

@juliemr juliemr closed this as completed Oct 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants