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

feat(rbac): add vscode debug test configuration for rbac-backend #1025

Closed

Conversation

AndrienkoAleksandr
Copy link
Collaborator

@AndrienkoAleksandr AndrienkoAleksandr commented Dec 15, 2023

What doest this pull request do:

Add ability to debug opened and selected test files for rbac-backend plugin in the vscode.

@AndrienkoAleksandr AndrienkoAleksandr marked this pull request as ready for review December 15, 2023 15:11
@AndrienkoAleksandr AndrienkoAleksandr force-pushed the addRBACBackendTestDebugConfiguration branch from 9c0cd0b to 64cc703 Compare December 15, 2023 15:13
@AndrienkoAleksandr AndrienkoAleksandr changed the title rbac(feat): add vscode debug test configuration for rbac-backend feat(rbac): add vscode debug test configuration for rbac-backend Dec 15, 2023
Copy link

sonarcloud bot commented Dec 15, 2023

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@invincibleJai
Copy link
Member

@AndrienkoAleksandr i tried to test it on launching debug in VScode , i see below in terminal. Any help with what am i missing?

image

@christoph-jerolimov
Copy link
Member

christoph-jerolimov commented Dec 22, 2023

@invincibleJai, you need to select a rbac-backend test and add a breakpoint. Then it's working fine for me. And I really like it 👍

From my side we can merge this if this helps people.

I have just two suggestions / ideas:

  1. Can we create a lunch setting that is working for all unit tests?
  2. Do we really need the ts-jest dependency?
  3. Should it --watch for changes?

I tried this launch setting and it spams the console with some more warning, but on the first look it's working as well?

{
  "version": "1.0.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Current selected test",
      "program": "${workspaceRoot}/node_modules/.bin/backstage-cli",
      "args": ["package", "test", "${relativeFile}"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
    }
  ]
}

@AndrienkoAleksandr can you take a look if this working for you?

@AndrienkoAleksandr
Copy link
Collaborator Author

@jerolimov , hello. I tested your vscode configuration. It works fine for rbac-backend-plugin.

Can we create a launch setting that is working for all unit tests?

Looks like, we can. You provided plenty universal configuration.

Do we really need the ts-jest dependency?

It is required for my pull request, because my vscode configuration uses original jest binary and It needs typescript transformer and parser.
You provided vscode configuration based on backstage cli. And I see this binary works somehow without this dependency. I guess typescript transformer can be compiled to the cli binary like transitive dependency. Also I see your solution is working for different plugin packages.

Should it --watch for changes?

I guess you proposed configuration with --watch by default, because when I modify test file, then debugger executes test one more time. That's --watch behavior from my point of view.

@jerolimov I think you can create pull request with your idea, then I can close my pull request on favor yours.

@christoph-jerolimov
Copy link
Member

christoph-jerolimov commented Dec 29, 2023

@AndrienkoAleksandr Feel free to take my json and update your PR with these changes, with or without ts-lint. I'm back next week and vscode lanucher isn't a prio for me currently. ;)

I'm also fine if we merge your PR in its current form and improve later if needed.

@AndrienkoAleksandr
Copy link
Collaborator Author

@jerolimov ok, I close this pull request on favor #1047

@schultzp2020 schultzp2020 deleted the addRBACBackendTestDebugConfiguration branch April 5, 2024 14:49
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

Successfully merging this pull request may close these issues.

3 participants