Ensure that calling register fully resets the state. (#7930)

This commit is contained in:
Logan Smyth
2018-05-14 23:04:56 -07:00
committed by GitHub
parent 51db3e9a5d
commit a955efa3e3

View File

@@ -104,16 +104,14 @@ export function revert() {
delete require.cache[require.resolve(__filename)];
}
register({
extensions: DEFAULT_EXTENSIONS,
});
register();
export default function register(opts?: Object = {}) {
// Clone to avoid mutating the arguments object with the 'delete's below.
opts = {
...opts,
};
if (opts.extensions) hookExtensions(opts.extensions);
hookExtensions(opts.extensions || DEFAULT_EXTENSIONS);
if (opts.cache === false && cache) {
registerCache.clear();