mochawesome icon indicating copy to clipboard operation
mochawesome copied to clipboard

Getting an error while adding addContext in my test file

Open HamzaQA opened this issue 5 years ago • 1 comments

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?

HamzaQA avatar Feb 04 '20 10:02 HamzaQA

Hey @HamzaQA, I'm guessing you got this figured out, but the root cause is that there is no package in the DefinitelyTyped repository. I have just submitted a PR to add those types and will reply again here (or edit this comment) when it has been approved.

Once they are approved, you will be able to get the declaration file by installing @types/mochawesome as a dev dependency.

Christop406 avatar May 11 '21 22:05 Christop406