Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sanitize stderr before checking output
- Loading branch information
1 parent
8f4f012
commit 821888a
Showing
8 changed files
with
32 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,10 +1,15 @@ | ||
const assert = require('assert'); | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
|
||
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)); | ||
} | ||
stderr: stderr => | ||
assertStderrIncludes( | ||
stderr, | ||
'[!] (plugin at position 1) Error: My error.\n' + | ||
'main.js (1:5)\n' + | ||
'custom code frame\n' + | ||
'Error: My error.' | ||
) | ||
}; |
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,10 +1,16 @@ | ||
const assert = require('assert'); | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'errors with custom (plugin generated) code frame', | ||
description: 'errors with plugin generated code frames also contain stack', | ||
command: 'rollup -c', | ||
error: () => true, | ||
stderr: stderr => { | ||
assert.ok(/custom code frame/.test(stderr)); | ||
assertStderrIncludes( | ||
stderr, | ||
'[!] (plugin at position 1) Error: My error.\n' + | ||
'main.js\ncustom code frame\nError: My error.\n' + | ||
' at Object.transform' | ||
); | ||
assertStderrIncludes(stderr, 'rollup.config.js:11:17'); | ||
} | ||
}; |
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,10 +1,8 @@ | ||
const assert = require('assert'); | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'shows warning when multiple chunks empty', | ||
command: 'rollup -c', | ||
error: () => true, | ||
stderr: stderr => { | ||
assert.ok(stderr.includes('(!) Generated empty chunks\na, b')); | ||
} | ||
stderr: stderr => assertStderrIncludes(stderr, '(!) Generated empty chunks\na, b') | ||
}; |
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,10 +1,8 @@ | ||
const assert = require('assert'); | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'shows warning when chunk empty', | ||
command: 'rollup -c', | ||
error: () => true, | ||
stderr: stderr => { | ||
assert.ok(stderr.includes('(!) Generated an empty chunk\nmain')); | ||
} | ||
stderr: stderr => assertStderrIncludes(stderr, '(!) Generated an empty chunk\nmain') | ||
This comment has been minimized.
Sorry, something went wrong. |
||
}; |
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
Interesting I wasn’t expecting this to fail as there was no
tc
in it