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

Cannot read property 'matcherResult' of undefined #2

Open
vivacenontroppo opened this issue Sep 30, 2020 · 8 comments
Open

Cannot read property 'matcherResult' of undefined #2

vivacenontroppo opened this issue Sep 30, 2020 · 8 comments

Comments

@vivacenontroppo
Copy link

Clear installation of the package, basic setup and all I got on tests that that passes is Cannot read property 'matcherResult' of undefined

package.json

"devDependencies": {
    "@types/jasmine": "^3.5.14",
    "@types/node": "^14.6.4",
    "@wdio/cli": "^6.4.2",
    "@wdio/devtools-service": "^6.4.3",
    "@wdio/jasmine-framework": "^6.4.0",
    "@wdio/local-runner": "^6.4.2",
    "@wdio/spec-reporter": "^6.4.0",
    "@wdio/sync": "^6.4.0",
    "chromedriver": "^85.0.0",
    "tslint": "^6.1.3",
    "wdio-chromedriver-service": "^6.0.3",
    "wdio-slack-service": "^2.0.8"
  },
  "dependencies": {
    "@rpii/wdio-html-reporter": "~1.0.0",
    "@slack/web-api": "^5.12.0",
    "@wdio/reporter": "^6.4.7",
    "typescript": "^4.0.2",
    "wdio-timeline-reporter": "^5.1.4"
  }

output:

npx wdio wdio.conf.js --spec dist/specs/search.e2e.js

Execution of 1 spec files started at 2020-09-30T11:31:54.392Z

Starting ChromeDriver 85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183@{#779}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[0-0] RUNNING in chrome - /dist/specs/search.e2e.js
[0-0] 2020-09-30T11:32:03.777Z ERROR @wdio/sync: TypeError: Cannot read property 'matcherResult' of undefined
    at SlackService.afterTest (/Users/marian/projects/***-com-e2e/node_modules/wdio-slack-service/src/index.js:31:31)
    at execHook (/Users/marian/projects/***-com-e2e/node_modules/@wdio/sync/build/executeHooksWithArgs.js:32:23)
[0-0] Error in "AfterTest Hook"
Cannot read property 'matcherResult' of undefined
[0-0] Date calculation: 1601465528836 - 1594072800000 = 86
[0-0] Number days on *** on the page was: 85 and expected from calculation: 86 
[0-0] 2020-09-30T11:32:08.912Z ERROR @wdio/sync: TypeError: Cannot read property 'matcherResult' of undefined
    at SlackService.afterTest (/Users/marian/projects/***-com-e2e/node_modules/wdio-slack-service/src/index.js:31:31)
    at execHook (/Users/marian/projects/***-com-e2e/node_modules/@wdio/sync/build/executeHooksWithArgs.js:32:23)
[0-0] Error in "AfterTest Hook"
Cannot read property 'matcherResult' of undefined
[0-0] PASSED in chrome - /dist/specs/search.e2e.js
TIMELINE:ScreenshotService: Attempting to resize 3 images
--------
TIMELINE REPORTER: Created /Users/marian/projects/***-com-e2e/reports/timeline-report.html
--------

 "spec" Reporter:
------------------------------------------------------------------
[chrome 85.0.4183.121 mac os x #0-0] Spec: /Users/***/projects/***/dist/specs/search.e2e.js
[chrome 85.0.4183.121 mac os x #0-0] Running: chrome (v85.0.4183.121) on mac os x
[chrome 85.0.4183.121 mac os x #0-0] Session ID: 1e0b172b57334e32acd0763862e337d4
[chrome 85.0.4183.121 mac os x #0-0]
[chrome 85.0.4183.121 mac os x #0-0] Test search exit properties only: 
[chrome 85.0.4183.121 mac os x #0-0]    ✓ ***
[chrome 85.0.4183.121 mac os x #0-0]    ✓ ***
[chrome 85.0.4183.121 mac os x #0-0]
[chrome 85.0.4183.121 mac os x #0-0] 2 passing (12.7s)


Spec Files:      1 passed, 1 total (100% completed) in 00:00:18 
@anhhanuman
Copy link

let testError = error.matcherResult

this code is used in Jest
I'm not sure what is it equal to other test frameworks such as jasmine

I have to comment out these block of code in order to not introduce the error as above

let testError = error.matcherResult
            .message()
            .replace(
                /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
                ""
            );

footer: testError.toString(),

@pmerwin
Copy link

pmerwin commented Mar 26, 2021

any solution to this? matcherResult undefined for me as well.

@vivacenontroppo
Copy link
Author

@pmerwin for me it was just switching to @slack/web-api and writing my own reporter, which works great with this package. The one I described above, as you can see noone cares.

@pmerwin
Copy link

pmerwin commented Mar 27, 2021

@pmerwin for me it was just switching to @slack/web-api and writing my own reporter, which works great with this package. The one I described above, as you can see noone cares.

Yeah that's what I am working on now, thanks !

@vivacenontroppo
Copy link
Author

@carmenmitru
Copy link
Owner

@vivacenontroppo @pmerwin @anhhanuman @vivacenontroppo I published a new version of the npm package.

@andisan86
Copy link

andisan86 commented May 18, 2021

I am still getting the same issue with version 2.0.8. Any hints to get around this?

Sorry I did not realise that there was version 2.0.9. This error was not reproducible anymore for me in version 2.0.9

@vivaan007
Copy link

vivaan007 commented Dec 8, 2021

It fails for me even with version 2.0.9
However, commenting out error.matcherResult line and the attachment code, it works fine showing the status.

@carmenmitru Below is the results value in aftertest:

{
  retries: { attempts: 0, limit: 0 },
  error: Error [AssertionError]: expected 3329 to equal 3330
      at /Users/vivektripathi/mobile_automation/src/specs/apiTests/suggestionsAPI.spec.js:18:48
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at Context.<anonymous> (/Users/vivektripathi/mobile_automation/src/specs/apiTests/suggestionsAPI.spec.js:9:13),
  result: undefined,
  duration: 23931,
  passed: false
}

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

No branches or pull requests

6 participants