Skip to content

Commit

Permalink
[Backport 2.x] Revert jest tests config to use babel (opensearch-proj…
Browse files Browse the repository at this point in the history
…ect#1319) (opensearch-project#1320)

* update jest config to use babel instead of ts-jest

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit a262aaf)

* remove ts-jest package

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit 66d5621)

* update yarn.lock file

Signed-off-by: Shenoy Pratik <[email protected]>

* update snapshots

Signed-off-by: Shenoy Pratik <[email protected]>

---------

Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 authored and mengweieric committed Dec 22, 2023
1 parent f31765a commit 17b8a4d
Show file tree
Hide file tree
Showing 46 changed files with 370 additions and 458 deletions.
18 changes: 0 additions & 18 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
26 changes: 26 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

// babelrc doesn't respect NODE_PATH anymore but using require does.
// Alternative to install them locally in node_modules
module.exports = function (api) {
// ensure env is test so that this config won't impact build or dev server
if (api.env('test')) {
return {
presets: [
require('@babel/preset-env'),
require('@babel/preset-react'),
require('@babel/preset-typescript'),
],
plugins: [
[require('@babel/plugin-transform-runtime'), { regenerator: true }],
require('@babel/plugin-transform-class-properties'),
require('@babel/plugin-transform-object-rest-spread'),
[require('@babel/plugin-transform-modules-commonjs'), { allowTopLevelThis: true }],
],
};
}
return {};
};
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
"eslint": "^6.8.0",
"husky": "6.0.0",
"jest-dom": "^4.0.0",
"lint-staged": "^13.1.0",
"ts-jest": "^29.1.0"
"lint-staged": "^13.1.0"
},
"resolutions": {
"react-syntax-highlighter": "^15.4.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Log Config component renders empty log config 1`] = `
<Component
<LogConfig
appConfigs={Array []}
chrome={
Object {
Expand Down Expand Up @@ -444,7 +444,7 @@ exports[`Log Config component renders empty log config 1`] = `
onBlur={[Function]}
onFocus={[Function]}
>
<Component
<Autocomplete
baseQuery=""
dslService={
Object {
Expand Down Expand Up @@ -561,7 +561,7 @@ exports[`Log Config component renders empty log config 1`] = `
</EuiValidatableControl>
</EuiTextArea>
</div>
</Component>
</Autocomplete>
<EuiBadge
className="ppl-link ppl-link-light"
color="hollow"
Expand Down Expand Up @@ -616,11 +616,11 @@ exports[`Log Config component renders empty log config 1`] = `
</div>
</EuiAccordion>
</div>
</Component>
</LogConfig>
`;

exports[`Log Config component renders with query 1`] = `
<Component
<LogConfig
appConfigs={Array []}
chrome={
Object {
Expand Down Expand Up @@ -1068,7 +1068,7 @@ exports[`Log Config component renders with query 1`] = `
onBlur={[Function]}
onFocus={[Function]}
>
<Component
<Autocomplete
baseQuery=""
dslService={
Object {
Expand Down Expand Up @@ -1185,7 +1185,7 @@ exports[`Log Config component renders with query 1`] = `
</EuiValidatableControl>
</EuiTextArea>
</div>
</Component>
</Autocomplete>
<EuiBadge
className="ppl-link ppl-link-light"
color="hollow"
Expand Down Expand Up @@ -1240,5 +1240,5 @@ exports[`Log Config component renders with query 1`] = `
</div>
</EuiAccordion>
</div>
</Component>
</LogConfig>
`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Service Config component renders empty service config 1`] = `
<Component
<ServiceConfig
appConfigs={Array []}
chrome={
Object {
Expand Down Expand Up @@ -1171,11 +1171,11 @@ exports[`Service Config component renders empty service config 1`] = `
</div>
</EuiAccordion>
</div>
</Component>
</ServiceConfig>
`;

exports[`Service Config component renders with one service selected 1`] = `
<Component
<ServiceConfig
appConfigs={Array []}
chrome={
Object {
Expand Down Expand Up @@ -2373,5 +2373,5 @@ exports[`Service Config component renders with one service selected 1`] = `
</div>
</EuiAccordion>
</div>
</Component>
</ServiceConfig>
`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Trace Config component renders empty trace config 1`] = `
<Component
<TraceConfig
chrome={
Object {
"addApplicationClass": [MockFunction],
Expand Down Expand Up @@ -895,11 +895,11 @@ exports[`Trace Config component renders empty trace config 1`] = `
</div>
</EuiAccordion>
</div>
</Component>
</TraceConfig>
`;

exports[`Trace Config component renders with one trace selected 1`] = `
<Component
<TraceConfig
chrome={
Object {
"addApplicationClass": [MockFunction],
Expand Down Expand Up @@ -1817,5 +1817,5 @@ exports[`Trace Config component renders with one trace selected 1`] = `
</div>
</EuiAccordion>
</div>
</Component>
</TraceConfig>
`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Live tail button change live tail to 10s interval 1`] = `
<Component
<LiveTailButton
dataTestSubj=""
isLiveTailOn={true}
isLiveTailPopoverOpen={false}
Expand Down Expand Up @@ -91,11 +91,11 @@ exports[`Live tail button change live tail to 10s interval 1`] = `
</button>
</EuiButtonDisplay>
</EuiButton>
</Component>
</LiveTailButton>
`;

exports[`Live tail button starts live tail with 5s interval 1`] = `
<Component
<LiveTailButton
dataTestSubj=""
isLiveTailOn={true}
isLiveTailPopoverOpen={false}
Expand Down Expand Up @@ -180,11 +180,11 @@ exports[`Live tail button starts live tail with 5s interval 1`] = `
</button>
</EuiButtonDisplay>
</EuiButton>
</Component>
</LiveTailButton>
`;

exports[`Live tail off button stop live tail 1`] = `
<Component
<StopLiveButton
StopLive={[MockFunction]}
dataTestSubj=""
>
Expand Down Expand Up @@ -271,5 +271,5 @@ exports[`Live tail off button stop live tail 1`] = `
</button>
</EuiButtonDisplay>
</EuiButton>
</Component>
</StopLiveButton>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`Explorer Search component renders basic component 1`] = `
}
}
>
<Component>
<Search>
<div
className="globalQueryBar"
>
Expand Down Expand Up @@ -160,7 +160,7 @@ exports[`Explorer Search component renders basic component 1`] = `
}
}
>
<Component
<Autocomplete
baseQuery=""
handleQuerySearch={[Function]}
key="autocomplete-search-bar"
Expand Down Expand Up @@ -236,7 +236,7 @@ exports[`Explorer Search component renders basic component 1`] = `
</EuiValidatableControl>
</EuiTextArea>
</div>
</Component>
</Autocomplete>
<EuiBadge
className="ppl-link ppl-link-light"
color="hollow"
Expand Down Expand Up @@ -801,7 +801,7 @@ exports[`Explorer Search component renders basic component 1`] = `
<EuiPopover
anchorPosition="downCenter"
button={
<Unknown
<LiveTailButton
dataTestSubj="eventLiveTail"
/>
}
Expand All @@ -817,7 +817,7 @@ exports[`Explorer Search component renders basic component 1`] = `
<div
className="euiPopover__anchor"
>
<Component
<LiveTailButton
dataTestSubj="eventLiveTail"
>
<EuiButton
Expand Down Expand Up @@ -896,7 +896,7 @@ exports[`Explorer Search component renders basic component 1`] = `
</button>
</EuiButtonDisplay>
</EuiButton>
</Component>
</LiveTailButton>
</div>
</div>
</EuiPopover>
Expand All @@ -905,6 +905,6 @@ exports[`Explorer Search component renders basic component 1`] = `
</div>
</EuiFlexGroup>
</div>
</Component>
</Search>
</Provider>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`Panels Table Component renders empty panel table container 1`] = `
}
}
>
<Component
<CustomPanelTable
addSamplePanels={[MockFunction]}
cloneCustomPanel={[MockFunction]}
createCustomPanel={[MockFunction]}
Expand Down Expand Up @@ -591,7 +591,7 @@ exports[`Panels Table Component renders empty panel table container 1`] = `
</div>
</EuiPage>
</div>
</Component>
</CustomPanelTable>
</Provider>
`;

Expand All @@ -607,7 +607,7 @@ exports[`Panels Table Component renders panel table container 1`] = `
}
}
>
<Component
<CustomPanelTable
addSamplePanels={[MockFunction]}
cloneCustomPanel={[MockFunction]}
createCustomPanel={[MockFunction]}
Expand Down Expand Up @@ -1220,6 +1220,6 @@ exports[`Panels Table Component renders panel table container 1`] = `
</div>
</EuiPage>
</div>
</Component>
</CustomPanelTable>
</Provider>
`;
Loading

0 comments on commit 17b8a4d

Please sign in to comment.