Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with getting docker compose debug working correctly #224

Open
duncanf95 opened this issue Nov 3, 2022 · 0 comments
Open

Help with getting docker compose debug working correctly #224

duncanf95 opened this issue Nov 3, 2022 · 0 comments

Comments

@duncanf95
Copy link

Hey, for a few month on and off I've been trying to get this project to run tests in a docker image created by a docker compose file, and ran with docker-compose up. This is the way my job runs most of it's services locally.

I've found success in getting the tests to run, I have 2 repos to show an example api and a fork of the launcher scripts

settings.json:

{
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
      },
      "eslint.validate": ["typescript"],
      "mochaExplorer.files": "test/**/*.ts",
      "mochaExplorer.launcherScript": "node_modules/mocha-explorer-launcher-scripts/docker-compose",
      "mochaExplorer.require": [ "ts-node/register" ],
      "mochaExplorer.debuggerConfig": "Debug in Docker",
      "mochaExplorer.logpanel": true,
      "mochaExplorer.exit": true,
      "mochaExplorer.debuggerPort": 9230,
      "mochaExplorer.timeout": 15000,
      "mochaExplorer.env": {
        "DOCKER_CONTAINER_NAME": "example_app"
      }
}

If you clone both, run npm link on the launcher script fork and then run npm link mocha-explorer-launcher-scripts in the example-api folder. Add the settings above to the settings.json and then run a docker compose up. After this you'll notice that the tests run in the test explorer and provide correct feedback on whether they pass or fail when run.

The place where I've gotten stuck in the debugging part of it, I can't seem to get it to hit breakpoints and I feel like I must be misunderstanding the process a little. I've left my launch.json below to help. If anyones able to shed light on what I'm doing wrong I would bevery grateful. i hope to contribute this example back when I'm done so this becomes an easier process.

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "node",
			"request": "attach",
			"name": "Debug in Docker",
			"timeout": 30000,
			"continueOnAttach": true,
			"remoteRoot": "/app",
			"sourceMaps": true,
			"port": 9230,
			"resolveSourceMapLocations": [
				"${workspaceFolder}/**",
  				"!**/node_modules/**"
			]
		}
	]
}
@duncanf95 duncanf95 changed the title Help with getting docker docmpose debug working correctly Help with getting docker compose debug working correctly Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant