If I have a function under test with a syntax error like:
// demo.js
module.exports = function () { // missing closing brace
...and a test like:
// demoTest.js
const test = require('ava')
const demo = require('./demo')
test(async function (t) {
t.ok(true)
})
Then the syntax error is reported pointing to the require statement in the test file instead of the file with the error:
Uncaught Exception: /Users/cowdene/src/avaIssue/demoTest.js
SyntaxError: Unexpected token )
at Object.<anonymous> (/Users/cowdene/src/avaIssue/demoTest.js:2:14)
This is pretty confusing and is especially tricky for newer Node developers.