diff --git a/src/Module.js b/src/Module.js index 1c8da5f..4be76d9 100644 --- a/src/Module.js +++ b/src/Module.js @@ -500,6 +500,7 @@ export default class Module { } catch ( err ) { err.code = 'PARSE_ERROR'; err.file = this.id; // see above - not necessarily true, but true enough + err.message += ` in ${this.id}`; throw err; } } diff --git a/test/function/reports-syntax-error-locations/_config.js b/test/function/reports-syntax-error-locations/_config.js new file mode 100644 index 0000000..2cb1085 --- /dev/null +++ b/test/function/reports-syntax-error-locations/_config.js @@ -0,0 +1,8 @@ +var assert = require( 'assert' ); + +module.exports = { + description: 'reports syntax error filename', + error: function ( err ) { + assert.ok( /in .+main\.js/.test( err.message ) ); + } +}; diff --git a/test/function/reports-syntax-error-locations/main.js b/test/function/reports-syntax-error-locations/main.js new file mode 100644 index 0000000..d24584b --- /dev/null +++ b/test/function/reports-syntax-error-locations/main.js @@ -0,0 +1 @@ +var 42 = answer;