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.

addContext is not working

See original GitHub issue

Describe the bug So in any way I’m using addContext there is no any result

Screenshots screen shot 2019-01-11 at 1 27 52 pm

Environment (please complete the following information):

  • localhost / CI
  • “mocha”: “5.2.0”, “mochawesome”: “3.1.1”, “cypress”: “3.1.1”, “cypress-image-snapshot”: “2.1.0”, “node”: “8.11.4”

Additional context Running cypress run:

cypress.json

{
  "reporter": "mochawesome",
  "reporterOptions": {
    "reportDir": "mochawesome-reports",
    "overwrite": true
  },
  "viewportWidth": 1050,
  "viewportHeight": 938,
  "defaultCommandTimeout": 7000,
  "requestTimeout": 7000,
  "waitForAnimations": true
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
HamzaQAcommented, Feb 4, 2020

Hi there,

I am adding addContext in my testfile but getting following error:

Could not find a declaration file for module ‘mochawesome/addContext’. ‘d:/Cypress/CypressProject/node_modules/mochawesome/addContext.js’ implicitly has an ‘any’ type. Try npm install @types/mochawesome if it exists or add a new declaration (.d.ts) file containing `declare module ‘mochawesome/addContext’;

I wrote this line of code where I am getting above error const addContext = require(‘mochawesome/addContext’)

Somebody can help please?

0reactions
Serg-developcommented, Mar 19, 2021

Hi guys. I have no possibility to add some context through parallel mode. So, i have the function like:

_`afterEach: async function() { if (this.currentTest.state === “failed”) { FAILED_TESTS[this.currentTest.file] = true;

  const title = new Buffer.from(this.currentTest.title).toString("base64");

  try {
    await makeScreenshot(title);
  } catch (e) {
    console.error(e);
  }

  addContext(this, `./${title}.png`);
}

}`_

It works in single mode, but in parallel - no. Report generates without any context. Maybe someone knows any solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

addContext is not working · Issue #43 · fijijavis/wdio ... - GitHub
Looks like while addContext() works and it populates the test context, the reporter has its own context that is not related and not...
Read more >
Issue with [mochawesome] addContext within Mocha ...
It looks like you need to add done as a parameter inside your it blocks and then call done(); just before the closing...
Read more >
mochawesome/general - Gitter
Hi All. I am using mochawesome to generate reports for my supertest API tests. I have observed that whenever tests fail on the...
Read more >
JsonSerializerOptions.AddContext<TContext> Method
The generic definition of the specified context type. Remarks. When serializing and deserializing types using the options instance, metadata for the types will ......
Read more >
Add Context for JavaScript | Sentry Documentation
Sentry does not recommend sending the entire application state and large data blobs in contexts. If you exceed the maximum payload size, Sentry...
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