Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Respect frame on plugin thrown errors when pos is also given (#2309)
- Loading branch information
1 parent
76a4844
commit d13aca5
Showing
9 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'custom (plugin generated) code frame taking priority over pos generated one', | ||
command: 'rollup -c', | ||
error: () => true, | ||
stderr: stderr => { | ||
assert.ok(/custom code frame/.test(stderr)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("everyday I'm throwing"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
input: 'main.js', | ||
output: { | ||
format: 'cjs' | ||
}, | ||
plugins: [ | ||
{ | ||
transform() { | ||
const err = new Error('My error.'); | ||
err.frame = 'custom code frame'; | ||
this.error(err, { | ||
line: 1, | ||
column: 5, | ||
}); | ||
} | ||
}, | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'errors with custom (plugin generated) code frame', | ||
command: 'rollup -c', | ||
error: () => true, | ||
stderr: stderr => { | ||
assert.ok(/custom code frame/.test(stderr)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("everyday I'm throwing"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
input: 'main.js', | ||
output: { | ||
format: 'cjs' | ||
}, | ||
plugins: [ | ||
{ | ||
transform() { | ||
const err = new Error('My error.'); | ||
err.frame = 'custom code frame'; | ||
this.error(err); | ||
} | ||
}, | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'does not print warnings with --silent', | ||
command: 'rollup -i main.js -f cjs --silent', | ||
stderr: `` | ||
stderr: stderr => { | ||
assert.equal(stderr, ''); | ||
return true; | ||
} | ||
}; |