From 8c975985485238eced6a2a5bb62a209d730b7a47 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Wed, 18 Oct 2017 18:39:36 +0900 Subject: [PATCH] Enable coverage for Jest (#5442) --- jest.config.js | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index dd9dadf876..50bde57e65 100644 --- a/jest.config.js +++ b/jest.config.js @@ -14,4 +14,12 @@ module.exports = { 'raf/polyfill', ], setupTestFrameworkScriptFile: '/app/javascript/mastodon/test_setup.js', + collectCoverageFrom: [ + 'app/javascript/mastodon/**/*.js', + '!app/javascript/mastodon/features/emoji/emoji_compressed.js', + '!app/javascript/mastodon/locales/locale-data/*.js', + '!app/javascript/mastodon/service_worker/entry.js', + '!app/javascript/mastodon/test_setup.js', + ], + coverageDirectory: '/coverage', }; diff --git a/package.json b/package.json index e398730c49..594e42475b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "start": "node ./streaming/index.js", "test": "npm run test:lint && npm run test:jest", "test:lint": "eslint -c .eslintrc.yml --ext=js app/javascript/ config/webpack/ spec/javascript/ streaming/", - "test:jest": "cross-env NODE_ENV=test jest", + "test:jest": "cross-env NODE_ENV=test jest --coverage", "postinstall": "npm rebuild node-sass" }, "repository": {