Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not include the whole namespace when illegally mutating a namespace (
- Loading branch information
1 parent
6d977a3
commit cc2182d
Showing
34 changed files
with
148 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'provides a helpful error message if a transpiled config is interpreted as "module"', | ||
minNodeVersion: 13, | ||
command: 'cd sub && rollup -c', | ||
error: () => true, | ||
stderr: (stderr) => | ||
assertStderrIncludes( | ||
stderr: stderr => | ||
assertIncludes( | ||
stderr, | ||
'[!] Error: While loading the Rollup configuration from "rollup.config.js", Node tried to require an ES module from a CommonJS ' + | ||
'file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can ' + | ||
'try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will ' + | ||
'prevent Rollup from trying to preprocess the file but rather hand it to Node directly.\n' + | ||
'https://rollupjs.org/guide/en/#using-untranspiled-config-files' | ||
), | ||
) | ||
}; |
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'errors with plugin generated code frames also contain stack', | ||
command: 'rollup -c', | ||
error: () => true, | ||
stderr: stderr => { | ||
assertStderrIncludes( | ||
assertIncludes( | ||
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'); | ||
assertIncludes(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,10 @@ | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'throws if different types of entries are combined', | ||
command: 'rollup main.js --format es --input main.js', | ||
error: () => true, | ||
stderr(stderr) { | ||
assertStderrIncludes(stderr, '[!] Either use --input, or pass input path as argument'); | ||
assertIncludes(stderr, '[!] Either use --input, or pass input path as argument'); | ||
} | ||
}; |
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,8 +1,8 @@ | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'shows warning when multiple chunks empty', | ||
command: 'rollup -c', | ||
error: () => true, | ||
stderr: stderr => assertStderrIncludes(stderr, '(!) Generated empty chunks\na, b') | ||
stderr: stderr => assertIncludes(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,8 +1,8 @@ | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'shows warning when chunk empty', | ||
command: 'rollup -c', | ||
error: () => true, | ||
stderr: stderr => assertStderrIncludes(stderr, '(!) Generated an empty chunk\nmain') | ||
stderr: stderr => assertIncludes(stderr, '(!) Generated an empty chunk\nmain') | ||
}; |
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,10 @@ | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'throws if a config in node_modules cannot be found', | ||
command: 'rollup --config node:baz', | ||
error: () => true, | ||
stderr(stderr) { | ||
assertStderrIncludes(stderr, '[!] Could not resolve config file "node:baz"'); | ||
assertIncludes(stderr, '[!] Could not resolve config file "node:baz"'); | ||
} | ||
}; |
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,10 @@ | ||
const { assertStderrIncludes } = require('../../../../utils.js'); | ||
const { assertIncludes } = require('../../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'unknown CLI --plugin results in an error', | ||
skipIfWindows: true, | ||
command: `echo "console.log(123);" | rollup --plugin foobar`, | ||
error(err) { | ||
assertStderrIncludes(err.message, '[!] Error: Cannot load plugin "foobar"'); | ||
assertIncludes(err.message, '[!] Error: Cannot load plugin "foobar"'); | ||
} | ||
}; |
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,10 @@ | ||
const { assertStderrIncludes } = require('../../../../utils.js'); | ||
const { assertIncludes } = require('../../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'invalid CLI --plugin argument format', | ||
skipIfWindows: true, | ||
command: `echo "console.log(123);" | rollup --plugin 'foo bar'`, | ||
error(err) { | ||
assertStderrIncludes(err.message, '[!] Error: Invalid --plugin argument format: "foo bar"'); | ||
assertIncludes(err.message, '[!] Error: Invalid --plugin argument format: "foo bar"'); | ||
} | ||
}; |
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,10 @@ | ||
const { assertStderrIncludes } = require('../../../../utils.js'); | ||
const { assertIncludes } = require('../../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'does not use input as stdin on TTY interfaces', | ||
skipIfWindows: true, | ||
command: `echo "console.log('PASS');" | ./wrapper.js -f es`, | ||
error(err) { | ||
assertStderrIncludes(err.message, 'You must supply options.input to rollup'); | ||
assertIncludes(err.message, 'You must supply options.input to rollup'); | ||
} | ||
}; |
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,9 +1,9 @@ | ||
const { assertStderrIncludes } = require('../../../../utils.js'); | ||
const { assertIncludes } = require('../../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'handles stdin errors', | ||
command: `node wrapper.js`, | ||
error(err) { | ||
assertStderrIncludes(err.message, 'Could not load -: Stream is broken.'); | ||
assertIncludes(err.message, 'Could not load -: Stream is broken.'); | ||
} | ||
}; |
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,13 +1,10 @@ | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'fails when using non-inline sourcemaps when bundling to stdout', | ||
command: 'rollup -i main.js -f es -m', | ||
error: () => true, | ||
stderr: (stderr) => { | ||
assertStderrIncludes( | ||
stderr, | ||
'[!] Only inline sourcemaps are supported when bundling to stdout.\n' | ||
); | ||
}, | ||
stderr: stderr => { | ||
assertIncludes(stderr, '[!] Only inline sourcemaps are supported when bundling to stdout.\n'); | ||
} | ||
}; |
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
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,9 +1,9 @@ | ||
const { assertStderrIncludes } = require('../../../utils.js'); | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = { | ||
description: 'warns for circular dependencies', | ||
command: 'rollup -c', | ||
stderr(stderr) { | ||
assertStderrIncludes(stderr, '(!) Circular dependency\nmain.js -> dep.js -> main.js\n'); | ||
assertIncludes(stderr, '(!) Circular dependency\nmain.js -> dep.js -> main.js\n'); | ||
} | ||
}; |
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
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
Oops, something went wrong.