Skip to content

Commit d774447

Browse files
committed
Resolves #1985
The previous commit changed the config from CJS to ESM which caused 2 tests to fail. This commit fixes the above issue by replacing 'require' with 'import' throughout the project Signed-off-by: shivam <[email protected]>
1 parent 5559770 commit d774447

9 files changed

+18
-19
lines changed

packages/jaeger-ui/test/babel-transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
const babelJest = require('babel-jest').default;
15+
import babelJest from 'babel-jest';
1616

1717
const babelConfiguration = {
1818
presets: [

packages/jaeger-ui/test/generic-file-transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
const path = require('path');
15+
import path from 'path';
1616

1717
// Simple Jest transform that stubs out CSS files and returns the file name as the mock content for other file types.
1818
module.exports = {

packages/jaeger-ui/test/jest-per-test-setup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ rafPolyfill();
2222
global.TextEncoder = TextEncoder;
2323

2424
/* eslint-disable import/no-extraneous-dependencies */
25-
const Enzyme = require('enzyme');
26-
const EnzymeAdapter = require('@wojtekmaj/enzyme-adapter-react-17');
27-
const createSerializer = require('enzyme-to-json').createSerializer;
25+
import Enzyme from 'enzyme';
26+
import EnzymeAdapter from '@wojtekmaj/enzyme-adapter-react-17';
27+
import { createSerializer } from 'enzyme-to-json';
2828

2929
Enzyme.configure({ adapter: new EnzymeAdapter() });
3030
expect.addSnapshotSerializer(createSerializer({ mode: 'deep' }));

packages/plexus/webpack-factory.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414

1515
/* eslint-disable import/no-extraneous-dependencies */
1616
/* eslint-disable @typescript-eslint/no-var-requires */
17-
18-
const { join } = require('path');
19-
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
20-
const HtmlWebpackPlugin = require('html-webpack-plugin');
21-
const nodeExternals = require('webpack-node-externals');
17+
import { join } from 'path';
18+
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
19+
import HtmlWebpackPlugin from 'html-webpack-plugin';
20+
import nodeExternals from 'webpack-node-externals';
2221

2322
const babelConfigPath = require.resolve('./babel.config');
2423

packages/plexus/webpack.dev.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
// limitations under the License.
1414

1515
// eslint-disable-next-line @typescript-eslint/no-var-requires
16-
const factory = require('./webpack-factory');
16+
import factory from './webpack-factory';
1717

1818
module.exports = factory('development');

packages/plexus/webpack.layout-worker.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
// limitations under the License.
1414

1515
// eslint-disable-next-line @typescript-eslint/no-var-requires
16-
const factory = require('./webpack-factory');
16+
import factory from './webpack-factory';
1717

1818
module.exports = factory('layout-worker');

packages/plexus/webpack.umd.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
// limitations under the License.
1414

1515
// eslint-disable-next-line @typescript-eslint/no-var-requires
16-
const factory = require('./webpack-factory');
16+
import factory from './webpack-factory';
1717

1818
module.exports = factory('umd');

scripts/generateDepcheckrcJaegerUI.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
/* eslint-disable import/no-extraneous-dependencies */
1616
/* eslint-disable @typescript-eslint/no-var-requires */
17-
const fs = require('fs');
18-
const path = require('path');
19-
const { babelConfiguration } = require('../packages/jaeger-ui/test/babel-transform');
17+
import fs from 'fs';
18+
import path from 'path';
19+
import { babelConfiguration } from '../packages/jaeger-ui/test/babel-transform';
2020

2121
const packageNames = [
2222
...babelConfiguration.presets.flatMap(preset => {

scripts/generateDepcheckrcPlexus.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
/* eslint-disable import/no-extraneous-dependencies */
1616
/* eslint-disable @typescript-eslint/no-var-requires */
17-
const fs = require('fs');
18-
const path = require('path');
19-
const getBabelConfig = require('../packages/plexus/babel.config');
17+
import fs from 'fs';
18+
import path from 'path';
19+
import getBabelConfig from '../packages/plexus/babel.config';
2020

2121
const babelConfiguration = getBabelConfig({
2222
env: () => {

0 commit comments

Comments
 (0)