Skip to content
Branch: master
Find file Copy path
34 lines (23 sloc) 1.64 KB

Code coverage

Translations: Español, Français, Italiano, 日本語, Português, Русский, 简体中文

Use the nyc command-line-client for Istanbul to compute the code coverage of your tests.

First install nyc:

$ npm install --save-dev nyc

At its simplest run AVA through nyc. In your package.json file:

	"scripts": {
		"test": "nyc ava"

You may want to exclude the .nyc_output and coverage directories from source control. Assuming you're using Git, add the following to your .gitignore file:


If you're compiling your source files using Babel you may want to apply Istanbul's instrumentation as part of the source file compilation. This will yield better results than instrumenting Babel's output. See Istanbul's Using Istanbul With ES2015+ tutorial. AVA sets NODE_ENV=test for you. Note that as of February 2018 this tutorial hasn't yet been updated for Babel 7.

You can’t perform that action at this time.