From 348b24a31d657891b0f632b7f0a4f9d9556b12ce Mon Sep 17 00:00:00 2001 From: Tom Gallacher Date: Fri, 13 Jan 2017 18:10:09 +0000 Subject: [PATCH] Adding test hook to allow requiring of fonts --- frontend/test/_hook.js | 7 ++++++- ui/docs/webpack/base.js | 6 ++++++ ui/package.json | 4 +++- ui/test/_hook.js | 7 +++++++ ui/yarn.lock | 4 ++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 ui/test/_hook.js diff --git a/frontend/test/_hook.js b/frontend/test/_hook.js index f7a26ca3..c17f5dd6 100644 --- a/frontend/test/_hook.js +++ b/frontend/test/_hook.js @@ -3,6 +3,11 @@ const jsdom = require('jsdom'); const register = require('babel-register'); hook.hook('.png', () => ''); +hook.hook('.eot', () => ''); +hook.hook('.woff', () => ''); +hook.hook('.woff2', () => ''); +hook.hook('.ttf', () => ''); +hook.hook('.svg', () => ''); register({ extensions: ['.js'] @@ -14,4 +19,4 @@ if (!global.document || !global.window) { global.document = jsdom.jsdom(''); global.window = global.document.defaultView; global.navigator = global.window.navigator; -} \ No newline at end of file +} diff --git a/ui/docs/webpack/base.js b/ui/docs/webpack/base.js index 6066551e..d0ff3ad6 100644 --- a/ui/docs/webpack/base.js +++ b/ui/docs/webpack/base.js @@ -63,6 +63,12 @@ module.exports = { exclude: [/node_modules/g], include: INCLUDE, loader: 'raw-loader!embed-markdown-loader' + }, + { + test: /\.(eot|svg|ttf|woff|woff2)$/, + exclude: /node_modules/, + loader: 'file-loader', + include: INCLUDE }] } }; diff --git a/ui/package.json b/ui/package.json index 21e887ab..1271d4a2 100644 --- a/ui/package.json +++ b/ui/package.json @@ -55,6 +55,7 @@ "eslint-plugin-standard": "^2.0.1", "jsdom": "^9.9.1", "memory-fs": "^0.4.1", + "node-hook": "^0.4.0", "nyc": "^10.0.0", "pre-commit": "^1.2.2", "react-addons-test-utils": "^15.4.1", @@ -68,7 +69,8 @@ "failFast": true, "cache": false, "require": [ - "babel-register" + "babel-register", + "./test/_hook.js" ], "babel": "inherit" }, diff --git a/ui/test/_hook.js b/ui/test/_hook.js new file mode 100644 index 00000000..bc2f79e2 --- /dev/null +++ b/ui/test/_hook.js @@ -0,0 +1,7 @@ +const hook = require('node-hook'); + +hook.hook('.eot', () => ''); +hook.hook('.woff', () => ''); +hook.hook('.woff2', () => ''); +hook.hook('.ttf', () => ''); +hook.hook('.svg', () => ''); diff --git a/ui/yarn.lock b/ui/yarn.lock index 20664b39..3729f89d 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -4407,6 +4407,10 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" +node-hook@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-hook/-/node-hook-0.4.0.tgz#782a3b3b4873388f93d087cd2971162f24eb6f2d" + node-libs-browser@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-0.7.0.tgz#3e272c0819e308935e26674408d7af0e1491b83b"