Adding test hook to allow requiring of fonts

This commit is contained in:
Tom Gallacher 2017-01-13 18:10:09 +00:00
parent 4953ae36ea
commit 348b24a31d
5 changed files with 26 additions and 2 deletions

View File

@ -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('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
global.navigator = global.window.navigator;
}
}

View File

@ -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
}]
}
};

View File

@ -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"
},

7
ui/test/_hook.js Normal file
View File

@ -0,0 +1,7 @@
const hook = require('node-hook');
hook.hook('.eot', () => '');
hook.hook('.woff', () => '');
hook.hook('.woff2', () => '');
hook.hook('.ttf', () => '');
hook.hook('.svg', () => '');

View File

@ -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"