Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants