admin管理员组文章数量:1332890
I'm using PhpStorm and trying to debug my application using breakpoints while running my Jasmine tests. I can get the debugger to pause at the breakpoint in my file.test.js files but when the test steps into my application code it opens the correct file but the incorrect line of code.
For example: If I set a breakpoint in my test at the await xyz()
line the debugger will go to the file that has the function xyz()
but it will go line 15 which is no where near the actual function declaration. Furthermore the debugger doesn't pause if I set breakpoints in the application code itself. So if I was to set a breakpoint in the xyz()
function the debugger just skips over it.
I begin by running this test
script which is in my package.json file:
"test": "cross-env BUILD_ENV=test UTIL_LOG=LOG_ALL nyc jasmine JASMINE_CONFIG_PATH=jasmine.json"
I think it has to do with the source maps but I'm not experienced enough in node, webpack, babel, etc to know for sure. Any help would be much appreciated.
Here's my webpack.config.js:
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const slsw = require('serverless-webpack');
module.exports = {
entry: slsw.lib.entries,
target: 'node',
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
externals: [nodeExternals()],
optimization: {
minimize: false
},
module: {
rules: [
{
test: /\.js$/,
use: [
{
loader: 'babel-loader',
options: {
retainLines: true
}
}
],
include: __dirname,
exclude: /node_modules/
}
]
},
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
},
devtool: 'source-map'
};
Here's my .babelrc:
{
"presets": [
[
"env",
{
"targets": {
"node": "18"
}
}
]
]
}
Here's my debug config in PhpStorm:
版权声明:本文标题:debugging - How to step into application code for PhpStorm debugger using Node.js & Serverless? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742319821a2452556.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论