Comments (18)
did you tried to workaround with the excludePending
option?
from mocha-trx-reporter.
from mocha-trx-reporter.
Same issue here
2019-09-02T18:44:17.1637752Z TypeError: test.isPending is not a function 2019-09-02T18:44:17.1639484Z at testResults.tests.forEach (E:\agents\myagent-test-0\_work\r2\a\TESTS\release\node_modules\mocha-trx-reporter\lib\trx.js:92:22) 2019-09-02T18:44:17.1641447Z at Array.forEach (<anonymous>:null:null) 2019-09-02T18:44:17.1643429Z at Runner.ReporterTrx.runner.on (E:\agents\myagent-test-0\_work\r2\a\TESTS\release\node_modules\mocha-trx-reporter\lib\trx.js:91:27) 2019-09-02T18:44:17.1646632Z at emitOne (events.js:121:20) 2019-09-02T18:44:17.1649120Z at Runner.emit (events.js:211:7) 2019-09-02T18:44:17.1652497Z at Reporter.emit (C:\Users\myagent-test\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\lib\reporter.js:239:55) 2019-09-02T18:44:17.1656527Z at Object.server.startWebsockets.onMocha (C:\Users\myagent-test\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\lib\project.js:298:22) 2019-09-02T18:44:17.1659438Z at Socket.<anonymous> (C:\Users\myagent-test\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\lib\socket.js:235:36) 2019-09-02T18:44:17.1662081Z at emitTwo (events.js:126:13) 2019-09-02T18:44:17.1665662Z at Socket.emit (events.js:214:7) 2019-09-02T18:44:17.1668360Z at C:\Users\myagent-test\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\socket\node_modules\socket.io\lib\socket.js:503:12 2019-09-02T18:44:17.1671679Z at _combinedTickCallback (internal/process/next_tick.js:131:7) 2019-09-02T18:44:17.1678187Z at process._tickCallback (internal/process/next_tick.js:180:9)
from mocha-trx-reporter.
It seems that Cypress uses its own version of Mocha, instead of picking up the project's version: cypress-io/cypress#4652 and the version that Cypress includes doesn't have the isPending() method.
Some reporters are implemented using only events while other like XUnit and mocha-trx-reporter are implemented using the isPending()
method.
So, this could be solved by Cypress or by changing the way these reporters are implemented to not rely on Runnable.isPending()
method. I'd prefer the former, but I would accept a pull request that changes this reporter to prevent this issue.
from mocha-trx-reporter.
Update: mocha-trx-reporter was also bringing in its own mocha version, perhaps that was part of the issue too. This was changed in v3.2.4
so perhaps this new version behaves properly even with Cypress.
Closing the issue now.
from mocha-trx-reporter.
@pmoleri I still have the same issue in mocha-trx-reporter version 3.2.4.
Is there a workaround for it?
Is there a specific version of mocha that we have to use with cypress & cypress-multi-reporters& mocha-trx-reporter?
from mocha-trx-reporter.
@smarandav mocha-trx-reporter
relies in Runnable.isPending()
method that was introduced in [email protected] 4 years ago.
I think you need to either:
- Update to a Cypress version that uses a more recent version of Mocha.
(you probably can check the version that Cypress is using by looking for mocha in yourpackage-lock.json
) - Find a way to monkey patch the Runnable class to add the missing method.
You can probably do this by requiring a local setup file in your https://mochajs.org/#mochaopts
If you choose to monkey patch to fix this issue, I can't tell you if some other issues will appear.
from mocha-trx-reporter.
@pmoleri thanks for your help
I have doubled checked and I am using latest version of mocha in both my packages that need it (cypress-multi-reporters, mocha-trx-reporter).
When installing those two ^^ I do not have a hardcoded mocha dependency as per package-lock.json but still it complains about not finding the isPending() method.
"cypress-multi-reporters": {
"version": "1.4.0",
"resolved": "http://packages.je-labs.com/npm/private-npm/cypress-multi-reporters/-/cypress-multi-reporters-1.4.0.tgz",
"integrity": "sha1-Xx0EhKIJWc/ngvG/Za0Wxq2ATac=",
"dev": true,
"requires": {
"debug": "^4.1.1",
"lodash": "^4.17.15"
},
"mocha-trx-reporter": {
"version": "3.2.4",
"resolved": "http://packages.je-labs.com/npm/private-npm/mocha-trx-reporter/-/mocha-trx-reporter-3.2.4.tgz",
"integrity": "sha512-hY4rHfzl49TgmgfkkgCskQIiOmi8J8h+/XcuPNz3y5HtdebD7uOKY6o+7LZVB/xg+3zfwmJ+weXqpinnVsJ5kA==",
"dev": true,
"requires": {
"node-trx": "^0.9.1"
}
}
from mocha-trx-reporter.
@pmoleri I am looking at the mocha repo and I can see that isPending has '@Private' attribute vs the skip one for instance which has an explicit definition as @public & @memberof Mocha.Runnable?
https://github.com/mochajs/mocha/blob/cb5eb8ed42abfd0d63c5013353843f1208ff6582/lib/runnable.js#L142
vs
https://github.com/mochajs/mocha/blob/cb5eb8ed42abfd0d63c5013353843f1208ff6582/lib/runnable.js#L132
from mocha-trx-reporter.
I am looking at the mocha repo and I can see that isPending has '@Private' attribute vs the skip one for instance which has an explicit definition as @public & @memberof Mocha.Runnable?
I see what you mean. Although the official XUnit reporter also uses this method.
It seems that there's no clear official way to get the pending state of a test.
I have doubled checked and I am using latest version of mocha in both my packages that need it (cypress-multi-reporters, mocha-trx-reporter).
Don't you also have cypress
as a dependency? Have you tried updated this one?
Could you check the actual resolved version of mocha
? Just look for occurrences of "mocha": {
in your package-lock.json.
from mocha-trx-reporter.
I am looking at the mocha repo and I can see that isPending has '@Private' attribute vs the skip one for instance which has an explicit definition as @public & @memberof Mocha.Runnable?
I see what you mean. Although the official XUnit reporter also uses this method.
It seems that there's no clear official way to get the pending state of a test.
I think xUnit reporter is failing with the same error!
I have doubled checked and I am using latest version of mocha in both my packages that need it (cypress-multi-reporters, mocha-trx-reporter).
Don't you also have
cypress
as a dependency? Have you tried updated this one?
Could you check the actual resolved version ofmocha
? Just look for occurrences of"mocha": {
in your package-lock.json.
Cypress does not depend on mocha at all, only those two packages I mentioned above do and I do not have any hardcoded dependency of mocha in my package-lock.json file.
from mocha-trx-reporter.
Cypress does not depend on mocha at all, only those two packages I mentioned above do and I do not have any hardcoded dependency of mocha in my package-lock.json file.
Ok, I was assuming it was, I dont know anything about Cypress. However, someone should be requiring Mocha beacuse it's a peerDependency in both [email protected]
and [email protected], that means that both reporters rely on someone else requiring mocha => 3.1.2
.
You could try npm install --save-dev mocha@latest
, but my understanding from issue cypress-io/cypress#4652 is that Cypress is in fact bringing its own mocha version (a pretty old one).
from mocha-trx-reporter.
ok, thanks for looking into it.
My issue is with latest version of mocha and the error I have is in the mocha-trx-reporter here)
TypeError: test.isPending is not a function
at C:\source\RestaurantClaimsWeb\node_modules\mocha-trx-reporter\lib\trx.js:92:22
at Array.forEach (:null:null)
at Runner. (C:\source\RestaurantClaimsWeb\node_modules\mocha-trx-reporter\lib\trx.js:91:27)
at Runner.emit (events.js:208:15)
at Reporter.emit (C:\Users\AppData\Local\Cypress\Cache\3.8.3\Cypress\resources\app\packages\server\lib\reporter.js:234:55)
at Object.onMocha (C:\Users\AppData\Local\Cypress\Cache\3.8.3\Cypress\resources\app\packages\server\lib\project.js:359:18)
at Socket. (C:\Users\AppData\Local\Cypress\Cache\3.8.3\Cypress\resources\app\packages\server\lib\socket.js:303:32)
at Socket.emit (events.js:203:13)
at C:\Users\AppData\Local\Cypress\Cache\3.8.3\Cypress\resources\app\packages\socket\node_modules\socket.io\lib\socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:75:11)
from mocha-trx-reporter.
And my question is: does that isPending() method gets exposed outside the Runnable class in mocha as I can see it has the '@Private' attribute
https://github.com/mochajs/mocha/blob/cb5eb8ed42abfd0d63c5013353843f1208ff6582/lib/runnable.js#L142
from mocha-trx-reporter.
And my question is: does that isPending() method gets exposed outside the Runnable class in mocha as I can see it has the '@Private' attribute.
Yes JS doesn't have a real notion of private methods, that's only a documentation annotation.
Everything works fine when not used in Cypress.
BTW, this is the mocha dependency on [email protected]. I don't know what version are you running. Could you try updating to Cypress >=4.5.0?
from mocha-trx-reporter.
I have "cypress": "^4.7.0",
from mocha-trx-reporter.
but I do have another package that has hardcoded cypress dependency,
"@vue/cli-plugin-e2e-cypress": {
"version": "4.4.1",
"resolved": "http://packages.je-labs.com/npm/private-npm/@vue/cli-plugin-e2e-cypress/-/cli-plugin-e2e-cypress-4.4.1.tgz",
"integrity": "sha1-n2zA7YJDrVc6nzMZzyQ7MI7F07A=",
"dev": true,
"requires": {
"@vue/cli-shared-utils": "^4.4.1",
"cypress": "^3.8.3",
"eslint-plugin-cypress": "^2.10.3"
},
from mocha-trx-reporter.
Well, that's really confusing now. From what I've seen Cypress 4.7.0 is using a modern mocha version, even if you have that other dependency I don't think it should be an issue.
Somehow, Cypress is getting in the way and something that works directly with Mocha fails when running from Cypess.
I can only suggest you to fork the project and tweak it in a way that doesn't rely on isPending() method.
Anyway, I do recommend you to put mocha@^7.0.0
as a top dependency in your project. Why? Because both reporters depend on it, and when they do require("mocha")
they will get an unknown version that may be incompatible with them. And 7.x should be compatible with Cypress 4.7.
from mocha-trx-reporter.
Related Issues (11)
- Installation problems behind proxy HOT 1
- readme doesn't give usage for most reporter-options HOT 3
- JS Errors are not populating <Message> field in .trx file
- Failing mocha hooks lead to missing unit tests HOT 3
- generating trx with classname and name as none HOT 3
- Vulnerability HOT 1
- "mocha-trx-reporter" throwing error as "TypeError: Cannot read property 'start' of undefined"" HOT 5
- TRX reporter is not reporting the hook failures HOT 6
- Add support for screenshots HOT 7
- mocha-trx-reporter don't save the TRX file to disk, HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mocha-trx-reporter.