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

'Debug' does not filter on 'Describe' block #281

Closed
TheAlmightyBob opened this issue Mar 9, 2018 · 3 comments · Fixed by #593
Closed

'Debug' does not filter on 'Describe' block #281

TheAlmightyBob opened this issue Mar 9, 2018 · 3 comments · Fixed by #593
Labels

Comments

@TheAlmightyBob
Copy link

Environment

  1. node -v: 9.4.0

  2. npm -v: 5.6.0

  3. Operating system: macOS Sierra

Steps to Reproduce

  1. Have tests (in the same file, or two files that have the same name but live in different directories) of the style:
describe('component 1', () => {
  it('does the thing', () => { ... });
});
describe('component 2', () => {
  it('does the thing', () => { ... });
});
  1. Have one of the tests fail
  2. Click the 'Debug' button

Expected Behavior

Only the failing test is run with the debugger.

Actual Behavior

Both tests are run with the debugger, because it is matching 'does the thing' (and filename) and ignoring the describe scope.

@seanpoulter
Copy link
Member

Thanks for reporting the issue. If we split this up into two parts:

  • It looks like we don't actually use the file name when filtering the file. That'd be a quick PR if you'd like to have a go at it.

  • To differentiate between two tests with the same name in one file -- can Jest do that from the command line? Does it match the testNamePattern argument match text in describe?

@seanpoulter seanpoulter added the bug label Mar 9, 2018
@TheAlmightyBob
Copy link
Author

TheAlmightyBob commented Mar 10, 2018

  1. It's using the file name (at least, I think so?), just not the file path. I don't know how common this is with other projects, but we allow test files to have the same name and use the path to differentiate.
  2. Yes, testNamePattern matches a combined string of "<describe text> <it text>". As long as vscode-jest knows the describe context, it should be able to use that.

Should this be split into two separate issue reports?

@TheAlmightyBob
Copy link
Author

Finally looking more into this, it actually doesn't look like vscode-jest has access to the describe context... so that may be a problem... IParseResults from jest-editor-support only appears to include the it text...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants