-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update jest transformer configuration in kbn-test
The whole point of this change is to make babel-jest transform options shared and reusable by other packages' jest.config transforms that need to add their own custom stuff. For example here ecs_data_quality_dashboard makes use of that to add @emotion/babel-preset-css-prop that is needed to properly compile emotion css prop in jest tests.
- Loading branch information
Showing
5 changed files
with
49 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
const babelJest = require('babel-jest'); | ||
const transformerConfig = require('./transformer_config'); | ||
|
||
module.exports = babelJest.default.createTransformer(transformerConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
x-pack/solutions/security/packages/ecs_data_quality_dashboard/jest/babel-transformer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
const babelJest = require('babel-jest'); | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
const rootTransformerConfig = require('@kbn/test/src/jest/transforms/babel/transformer_config'); | ||
|
||
module.exports = babelJest.default.createTransformer({ | ||
...rootTransformerConfig, | ||
presets: [ | ||
...rootTransformerConfig.presets, | ||
[ | ||
require.resolve('@emotion/babel-preset-css-prop'), | ||
{ | ||
labelFormat: '[filename]--[local]', | ||
}, | ||
], | ||
], | ||
}); |