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 #60

Closed filmerjarred closed 4 years ago

filmerjarred 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 #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 @BrighTide!

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!

facebook-github-bot commented 4 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

facebook-github-bot commented 4 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

aaronabramov commented 4 years ago

looks good! thank you! i'm a little worried about child processes not being killed properly, since they're detached but i'll try to test it more thoroughly