I am not able to get debugging working on VSCode for an E2E testing framework . Only this message is displayed - Waiting for the debugger to disconnect.
However I am able to get debugging up and running for a simple TS code. I am beginning to wonder if I am even going in the right direction.
Below are the tsconfig.json, package.json and launch.json for the not working and the working projects.
The framework is close to the one offered by protractor. Install protractor using
npm install -g protractor
You will see the framework in node_modules\protractor\exampleTypescript
tsconfig.json
{
"compilerOptions": {
"outDir": "tmp",
"rootDir": "./",
"sourceMap": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es2017",
"types": ["jasmine", "jasminewd2", "node"]
},
"exclude": [
"node_modules",
"asyncAwait",
"plugins.ts"
]
}
package.json
{
"name": "org_abc",
"version": "1.0.0",
"description": "org_abc_e2e automation tests",
"author": "org_abc",
"main": "./conf.ts",
"license": "org_abc",
"scripts": {
"webdriver-update": "npx webdriver-manager update",
"prestart": "npm run build",
"build": "tsc",
"tsc": "tsc",
"test": "npm run tsc && protractor tmp/conf.js"
},
"dependencies": {
"@types/jasmine": "^2.8.9",
"@types/jasminewd2": "^2.0.4",
"@types/node": "^10.12.0",
"adm-zip": "0.4.7",
"chance": "^1.0.16",
"chromedriver": "^2.41",
"colors": "1.1.2",
"geckodriver": "1.8.1",
"jasmine": "^2.99.0",
"jasmine-reporters": "2.2.1",
"jasmine-spec-reporter": "4.2.1",
"mocha": "^5.2.0",
"protractor": "^5.4.1",
"protractor-jasmine2-screenshot-reporter": "0.4.0",
"selenium-server": "^3.13.0",
"selenium-webdriver": "^4.0.0-alpha.1",
"ts-node": "^7.0.1",
"webdriver-manager": "^12.0.6",
"xml2js": "~0.4.19"
},
"devDependencies": {
"@types/jasmine": "^2.8.8",
"@types/jasminewd2": "^2.0.4",
"ts-node": "^7.0.1",
"typescript": "^2.9.2",
"yarn": "^1.10.1"
}
}
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "XPIA",
"program": "${workspaceFolder}\\conf.ts",
"preLaunchTask": "npm: build",
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"protocol": "auto",
"args": ["${workspaceRoot}\\conf.ts"],
"outFiles": [
"${workspaceFolder}/tmp/**/*.js"
]
}]
}
Debug output:
C:\Program Files\nodejs\node.exe --inspect-brk=31907 tmp\conf.js C:\Users\user_name\Documents\automation\conf.ts
Debugger listening on ws://127.0.0.1:31907/5ffdafc9-39d4-4f1a-afad-2593d4adacd7
Debugger attached.
Waiting for the debugger to disconnect...
=========================== The below one is a simple project and I am able to debug it:
In VS Code, I created a TS file with a couple of variables and I am able to debug.
tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"outDir": "./out",
"rootDir": "./src",
"sourceMap": true,
"moduleResolution": "node",
"target": "es5"
}
}
package.json
{
"name": "typescript-debugging",
"version": "1.0.0",
"description": "typescript-debugging-desc",
"main": "src/app.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node out/app.js",
"prestart": "npm run build",
"build": "tsc"
},
"author": "",
"license": "ISC",
"devDependencies": {
"typescript": "^3.1.3"
}
}
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\src\\app.ts",
"preLaunchTask": "npm: build",
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"outFiles": [
"${workspaceFolder}/out/**/*.js"
]
}]
}

