From 16f1a6d847ce857533b7173ae16cbea39b626f3e Mon Sep 17 00:00:00 2001 From: Artem Govorov Date: Fri, 22 Feb 2019 13:39:24 +1000 Subject: [PATCH] Fix `resetRetrieveHandlers` to reset `retrieveSourceMap` and `retrieveFile` functions The `handlerExec` function produces functions that are using original `retrieveFileHandlers`/`retrieveMapHandlers` references, so because the array variables are re-assigned in the `resetRetrieveHandlers` function, `retrieveSourceMap` and `retrieveFile` need to be re-created to point them to correct instances of `retrieveFileHandlers`/`retrieveMapHandlers`. This fixes: https://github.com/facebook/jest/issues/6424 https://github.com/facebook/jest/issues/7402 --- source-map-support.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source-map-support.js b/source-map-support.js index 112e830..44e8294 100644 --- a/source-map-support.js +++ b/source-map-support.js @@ -557,4 +557,7 @@ exports.resetRetrieveHandlers = function() { retrieveFileHandlers = originalRetrieveFileHandlers.slice(0); retrieveMapHandlers = originalRetrieveMapHandlers.slice(0); + + retrieveSourceMap = handlerExec(retrieveMapHandlers); + retrieveFile = handlerExec(retrieveFileHandlers); }