question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"TypeError: testcase.testcase[0]._attr.time.toFixed is not a function" error happens often in CI pipeline

See original GitHub issue

Current behavior

Getting below errors when running Cypress tests in CircleCI. This issues happens randomly, not able to reproduce on local environment.

TypeError: testcase.testcase[0]._attr.time.toFixed is not a function
    at /home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/node_modules/mocha-junit-reporter/index.js:411:73
    at Array.forEach (<anonymous>:null:null)
    at /home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/node_modules/mocha-junit-reporter/index.js:405:12
    at Array.forEach (<anonymous>:null:null)
    at MochaJUnitReporter.getXml (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/node_modules/mocha-junit-reporter/index.js:392:14)
    at MochaJUnitReporter.flush (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/node_modules/mocha-junit-reporter/index.js:370:20)
    at MochaJUnitReporter.<anonymous> (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/node_modules/mocha-junit-reporter/index.js:247:10)
    at Runner.emit (events.js:315:20)
    at Reporter.emit (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/lib/reporter.js:333:46)
    at ProjectBase.<anonymous> (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/lib/project-base.js:455:34)
    at Generator.next (<anonymous>:null:null)
    at /home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>:null:null)
    at Object.__awaiter (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/node_modules/tslib/tslib.js:113:16)
    at Object.onMocha (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/lib/project-base.js:448:51)
    at Socket.<anonymous> (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/server/lib/socket-base.js:213:40)
    at Socket.emit (events.js:315:20)
    at Socket.emitUntyped (/home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/circleci/.cache/Cypress/8.4.1/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:428:39
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Exited with code exit status 1
CircleCI received exit code 1

Desired behavior

Cypress test run should be either pass or fail.

Test code to reproduce

Test code are saved in private repo, not able to share with Cypress team.

Cypress Version

8.4.1

Other

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:32 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
marktnoonancommented, Oct 5, 2022

@troygibb this should be included in next week’s release. Thanks @halfninja for getting this into the reporter!

3reactions
tkharukcommented, Dec 7, 2021

Can not express how annoying this is, especially for repos with tests that take long to run just to fail like this.

Happens both on 8.3 and 9.1 versions

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix javascript .toFixed is not a Function error
But the problem is that var totalSum = (grandTotal + getShippingCost).toFixed(3); throws an error saying Uncaught TypeError: value.toFixed is ...
Read more >
TypeError: toFixed is not a function in JavaScript | bobbyhadz
The "toFixed is not a function" error occurs when the toFixed() method is called on a value that is not a number ....
Read more >
Retry-ability - Cypress Documentation
What you'll learn How Cypress retries commands and assertions When commands are retried and when they are not How to address some situations...
Read more >
[Removed-unnecessary-files]-[2986844]-[10].patch - Drupal
Once the -function is called for the first time the return value of the original -function is saved in `fn.value` and subsequent calls...
Read more >
Number.prototype.toFixed() - JavaScript - MDN Web Docs
The toFixed() method returns a string representation of numObj that does not use exponential notation and has exactly digits digits after the decimal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found