Browse Source

Enable coverage for Jest (#5442)

Yamagishi Kazutoshi 1 year ago
parent
commit
402da46ff6
2 changed files with 9 additions and 1 deletions
  1. 8
    0
      jest.config.js
  2. 1
    1
      package.json

+ 8
- 0
jest.config.js View File

@@ -14,4 +14,12 @@ module.exports = {
14 14
     'raf/polyfill',
15 15
   ],
16 16
   setupTestFrameworkScriptFile: '<rootDir>/app/javascript/mastodon/test_setup.js',
17
+  collectCoverageFrom: [
18
+    'app/javascript/mastodon/**/*.js',
19
+    '!app/javascript/mastodon/features/emoji/emoji_compressed.js',
20
+    '!app/javascript/mastodon/locales/locale-data/*.js',
21
+    '!app/javascript/mastodon/service_worker/entry.js',
22
+    '!app/javascript/mastodon/test_setup.js',
23
+  ],
24
+  coverageDirectory: '<rootDir>/coverage',
17 25
 };

+ 1
- 1
package.json View File

@@ -9,7 +9,7 @@
9 9
     "start": "node ./streaming/index.js",
10 10
     "test": "npm run test:lint && npm run test:jest",
11 11
     "test:lint": "eslint -c .eslintrc.yml --ext=js app/javascript/ config/webpack/ spec/javascript/ streaming/",
12
-    "test:jest": "cross-env NODE_ENV=test jest",
12
+    "test:jest": "cross-env NODE_ENV=test jest --coverage",
13 13
     "postinstall": "npm rebuild node-sass"
14 14
   },
15 15
   "repository": {