User supplied parsers #45

wants to merge 4 commits into


None yet

2 participants


This adds the ability for users to supply a custom parser by:

  • providing the path to a module that will be required, the path must end in a .* extension
  • providing a custom parsing object (when used programmatically)

This should help in cases where a custom reporter is being used; it allows users to design a parser that fits their needs without having to update protractor-flake itself.

Eventually it would be nice to provide some tools to make parsing output easier but this is a first step.

added some commits Dec 9, 2016
@NickTomlin fix: Move option parsing into a separate module 2052ed9
@NickTomlin feat: Add ability to pass custom parser path/function

@wswebcreation I'd love to hear any thoughts you have on this


Sorry for my late reaction

Will check it tomorrow

+ return parserObject
+function handlePah (parserPath) {
wswebcreation Dec 17, 2016 Collaborator

Typo? handlePath

NickTomlin Dec 17, 2016 Owner

Yep! Great catch!

+Parsers should be defined as an object with a `parse` method (and optionally a `name` property):
+module.exports = {
wswebcreation Dec 17, 2016 Collaborator

Use this as an example from your last merge to get more consistency?

module.exports = {
  parse (protractorTestOutput) {
    let failedSpecs = new Set()
    // ... analyze protractor test output
    // ... and add to specFiles

    // specFiles to be re-run by protractor-flake
    // if an empty array is returned, all specs will be re-run
    return [...failedSpecs]
NickTomlin Dec 17, 2016 Owner

I think that makes a lot of sense ๐Ÿ‘


Hi @NickTomlin,

PR looks nice, 2 small comments. Can be merged afterwards.



added some commits Dec 17, 2016
@NickTomlin chore: Update custom parser example to use set 2d9271c
@NickTomlin fix: Correct typo in parsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment