Adding a jest transform to handle yaml files

This commit is contained in:
Jeff Avallone 2019-03-23 18:51:32 -04:00
parent b5cde63e4e
commit 2f7c67c953
3 changed files with 10 additions and 1 deletions

7
jest/yaml.js Normal file
View File

@ -0,0 +1,7 @@
const yaml = require('js-yaml');
module.exports = {
process(src) {
return `module.exports = ${ JSON.stringify(yaml.safeLoad(src)) };`;
}
};

View File

@ -66,6 +66,7 @@
".cache" ".cache"
], ],
"transform": { "transform": {
"\\.yaml$": "<rootDir>/jest/yaml.js",
"\\.js$": "<rootDir>/jest/preprocess.js", "\\.js$": "<rootDir>/jest/preprocess.js",
"\\.svg$": "<rootDir>/jest/static-file-transform.js" "\\.svg$": "<rootDir>/jest/static-file-transform.js"
}, },
@ -104,6 +105,7 @@
"i18next-xhr-backend": "^2.0.1", "i18next-xhr-backend": "^2.0.1",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^24.5.0", "jest": "^24.5.0",
"js-yaml": "^3.13.0",
"postcss-cssnext": "^3.1.0", "postcss-cssnext": "^3.1.0",
"postcss-import": "^12.0.1", "postcss-import": "^12.0.1",
"prop-types": "^15.6.2", "prop-types": "^15.6.2",

View File

@ -7572,7 +7572,7 @@ js-tokens@^3.0.2:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls=
js-yaml@^3.10.0, js-yaml@^3.12.0, js-yaml@^3.5.2, js-yaml@^3.9.0: js-yaml@^3.10.0, js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.5.2, js-yaml@^3.9.0:
version "3.13.0" version "3.13.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e"
integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==