-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix the filepath of the stack #7
Conversation
This error is introduced by power-assert-js#6
If remove this, the ts path will be wrong. For example // index.js
require('intelli-espower-loader');
require('./test/foo.test.js');
// test/foo.test.js
throw new Error('123');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJmb28udGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJQSxNQUFNLElBQUksS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDIn0= and run node index.js
|
@shepherdwind can you give us the code which is generating the sourcemap by ts |
It seems |
I know what is the problem now. The first example, js file don't have sourcemap comment, so there is not source map and source path. Then the source path lookup by the function adjustFilepath. The source file path will be a relative path , for example And the next example, js code have some source map comment. And ts source map file source just a file name ,not a path, for example I don't know if we can change adjustFilepath to return the file name? |
@shepherdwind Would you create a small project or gist to reproduce your issue? I'll investigate the problem. |
@shepherdwind Thanks for the repro case. I'm going to accept @popomore's PR since correct and relative filepath is more important to power-assert for security reason and for users using power-assert on browsers. espower-source makes every path relative to project root (that's why SourceMap that espower-loader reads is generated by espower-source, that is reconnected with the original SourceMap by multi-stage-sourcemap. Original SourceMap may contain multiple sources stored in different directories. It's difficult to set sourceRoot after the sourcemap processing. @shepherdwind, is there any way to make TypeScript storing more informative paths instead of basename? |
Ok, I will try to do something to add more info for typescript source map. Accept this pr is fine. |
fix it quickly, Please 😖 |
Just released espower-loader 1.2.2 |
@twada thx |
@twada good |
This error is introduced by #6
How to reproduce
run
node index.js
, then you can see the wrong path/Users/popomore/code/tmp/test/test/index.test.js