microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/test/debugger/setup.test.ts
18lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | /* This setup is just to install the source-map-support, so we'll get TypeScript stack traces |
| 5 | for the tests */ |
| 6 | import * as fs from "fs"; |
| 7 | |
| 8 | // source-map-support has a bug that crashes some of our tests. We fix it: https://github.com/evanw/node-source-map-support/issues/131 |
| 9 | const moduleLocation = require.resolve("source-map-support/source-map-support.js"); |
| 10 | const originalCode = "column -= 62;"; |
| 11 | const replacementCode = "if (column > 63) { column -= 62; }"; |
| 12 | const contents = fs.readFileSync(moduleLocation, "utf8"); |
| 13 | const fixedContents = contents.replace(originalCode, replacementCode); |
| 14 | fs.writeFileSync(moduleLocation, fixedContents); |
| 15 | |
| 16 | // Then we load the module |
| 17 | import * as sourceMapSupport from "source-map-support"; |
| 18 | sourceMapSupport.install(); // Enable stack traces translation to typescript |
| 19 | |