Skip to content

Commit

Permalink
Fixes liferay#1330 - Set up the fetch mock and move the jest configs …
Browse files Browse the repository at this point in the history
…to scripts folder
  • Loading branch information
matuzalemsteles committed Dec 4, 2018
1 parent cba5eaf commit cc2d52f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 14 deletions.
11 changes: 0 additions & 11 deletions jest-clay-lerna-resolver.js

This file was deleted.

14 changes: 11 additions & 3 deletions package.json
Expand Up @@ -30,19 +30,23 @@
"http-server": "^0.9.0",
"husky": "^0.14.2",
"jest": "^20.0.4",
"jest-fetch-mock": "^2.0.1",
"lerna": "^3.4.0",
"metal-jest-serializer": "^2.0.0",
"metal-soy-critic": "^2.4.0",
"pa11y-ci": "^2.1.1",
"prettier-eslint-cli": "^4.7.0"
},
"jest": {
"setupFiles": [
"./scripts/setupTests.js"
],
"collectCoverage": true,
"coverageReporters": [
"json",
"lcov"
],
"resolver": "./jest-clay-lerna-resolver",
"resolver": "./scripts/jest-clay-lerna-resolver",
"snapshotSerializers": [
"metal-jest-serializer"
],
Expand All @@ -56,8 +60,12 @@
]
},
"workspaces": {
"packages": ["packages/*"],
"nohoist": ["**/clay-charts-shared"]
"packages": [
"packages/*"
],
"nohoist": [
"**/clay-charts-shared"
]
},
"resolutions": {
"js-beautify": "1.7.5",
Expand Down
13 changes: 13 additions & 0 deletions scripts/jest-clay-lerna-resolver.js
@@ -0,0 +1,13 @@
'use strict';

const resolve = require('resolve');

module.exports = function(file, data) {
if (file.indexOf('clay-') === 0) {
data.packageFilter = function(pkg) {
return {main: pkg['jsnext:main']};
};
}

return resolve.sync(file, data);
};
3 changes: 3 additions & 0 deletions scripts/setupTests.js
@@ -0,0 +1,3 @@
'use strict';

global.fetch = require('jest-fetch-mock');
31 changes: 31 additions & 0 deletions yarn.lock
Expand Up @@ -3517,6 +3517,14 @@ cross-env@^5.1.3:
cross-spawn "^6.0.5"
is-windows "^1.0.0"

cross-fetch@^2.2.2:
version "2.2.3"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-2.2.3.tgz#e8a0b3c54598136e037f8650f8e823ccdfac198e"
integrity sha512-PrWWNH3yL2NYIb/7WF/5vFG3DCQiXDOVf8k3ijatbrtnwNuhMWLC7YF7uqf53tbTFDzHIUD8oITw4Bxt8ST3Nw==
dependencies:
node-fetch "2.1.2"
whatwg-fetch "2.0.4"

cross-spawn@^0.2.6:
version "0.2.9"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-0.2.9.tgz#bd67f96c07efb6303b7fe94c1e979f88478e0a39"
Expand Down Expand Up @@ -8015,6 +8023,14 @@ jest-environment-node@^20.0.3:
jest-mock "^20.0.3"
jest-util "^20.0.3"

jest-fetch-mock@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/jest-fetch-mock/-/jest-fetch-mock-2.0.1.tgz#aef284ee851f6c0f8b78c5367576edb6f64ca526"
integrity sha512-ulFW7tpQ7ihe89an+gWW8p7sMt5/smk7I0RJcZ2MXkgoM0jHVaBgqeE6XoLbXi1lWF42hK2zdnGzD8I6gSC35A==
dependencies:
cross-fetch "^2.2.2"
promise-polyfill "^7.1.1"

jest-haste-map@^20.0.4:
version "20.0.5"
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.0.5.tgz#abad74efb1a005974a7b6517e11010709cab9112"
Expand Down Expand Up @@ -10177,6 +10193,11 @@ node-fetch-npm@^2.0.2:
json-parse-better-errors "^1.0.0"
safe-buffer "^5.1.1"

node-fetch@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5"
integrity sha1-q4hOjn5X44qUR1POxwb3iNF2i7U=

node-fetch@^1.0.1, node-fetch@^1.7.0:
version "1.7.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef"
Expand Down Expand Up @@ -11386,6 +11407,11 @@ promise-inflight@^1.0.1:
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM=

promise-polyfill@^7.1.1:
version "7.1.2"
resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-7.1.2.tgz#ab05301d8c28536301622d69227632269a70ca3b"
integrity sha512-FuEc12/eKqqoRYIGBrUptCBRhobL19PS2U31vMNTfyck1FxPyMfgsXyW4Mav85y/ZN1hop3hOwRlUDok23oYfQ==

promise-retry@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-1.1.1.tgz#6739e968e3051da20ce6497fb2b50f6911df3d6d"
Expand Down Expand Up @@ -14453,6 +14479,11 @@ whatwg-encoding@^1.0.1:
dependencies:
iconv-lite "0.4.24"

whatwg-fetch@2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"
integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==

whatwg-fetch@>=0.10.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb"
Expand Down

0 comments on commit cc2d52f

Please sign in to comment.