kibana/x-pack/dev-tools/jest/create_jest_config.js
tibmt fb6be4caed Translate Spaces component (#24411)
* Translate Spaces component

* fix one little error

* update Spaces component

* update translation of Spaces components

* Update snapshots

* update Space translation - intl type

* update Space translation - remove view/views id namespace

* rename ids

* use testing helper functions instead of shallow, render, mount from enzyme

* fix unit tests

* fix ts path for enzyme test helpers

* fix path to enzyme helpers test functions

* Update snapshots

* fix path to enzyme test helpers

* Remove unused dependency.
2018-11-15 11:09:12 +03:00

57 lines
1.7 KiB
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export function createJestConfig({
kibanaDirectory,
xPackKibanaDirectory,
}) {
return {
rootDir: xPackKibanaDirectory,
roots: [
"<rootDir>/plugins",
"<rootDir>/server",
],
moduleFileExtensions: [
"js",
"json",
"ts",
"tsx",
],
moduleNameMapper: {
"^ui/(.*)": `${kibanaDirectory}/src/ui/public/$1`,
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
`${kibanaDirectory}/src/dev/jest/mocks/file_mock.js`,
"\\.(css|less|scss)$": `${kibanaDirectory}/src/dev/jest/mocks/style_mock.js`,
"^test_utils/enzyme_helpers": `${xPackKibanaDirectory}/test_utils/enzyme_helpers.tsx`
},
setupFiles: [
`${kibanaDirectory}/src/dev/jest/setup/babel_polyfill.js`,
`<rootDir>/dev-tools/jest/setup/polyfills.js`,
`<rootDir>/dev-tools/jest/setup/enzyme.js`,
],
testMatch: [
"**/*.test.{js,ts,tsx}"
],
transform: {
"^.+\\.js$": `${kibanaDirectory}/src/dev/jest/babel_transform.js`,
"^.+\\.tsx?$": `${kibanaDirectory}/src/dev/jest/ts_transform.js`,
},
transformIgnorePatterns: [
"[/\\\\]node_modules[/\\\\].+\\.js$"
],
snapshotSerializers: [
`${kibanaDirectory}/node_modules/enzyme-to-json/serializer`
],
"reporters": [
"default",
[`${kibanaDirectory}/src/dev/jest/junit_reporter.js`, {
reportName: 'X-Pack Jest Tests',
rootDirectory: xPackKibanaDirectory,
}]
],
};
}