mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Add option for source maps when running tests (#24577)
I added a `--sourceMaps` option to our test command that enables inline source maps. I've kept it disabled by default, since it makes the tests run slower. But it's super useful when attaching to a debugger.
This commit is contained in:
@@ -110,6 +110,12 @@ const argv = yargs
|
||||
requiresArg: true,
|
||||
type: 'string',
|
||||
},
|
||||
sourceMaps: {
|
||||
describe:
|
||||
'Enable inline source maps when tranforming source files with Jest. Useful for debugging, but makes it slower.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
}).argv;
|
||||
|
||||
function logError(message) {
|
||||
@@ -333,6 +339,12 @@ function getEnvars() {
|
||||
envars.REACT_VERSION = semver.coerce(argv.reactVersion);
|
||||
}
|
||||
|
||||
if (argv.sourceMaps) {
|
||||
// This is off by default because it slows down the test runner, but it's
|
||||
// super useful when running the debugger.
|
||||
envars.JEST_ENABLE_SOURCE_MAPS = 'inline';
|
||||
}
|
||||
|
||||
return envars;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,9 @@ module.exports = {
|
||||
babelOptions,
|
||||
{
|
||||
plugins,
|
||||
sourceMaps: process.env.JEST_ENABLE_SOURCE_MAPS
|
||||
? process.env.JEST_ENABLE_SOURCE_MAPS
|
||||
: false,
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user