mmonteleone/pavlov

Result of expression 'thisApi.assert' [undefined] is not an object

Closed this issue · 4 comments

Haven't quite tracked this all the way down, but I'm working on it, from what I can tell if you specify a feature without a test function before a given and without another feature without a test function after the given, it will produce an error something like this:

Died on test #1: Result of expression 'thisApi.assert' [undefined] is not an object. - { 
"message": "Result of expression 'thisApi.assert' [undefined] is not an object.", "line": 344, 
"sourceId": 5279531008, "sourceURL": "file:///Users/ericdelabar/Documents/Code/git-
repos/pavlov/pavlov.js", "expressionBeginOffset": 11237, "expressionCaretOffset": 11251, 
"expressionEndOffset": 11256, "name": "TypeError" }

Since that sounds very confusing, see line 19:

https://github.com/edelabar/pavlov/blob/8dea6ddb3cb5025ea6c440da53b1410480eb9e27/example/example.specs.js

If you move the code on line 19 to line 44 (after the final given) it works as expected. I'm going to try and tackle this one myself, so hopefully expect a pull request in a day or so...

I'm trying to tackle this one myself but I figured I'd post it in case anybody else is seeing the problem.

Actually, it just seems a given can't be last, if I add a feature definition with a test function on line 44 it also works as expected...

It also doesn't occur if the api is injected globally with

QUnit.specify.globalApi = true;

Investigating..

I think I got it...

#6

I merged your request, and then also made a minor tweak to get rid of all the 'thisApi' references in the first place, since 'api' is already defined. Thanks for identifying this!