From 6f64b447e8554d1902c607f1f574306ce7d82e15 Mon Sep 17 00:00:00 2001 From: Christopher Johnson Date: Thu, 13 Dec 2018 10:32:12 +0100 Subject: [PATCH] adds test coverage to jest config closes #72 removes jest config from package.json and adds jest config file adds ignores for coverage dir --- minimal_redux_poc/.eslintignore | 1 + minimal_redux_poc/.gitignore | 2 +- minimal_redux_poc/jest.json | 15 +++++++++ minimal_redux_poc/package-lock.json | 49 ++++++++++++++++++++++------- minimal_redux_poc/package.json | 14 ++------- 5 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 minimal_redux_poc/jest.json diff --git a/minimal_redux_poc/.eslintignore b/minimal_redux_poc/.eslintignore index 446810d..0cdbd50 100644 --- a/minimal_redux_poc/.eslintignore +++ b/minimal_redux_poc/.eslintignore @@ -1,2 +1,3 @@ dist/ config/ +coverage/ diff --git a/minimal_redux_poc/.gitignore b/minimal_redux_poc/.gitignore index 924c1ed..a7e5fab 100644 --- a/minimal_redux_poc/.gitignore +++ b/minimal_redux_poc/.gitignore @@ -1,3 +1,3 @@ dist/ +coverage/ -.idea diff --git a/minimal_redux_poc/jest.json b/minimal_redux_poc/jest.json new file mode 100644 index 0000000..4330545 --- /dev/null +++ b/minimal_redux_poc/jest.json @@ -0,0 +1,15 @@ +{ + "collectCoverageFrom": [ + "src/**/*.{js,jsx}" + ], + "coverageDirectory": "/coverage", + "coverageReporters": ["html"], + "setupFiles": [ + "/setupJest.js" + ], + "testMatch": [ + "/**/__tests__/**/*.{js,jsx}", + "/src/**/?(*.)(spec|test|unit).{js,jsx}" + ], + "preset": "jest-puppeteer" +} diff --git a/minimal_redux_poc/package-lock.json b/minimal_redux_poc/package-lock.json index 950b05f..fa9e05c 100644 --- a/minimal_redux_poc/package-lock.json +++ b/minimal_redux_poc/package-lock.json @@ -5834,7 +5834,8 @@ "version": "2.1.1", "resolved": false, "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -5858,13 +5859,15 @@ "version": "1.0.0", "resolved": false, "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "resolved": false, "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5881,19 +5884,22 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "resolved": false, "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "resolved": false, "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6024,7 +6030,8 @@ "version": "2.0.3", "resolved": false, "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6038,6 +6045,7 @@ "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6054,6 +6062,7 @@ "resolved": false, "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6062,13 +6071,15 @@ "version": "0.0.8", "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "resolved": false, "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6089,6 +6100,7 @@ "resolved": false, "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6177,7 +6189,8 @@ "version": "1.0.1", "resolved": false, "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -6191,6 +6204,7 @@ "resolved": false, "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -6286,7 +6300,8 @@ "version": "5.1.1", "resolved": false, "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -6328,6 +6343,7 @@ "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6349,6 +6365,7 @@ "resolved": false, "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6397,13 +6414,15 @@ "version": "1.0.2", "resolved": false, "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "resolved": false, "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", - "dev": true + "dev": true, + "optional": true } } }, @@ -7657,6 +7676,12 @@ } } }, + "jest-canvas-mock": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jest-canvas-mock/-/jest-canvas-mock-1.1.0.tgz", + "integrity": "sha512-D2VoKl+L6r9VpqTPygXKvIOQ1aou7gz3PvstlWDZqPT7EVYcSz0Nj+yjJ9G+Y9EqJd2X95f3dzcmmXb2dvQ1DQ==", + "dev": true + }, "jest-changed-files": { "version": "22.4.3", "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-22.4.3.tgz", @@ -9543,7 +9568,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, diff --git a/minimal_redux_poc/package.json b/minimal_redux_poc/package.json index 8300e06..17b98a3 100644 --- a/minimal_redux_poc/package.json +++ b/minimal_redux_poc/package.json @@ -6,8 +6,9 @@ "scripts": { "lint": "node_modules/.bin/eslint ./", "server": "node_modules/.bin/http-server", - "test": "npm run build && npm run lint && node_modules/.bin/jest", - "test:watch": "npm test -- --watch", + "test": "npm run build && npm run lint && jest -c jest.json", + "test:coverage": "jest -c jest.json --coverage", + "test:watch": "jest -c jest.json --watch", "build": "webpack --mode=production", "build:dev": "webpack --mode=development", "build:watch": "webpack --watch --mode=development", @@ -67,14 +68,5 @@ "style-loader": "^0.22.1", "webpack": "^4.27.1", "webpack-cli": "^3.1.2" - }, - "jest": { - "preset": "jest-puppeteer", - "setupFiles": [ - "./setupJest.js" - ], - "testPathIgnorePatterns": [ - "__tests__/integration/react-example/.*jsx?" - ] } }