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

Add ability to exclude messages by regex #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrismwendt
Copy link

This adds the ability to exclude console messages by regex on a plugin config level and per-test level.

The implementation is pretty hacky since it uses a global variable global.PROTRACTOR_CONSOLE_EXCLUDE_REGEX to store per-test regexes. The only other alternative I could think of is to patch jasmine and protractor to propagate test-specific metadata. Any thoughts on this? 💬

Fixes #5

@pmowrer
Copy link
Contributor

pmowrer commented Aug 17, 2017

Thanks for taking a stab at this @chrismwendt! Protractor allows for plugins to pass options: https://github.com/angular/protractor/blob/master/docs/plugins.md#using-plugins. Perhaps that would work better than the global variable?

@chrismwendt
Copy link
Author

Protractor plugin options are evaluated once at the beginning of an entire run, right? That could work if a massive dictionary (test name -> regex) is provided up front, but has the downside of requiring the regex for a test to be specified far from the test definition. That would still have the downside of requiring the test name to be specified twice (once in the test definition and once in the dictionary).

Another hacky approach could be to embed the regex (if there is one) in the test name itself (e.g. it('should emit a console error /some error to be ignored/', function() { ... })) and extract what's between the /s in the plugin.

@pmowrer
Copy link
Contributor

pmowrer commented Aug 29, 2017

Maybe a more generic "filter" option to pass a function is more appropriate then. It would essentially give you the power to do whatever you want.

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.

2 participants