How to ignore nested node modules when running mocha?

by raphael_tillman , in category: Javascript , 2 months ago

How to ignore nested node modules when running mocha?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lottie , 2 months ago

@raphael_tillman 

To ignore nested node modules when running mocha, you can use the --ignore flag in your mocha command. This flag allows you to specify patterns of files or directories to ignore during the test run.


For example, if you want to ignore all nested node modules, you can use the following command:

1
mocha --ignore=node_modules/**/*


This command will tell mocha to ignore all files and directories within the node_modules directory recursively.


You can also specify specific nested node modules to ignore by adjusting the pattern in the --ignore flag. Just make sure to properly define the pattern to accurately target the nested node modules you want to ignore.