findTestCaller fail to wrap the test function
if (node.loc.start.line < line &&
node.loc.end.line > line)
evaluating each variables at that line of code resulting in:
node.loc.start.line -> 19
line -> 23
node.loc.end.line -> 22
when in my test file, this test
test('todo promise', async function (t) {
var todo = await generateP();
schemaShot(todo);
});
//# sourceMappingURL=test-bundle.js.map
starts from line 19 and ends at line 22. This results in the above expressions equal to false which makes specName assignment inside the if statement not executed. Hence this error
TypeError {
message: 'Cannot read property \'filename\' of undefined',
Any idea why is this happening? Thanks!
So removing the //# sourceMappingURL=test-bundle.js.map seems to fix the issue. Not sure why though, maybe it has something to do with how stack-sites works.
hmm, might be bug with parsing async / await functions. What test framework are you using? Because now I mostly use snap-shot-it which registers beforeEach callback to "know" the current test accurately
Inspired by your blog post, i'm using AVA as the test runner.