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

--coverage-exclude should support multiple paths #508

Closed
geek opened this issue Jan 5, 2016 · 7 comments
Closed

--coverage-exclude should support multiple paths #508

geek opened this issue Jan 5, 2016 · 7 comments
Assignees
Labels
Milestone

Comments

@geek
Copy link
Member

@geek geek commented Jan 5, 2016

Currently, the cli option only supports a single path, this is a bug and it should support multiple paths passed in as an array

@geek geek added the bug label Jan 5, 2016
@geek geek self-assigned this Jan 5, 2016
@geek geek added this to the 8.0.2 milestone Jan 5, 2016
@Marsup

This comment has been minimized.

Copy link
Member

@Marsup Marsup commented Jan 5, 2016

@geek I think it is, you just have to repeat the switch for each additional path.

@geek

This comment has been minimized.

Copy link
Member Author

@geek geek commented Jan 5, 2016

@Marsup ! you are correct, I will make the documentation clearer

@geek geek added documentation and removed bug labels Jan 5, 2016
@geek geek closed this in 8e61f46 Jan 5, 2016
@EvilJimJafar

This comment has been minimized.

Copy link

@EvilJimJafar EvilJimJafar commented Aug 29, 2017

@geek Is this flag supported in .labrc? I have tried the following with no success:

module.exports = {
  coverage: true,
  threshold: 69,
  'coverage-exclude': [
    'models',
    'config',
    'enums'
  ]
}
module.exports = {
  coverage: true,
  threshold: 69,
  coverageExclude: [
    'models',
    'config',
    'enums'
  ]
}
@geek

This comment has been minimized.

Copy link
Member Author

@geek geek commented Aug 29, 2017

@JimSangwine coverage-exclude is supported in the rc file. Are models, config, enums all folders that you want excluded?

At the moment the coverage test regex will look something like the following given your config:

^\/Users\/jim\/project\/(?!node_modules\/|test\/|models\/|config\/|enums\/)

so '/Users/jim/project/models/index.js' will be excluded but '/Users/jim/project/models.js' won't

@EvilJimJafar

This comment has been minimized.

Copy link

@EvilJimJafar EvilJimJafar commented Aug 30, 2017

Ah, thanks @geek - I didn't realise it would take a regex.

@geek

This comment has been minimized.

Copy link
Member Author

@geek geek commented Aug 30, 2017

@JimSangwine here is the code that generates the regex: https://github.com/hapijs/lab/blob/master/lib/coverage.js#L50-L57

@EvilJimJafar

This comment has been minimized.

Copy link

@EvilJimJafar EvilJimJafar commented Aug 31, 2017

Ah! So I don't pass my own regex, it does accept an array of strings.

I tested again and found that the 'coverage-exclude' form works but 'coverageExclude' does not. I must have had a typo or something when I was testing originally.

For other anyone else with this question, this works:

.labrc.js

module.exports = {
  coverage: true,
  threshold: 69,
  'coverage-exclude': [
    'models',
    'config',
    'enums'
  ]
}

Thanks for the clarification @geek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.