Skip to content

Commit

Permalink
Add test to verify error object after transform not showing correct l…
Browse files Browse the repository at this point in the history
…ocation
  • Loading branch information
misoguy committed Nov 14, 2017
1 parent 013a382 commit 4ad48c3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
@@ -0,0 +1,39 @@
var path = require( 'path' );
var assert = require( 'assert' );
var MagicString = require( 'magic-string' );

module.exports = {
description: 'error after transform should throw with correct location of file',
options: {
plugins: [
{
transform: function ( source, id ) {
var s = new MagicString( source );
s.prepend( "import _assign from 'object-assign';\n" );

return {
code: s.toString(),
map: s.generateMap({ hires: true })
};
}
}
]
},
error: {
code: 'MISSING_EXPORT',
message: `'default' is not exported by empty.js`,
pos: 44,
loc: {
file: path.resolve( __dirname, 'main.js' ),
line: 1,
column: 7
},
frame: `
1: import a from './empty.js';
^
2:
3: Object.assign({}, a);
`,
url: `https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module`
}
};
Empty file.
@@ -0,0 +1,3 @@
import a from './empty.js';

Object.assign({}, a);

0 comments on commit 4ad48c3

Please sign in to comment.