Skip to content

Commit

Permalink
add yaml support for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GnsP committed Aug 21, 2024
1 parent 40ddb54 commit 4b98f89
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
},
},
moduleDirectories: ['node_modules', 'jest', __dirname],
moduleFileExtensions: [ 'js', 'jsx', 'ts', 'tsx', 'yaml' ],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
Expand All @@ -52,6 +53,7 @@ module.exports = {
transform: {
'.+\\.(css|styl|less|sass|scss)$': 'jest-css-modules-transform',
'\\.[jt]sx?$': 'babel-jest',
'\\.yaml$': 'yaml-jest',
},
transformIgnorePatterns: ['<rootDir>/node_modules/?!(@material)/'],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"url-loader": "3.0.0",
"webpack": "4.41.2",
"webpack-cli": "3.3.10",
"webpack-livereload-plugin": "2.2.0"
"webpack-livereload-plugin": "2.2.0",
"yaml-jest": "^1.2.0"
},
"dependencies": {
"@ajainarayanan/react-pan-zoom": "0.0.4",
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23313,6 +23313,13 @@ yallist@^4.0.0:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==

yaml-jest@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/yaml-jest/-/yaml-jest-1.2.0.tgz#5e863a8c3ce5aa7b9f63e12f8bffd6e2e47b4bf7"
integrity sha512-rrUNn3ovs5J8td7i3k6rJfh3leBydnM+3YqKJcVyTFRiSiEAdKMy7uhqBxJfsJ+w1le5AGCkMTldNEMY8oqbPg==
dependencies:
js-yaml "^4.1.0"

yaml@^1.10.0:
version "1.10.2"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
Expand Down

0 comments on commit 4b98f89

Please sign in to comment.