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 922825d commit b6df901
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`cannot test with no implementation 1`] = `
| ^
4 | test('test, no implementation');
5 |
at packages/jest-jasmine2/build/jasmine/Env.js:<<LINE>>:<<COLUMN>>
at __tests__/only-constructs.test.js:<<LINE>>:<<COLUMN>>
Expand Down Expand Up @@ -59,7 +59,7 @@ exports[`cannot test with no implementation with expand arg 1`] = `
| ^
4 | test('test, no implementation');
5 |
at packages/jest-jasmine2/build/jasmine/Env.js:<<LINE>>:<<COLUMN>>
at __tests__/only-constructs.test.js:<<LINE>>:<<COLUMN>>
Expand Down
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 b6df901

Please sign in to comment.