adamgruber / mochawesome

A Gorgeous HTML/CSS Reporter for Mocha.js
https://gitter.im/mochawesome/general
MIT License
1.06k stars 160 forks source link

Getting an error while adding addContext in my test file #301

Open HamzaQA opened 4 years ago

HamzaQA commented 4 years ago

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?

Christop406 commented 3 years ago

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.