Skip to content

Commit

Permalink
uninstall sourcemaps after test results are processed
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed May 18, 2018
1 parent 6a1e78d commit 02558bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/jest-runner/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import exit from 'exit';
import runTest from './run_test';
import throat from 'throat';
import Worker from 'jest-worker';
import sourcemapSupport from 'source-map-support';

const TEST_WORKER_PATH = require.resolve('./test_worker');

Expand Down Expand Up @@ -81,7 +82,12 @@ class TestRunner {
);
})
.then(result => onResult(test, result))
.catch(err => onFailure(test, err)),
.catch(err => onFailure(test, err))
.then(res => {
sourcemapSupport.resetRetrieveHandlers();

return res;
}),
),
Promise.resolve(),
);
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-runner/src/run_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ async function runTestInternal(
});
} finally {
await environment.teardown();

sourcemapSupport.resetRetrieveHandlers();
}
}

Expand Down
3 changes: 3 additions & 0 deletions packages/jest-runner/src/test_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {RawModuleMap} from 'types/HasteMap';
import type {ErrorWithCode} from 'types/Errors';

import exit from 'exit';
import sourcemapSupport from 'source-map-support';
import HasteMap from 'jest-haste-map';
import {separateMessageFromStack} from 'jest-message-util';
import Runtime from 'jest-runtime';
Expand Down Expand Up @@ -84,5 +85,7 @@ export async function worker({
);
} catch (error) {
throw formatError(error);
} finally {
sourcemapSupport.resetRetrieveHandlers();
}
}

0 comments on commit 02558bd

Please sign in to comment.