VSCode和TypeScript的断点不一致

时间:2018-01-24 00:21:40

标签: typescript visual-studio-code

给出以下文件夹结构。

+ frontend
  + CreateReport
    + CreateReportInteractor.spec.ts
    + CreateReportInteractor.ts
+ tmp
  + frontend
    + CreateReportInteractor.js
    + CreateReportInteractor.js.map
    + CreateReportInteractor.spec.js
    + CreateReportInteractor.spec.js.map

我有一个node脚本(unittests / tester.js)来执行我的测试。这些正在加载正确的文件(tmp/frontend/*.spec.js)。

node --inspect=9229 --debug-brk unittests/tester.js

launch.json内,我有以下附加请求。

{
    "type": "node",
    "request": "attach",
    "name": "Attach",
    "port": 9229
}

这将附加到执行代码。它也会在进入第一行时中断。

我从调试器输出的.scripts是:

› <>/tmp/frontend/CreateReport/CreateReportInteractor.js
    - ../../../frontend/CreateReport/CreateReportInteractor.ts (<>/frontend/CreateReport/CreateReportInteractor.ts)
› <>/tmp/frontend/CreateReport/CreateReportInteractor.spec.js
    - ../../../frontend/CreateReport/CreateReportInteractor.spec.ts (<>/frontend/CreateReport/CreateReportInteractor.spec.ts)
› <>/tmp/frontend/app/Const.js
    - ../../../frontend/app/Const.ts (<>/frontend/app/Const.ts)
› <>/tmp/frontend/app/Requests/MockRequest.helper.spec.js
    - ../../../../frontend/app/Requests/MockRequest.helper.spec.ts (<>/frontend/app/Requests/MockRequest.helper.spec.ts)
› <>/tmp/frontend/app/Requests/MockRequestFactory.helper.spec.js
    - ../../../../frontend/app/Requests/MockRequestFactory.helper.spec.ts (<>/frontend/app/Requests/MockRequestFactory.helper.spec.ts)
› <>/tmp/frontend/app/Requests/Request.js
    - ../../../../frontend/app/Requests/Request.ts (<>/frontend/app/Requests/Request.ts)
› <>/tmp/frontend/app/Requests/RequestFactory.js
    - ../../../../frontend/app/Requests/RequestFactory.ts (<>/frontend/app/Requests/RequestFactory.ts)

但是,如果我在VSCode(红点)中放置断点,有时会停止执行,有时则不会。

如果我发出debugger;语句,它将始终停止执行。

如果我在debugger;语句之后放置一个VSCode断点,它将始终停止执行。

我的VSCode版本是1.19.2,Node是v6.9.4,TypeScript是2.6.2。

如果您有任何建议可以告诉我。我在过去的2个小时里一直在敲我的脑袋。

0 个答案:

没有答案