-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirect source-map-support to @cspotcode/source-map-support (#1496)
* initial commit * install source-map-support from git for tests
- Loading branch information
Showing
7 changed files
with
162 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as expect from 'expect'; | ||
import { createExec, createExecTester } from './exec-helpers'; | ||
import { | ||
CMD_TS_NODE_WITH_PROJECT_FLAG, | ||
contextTsNodeUnderTest, | ||
TEST_DIR, | ||
} from './helpers'; | ||
import { test as _test } from './testlib'; | ||
const test = _test.context(contextTsNodeUnderTest); | ||
|
||
const exec = createExecTester({ | ||
cmd: CMD_TS_NODE_WITH_PROJECT_FLAG, | ||
exec: createExec({ | ||
cwd: TEST_DIR, | ||
}), | ||
}); | ||
|
||
test('Redirects source-map-support to @cspotcode/source-map-support so that third-party libraries get correct source-mapped locations', async () => { | ||
const { stdout } = await exec({ | ||
flags: `./legacy-source-map-support-interop/index.ts`, | ||
}); | ||
expect(stdout.split('\n')).toMatchObject([ | ||
expect.stringContaining('.ts:2 '), | ||
'true', | ||
'true', | ||
expect.stringContaining('.ts:100:'), | ||
expect.stringContaining('.ts:101 '), | ||
'', | ||
]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { Logger } from 'tslog'; | ||
new Logger().info('hi'); | ||
console.log(require.resolve('source-map-support') === require.resolve('@cspotcode/source-map-support')); | ||
console.log(require.resolve('source-map-support/register') === require.resolve('@cspotcode/source-map-support/register')); | ||
/* | ||
tslog uses `require('source-map-support').wrapCallSite` directly. | ||
Without redirection to @cspotcode/source-map-support it does not have access to the sourcemap information we provide. | ||
*/ | ||
interface Foo { | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
console.log(new Error().stack!.split('\n')[1]); | ||
new Logger().info('hi'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"dependencies": { | ||
"@swc/core": "latest", | ||
"ts-node": "file:ts-node-packed.tgz" | ||
"ts-node": "file:ts-node-packed.tgz", | ||
"tslog": "3.2.2" | ||
} | ||
} |