facebook-atom / jest-electron-runner

custom test runner for Jest that allows tests to be run in Electron environment
MIT License
189 stars 33 forks source link

Work around enable debugging and logging #59

Closed CS-Jfilmer closed 4 years ago

CS-Jfilmer commented 4 years ago

I'm not sure if this is a permanent solution (as I'm not sure what function detach:true was serving) but this enables people to easily get logs and attach a debugger to the test process which fixes https://github.com/facebook-atom/jest-electron-runner/issues/30

My rough vscode launch config below (was altered to remove a bunch of implementation specific details, so might not work if you copy exactly, but point is you use a compound launch task to 1. start the test and 2. connect to the process running the test at JEST_ELECTRON_RUNNER_DEBUG_PORT

{
    "version": "0.2.0",
    "compounds": [
        {
            "name": "Electron - Run test file",
            "configurations": ["Run test file", "Connect to electron main"]
        }
    ],
    "configurations": [
        {
            "name": "Run tests",
            "type": "node",
            "request": "launch",
            "env": {
                "JEST_ELECTRON_RUNNER_DEBUG_PORT": "8500"
            },
            "program": "node_modules/jest/bin/jest.js",
            "args": [
                "${command:currentDistFile}",
                "--runInBand",
            ],
            "console": "integratedTerminal",
        },
        {
            "name": "Connect to electron main",
            "type": "node",
            "request": "attach",
            "port": 8500,
            "address": "localhost",
            "timeout": 30000,
            "restart":true
        },
    ]
}
facebook-github-bot commented 4 years ago

Hi @CS-Jfilmer!

Thank you for your pull request and welcome to our community.We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!