首页 > 解决方案 > Cucumber Protractor 测试在 VS Code 中启动,但不会在断点处停止

问题描述

我正在尝试使用特定标签调试场景。@debug在这种情况下。我能够启动并运行该案例。但是,VS Code 不会在断点处停止脚本。

这是一个用 TypeScript 编写的 Cucumber + Protractor 脚本。

启动.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "protocol": "inspector",
            "console": "integratedTerminal",
            "name": "AHA",
            "stopOnEntry": false,
            // "program": "${workspaceRoot}/node_modules/cucumber/bin/cucumber-js",
            "program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
            "args": [
                "${workspaceRoot}/dist/config/config.js",
                "--cucumberOpts.tags",
                "@debug",
                "--params.env",
                "QADev"
            ],
            "cwd": "${workspaceFolder}",
            "runtimeArgs": [
                "--nolazy"
            ],
            "sourceMaps": true
        }
    ]
}

设置.json

    "cucumberautocomplete.syncfeatures": "./features/**/*.feature",
    "cucumberautocomplete.strictGherkinCompletion": true,
    "cucumberautocomplete.smartSnippets": true,
    "cucumberautocomplete.onTypeFormat": true,
    "cucumberautocomplete.steps": [
        "step_definitions/*.ts"
    ],

tsconfig.json

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "module": "commonjs",
    "target": "ES2020",
    "moduleResolution": "node",
    "sourceMap": true,
    "mapRoot": "/dist/step_definitions/",
    "declaration": false,
    "removeComments": false,
    "noImplicitAny": false,
    "skipLibCheck": true,
    "outDir": "dist",
    "typeRoots": ["./node_modules/@types"],
    "types": ["node", "reflect-metadata"],
    "lib": ["ES2020"],
    "resolveJsonModule": true
  },
  "exclude": ["node_modules", "dist"]
}

标签: visual-studio-codeprotractorcucumbervscode-debugger

解决方案


推荐阅读