diff --git a/package.json b/package.json index 97b697d4bedf4..66760cb0ff2d9 100644 --- a/package.json +++ b/package.json @@ -1563,7 +1563,6 @@ "@types/eslint": "^8.44.2", "@types/express": "^4.17.21", "@types/extract-zip": "^1.6.2", - "@types/faker": "^5.1.5", "@types/fetch-mock": "^7.3.1", "@types/file-saver": "^2.0.0", "@types/flot": "^0.0.31", @@ -1731,7 +1730,6 @@ "expect": "^29.7.0", "expose-loader": "^0.7.5", "express": "^4.21.1", - "faker": "^5.1.0", "fetch-mock": "^7.3.9", "file-loader": "^4.2.0", "find-cypress-specs": "^1.41.4", diff --git a/packages/kbn-calculate-width-from-char-count/src/calculate_width_from_entries.test.ts b/packages/kbn-calculate-width-from-char-count/src/calculate_width_from_entries.test.ts index 9924ea7b84a14..89abd5d8ce667 100644 --- a/packages/kbn-calculate-width-from-char-count/src/calculate_width_from_entries.test.ts +++ b/packages/kbn-calculate-width-from-char-count/src/calculate_width_from_entries.test.ts @@ -9,24 +9,22 @@ import { calculateWidthFromEntries } from './calculate_width_from_entries'; import { MAX_WIDTH } from './calculate_width_from_char_count'; -import faker from 'faker'; - -const generateLabel = (length: number) => faker.random.alpha({ count: length }); +import { faker } from '@faker-js/faker'; const generateObjectWithLabelOfLength = (length: number, propOverrides?: Record) => ({ - label: generateLabel(length), + label: faker.string.alpha(length), ...propOverrides, }); describe('calculateWidthFromEntries', () => { it('calculates width for array of strings', () => { - const shortLabels = [10, 20].map(generateLabel); + const shortLabels = [10, 20].map(faker.string.alpha); expect(calculateWidthFromEntries(shortLabels)).toBe(256); - const mediumLabels = [50, 55, 10, 20].map(generateLabel); + const mediumLabels = [50, 55, 10, 20].map(faker.string.alpha); expect(calculateWidthFromEntries(mediumLabels)).toBe(501); - const longLabels = [80, 90, 10].map(generateLabel); + const longLabels = [80, 90, 10].map(faker.string.alpha); expect(calculateWidthFromEntries(longLabels)).toBe(MAX_WIDTH); }); @@ -42,12 +40,12 @@ describe('calculateWidthFromEntries', () => { }); it('calculates width for array of objects for fallback keys', () => { const shortLabels = [10, 20].map((v) => - generateObjectWithLabelOfLength(v, { label: undefined, name: generateLabel(v) }) + generateObjectWithLabelOfLength(v, { label: undefined, name: faker.string.alpha(v) }) ); expect(calculateWidthFromEntries(shortLabels, ['id', 'label', 'name'])).toBe(256); const mediumLabels = [50, 55, 10, 20].map((v) => - generateObjectWithLabelOfLength(v, { label: undefined, name: generateLabel(v) }) + generateObjectWithLabelOfLength(v, { label: undefined, name: faker.string.alpha(v) }) ); expect(calculateWidthFromEntries(mediumLabels, ['id', 'label', 'name'])).toBe(501); }); diff --git a/packages/kbn-dom-drag-drop/src/test_utils.tsx b/packages/kbn-dom-drag-drop/src/test_utils.tsx index 033697353a43f..84996956e26c3 100644 --- a/packages/kbn-dom-drag-drop/src/test_utils.tsx +++ b/packages/kbn-dom-drag-drop/src/test_utils.tsx @@ -8,7 +8,7 @@ */ import React, { ReactElement } from 'react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { RenderOptions, render } from '@testing-library/react'; import { DragContextState, RootDragDropProvider } from './providers'; @@ -22,7 +22,7 @@ export const dataTransfer = { }; export const generateDragDropValue = (label = faker.lorem.word()) => ({ - id: faker.random.uuid(), + id: faker.string.uuid(), humanData: { label, groupLabel: faker.lorem.word(), diff --git a/packages/kbn-visualization-ui-components/components/field_picker/field_picker.test.tsx b/packages/kbn-visualization-ui-components/components/field_picker/field_picker.test.tsx index 6cdcfaaa8d0ad..a19de192662c2 100644 --- a/packages/kbn-visualization-ui-components/components/field_picker/field_picker.test.tsx +++ b/packages/kbn-visualization-ui-components/components/field_picker/field_picker.test.tsx @@ -10,15 +10,15 @@ import React from 'react'; import { FieldPicker, FieldPickerProps } from './field_picker'; import { render, screen } from '@testing-library/react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import userEvent from '@testing-library/user-event'; import { DataType, FieldOptionValue } from './types'; const generateFieldWithLabelOfLength = (length: number) => ({ - label: faker.random.alpha({ count: length }), + label: faker.string.alpha(length), value: { type: 'field' as const, - field: faker.random.alpha({ count: length }), + field: faker.string.alpha(length), dataType: 'date' as DataType, operationType: 'count', }, diff --git a/renovate.json b/renovate.json index 08c842400d671..a84df6af01226 100644 --- a/renovate.json +++ b/renovate.json @@ -137,12 +137,10 @@ "groupName": "@elastic/appex-qa dependencies", "matchDepNames": [ "cheerio", - "@types/faker", "@types/pixelmatch", "@types/pngjs", "@types/supertest", "babel-plugin-istanbul", - "faker", "nyc", "oboe", "pixelmatch", @@ -1303,10 +1301,21 @@ }, { "groupName": "@elastic/request-converter", - "matchDepNames": ["@elastic/request-converter"], - "reviewers": ["team:kibana-management"], - "matchBaseBranches": ["main"], - "labels": ["release_note:skip", "backport:skip", "Team:Kibana Management", "Feature:Console"], + "matchDepNames": [ + "@elastic/request-converter" + ], + "reviewers": [ + "team:kibana-management" + ], + "matchBaseBranches": [ + "main" + ], + "labels": [ + "release_note:skip", + "backport:skip", + "Team:Kibana Management", + "Feature:Console" + ], "enabled": true } ], diff --git a/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx b/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx index fd0892ea12735..e81801229b167 100644 --- a/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx +++ b/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx @@ -27,7 +27,7 @@ import { CustomPaletteState } from '@kbn/charts-plugin/common/expressions/palett import { DimensionsVisParam, MetricVisParam } from '../../common'; import { euiThemeVars } from '@kbn/ui-theme'; import { DEFAULT_TRENDLINE_NAME } from '../../common/constants'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const mockDeserialize = jest.fn(({ id }: { id: string }) => { const convertFn = (v: unknown) => `${id}-${v}`; @@ -825,47 +825,47 @@ describe('MetricVisComponent', function () { // Raw values here, not formatted const trends: Record = { Friday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], Wednesday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], Saturday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], Sunday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], Thursday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], __other__: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], // this one shouldn't show up! [DEFAULT_TRENDLINE_NAME]: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], }; diff --git a/src/plugins/chart_expressions/expression_partition_vis/public/utils/filter_helpers.test.ts b/src/plugins/chart_expressions/expression_partition_vis/public/utils/filter_helpers.test.ts index babde416ea0a5..d9a6bb9d95631 100644 --- a/src/plugins/chart_expressions/expression_partition_vis/public/utils/filter_helpers.test.ts +++ b/src/plugins/chart_expressions/expression_partition_vis/public/utils/filter_helpers.test.ts @@ -18,7 +18,7 @@ import { import { createMockBucketColumns, createMockVisData, createMockPieParams } from '../mocks'; import { consolidateMetricColumns } from '../../common/utils'; import { LayerValue } from '@elastic/charts'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const bucketColumns = createMockBucketColumns(); const visData = createMockVisData(); @@ -186,26 +186,26 @@ describe('getFilterClickData', () => { const clickedLayers: LayerValue[] = [ { groupByRollup: 'circle', - value: faker.random.number(), - depth: faker.random.number(), + value: faker.number.int(), + depth: faker.number.int(), path: [], - sortIndex: faker.random.number(), + sortIndex: faker.number.int(), smAccessorValue: '', }, { groupByRollup: 'green', - value: faker.random.number(), - depth: faker.random.number(), + value: faker.number.int(), + depth: faker.number.int(), path: [], - sortIndex: faker.random.number(), + sortIndex: faker.number.int(), smAccessorValue: '', }, { groupByRollup: 'metric2', - value: faker.random.number(), - depth: faker.random.number(), + value: faker.number.int(), + depth: faker.number.int(), path: [], - sortIndex: faker.random.number(), + sortIndex: faker.number.int(), smAccessorValue: '', }, ]; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx index a140ca22db2b5..b8d3af522c455 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx @@ -12,7 +12,7 @@ import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { createMockedIndexPattern } from '../../mocks'; @@ -402,7 +402,7 @@ describe('percentile', () => { it('should update order-by references for any terms columns', () => { const field1 = 'foo'; const field2 = 'bar'; - const percentile = faker.random.number(100); + const percentile = faker.number.int(100); const aggs = [ makeEsAggBuilder('aggTerms', { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/chart_switch/chart_switch.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/chart_switch/chart_switch.test.tsx index 6795cd8caaa83..5686d94f52d49 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/chart_switch/chart_switch.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/chart_switch/chart_switch.test.tsx @@ -21,7 +21,7 @@ import { DatasourcePublicAPI, SuggestionRequest, DatasourceSuggestion } from '.. import { ChartSwitchProps } from './chart_switch'; import { ChartSwitchPopover } from './chart_switch_popover'; import { LensAppState, applyChanges } from '../../../../state_management'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const mockFrame = (layers: string[]) => ({ ...createMockFramePublicAPI(), diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_header.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_header.test.tsx index 6f0edd6cbcd16..bcd21c71312ce 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_header.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_header.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { screen } from '@testing-library/react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { createMockDatasource, createMockFramePublicAPI, diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx index 9c3457dacc6d4..9cfb1597ffdd4 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx @@ -12,7 +12,7 @@ import { ChildDragDropProvider, Droppable, Draggable } from '@kbn/dom-drag-drop' import { FramePublicAPI, Visualization, VisualizationConfigProps } from '../../../types'; import { LayerPanel } from './layer_panel'; import { coreMock } from '@kbn/core/public/mocks'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { generateId } from '../../../id_generator'; import { createMockVisualization, @@ -144,7 +144,7 @@ describe('LayerPanel', () => { }; beforeEach(() => { - mockVisualization = createMockVisualization(faker.random.alphaNumeric()); + mockVisualization = createMockVisualization(faker.string.alphanumeric()); mockVisualization.getLayerIds.mockReturnValue(['first']); mockDatasource = createMockDatasource(); }); diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx index 42abcdf8fe56c..e44e528e5a33c 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx @@ -39,7 +39,7 @@ import { getLensInspectorService } from '../../../lens_inspector_service'; import { inspectorPluginMock } from '@kbn/inspector-plugin/public/mocks'; import { disableAutoApply, enableAutoApply } from '../../../state_management/lens_slice'; import { Ast, toExpression } from '@kbn/interpreter'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const defaultPermissions: Record>> = { navLinks: { management: true }, diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx index 8694cc7c27dcf..c5cabaa053c4b 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx @@ -18,7 +18,7 @@ import { updateVisualizationState, LensAppState } from '../../../state_managemen import { setChangesApplied } from '../../../state_management/lens_slice'; import { LensInspector } from '../../../lens_inspector_service'; import { screen } from '@testing-library/react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { SettingsMenu } from '../../../app_plugin/settings_menu'; describe('workspace_panel_wrapper', () => { @@ -98,7 +98,7 @@ describe('workspace_panel_wrapper', () => { }); it('should render its children', async () => { - const customElementText = faker.random.word(); + const customElementText = faker.word.words(); renderWorkspacePanelWrapper({ children: {customElementText} }); expect(screen.getByText(customElementText)).toBeInTheDocument(); }); diff --git a/x-pack/plugins/lens/public/lens_ui_telemetry/color_telemetry_helpers.test.ts b/x-pack/plugins/lens/public/lens_ui_telemetry/color_telemetry_helpers.test.ts index 47eba8b0252ef..8719c54f6f1dd 100644 --- a/x-pack/plugins/lens/public/lens_ui_telemetry/color_telemetry_helpers.test.ts +++ b/x-pack/plugins/lens/public/lens_ui_telemetry/color_telemetry_helpers.test.ts @@ -13,7 +13,7 @@ import { DEFAULT_COLOR_MAPPING_CONFIG, DEFAULT_OTHER_ASSIGNMENT_INDEX, } from '@kbn/coloring'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const exampleAssignment = ( valuesCount = 1, @@ -35,7 +35,7 @@ const exampleAssignment = ( return { rule: { type: 'matchExactly', - values: Array.from({ length: valuesCount }, () => faker.random.alpha()), + values: Array.from({ length: valuesCount }, () => faker.string.alpha()), }, color, touched: false, diff --git a/x-pack/plugins/lens/public/mocks/visualization_mock.tsx b/x-pack/plugins/lens/public/mocks/visualization_mock.tsx index f0513e66de0c5..9810b916d5ea6 100644 --- a/x-pack/plugins/lens/public/mocks/visualization_mock.tsx +++ b/x-pack/plugins/lens/public/mocks/visualization_mock.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { LayerTypes } from '@kbn/expression-xy-plugin/public'; import { toExpression } from '@kbn/interpreter'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { Visualization, VisualizationMap } from '../types'; export function createMockVisualization( diff --git a/x-pack/plugins/lens/public/state_management/load_initial.test.tsx b/x-pack/plugins/lens/public/state_management/load_initial.test.tsx index a70b713787ce0..e40b0fbb368e9 100644 --- a/x-pack/plugins/lens/public/state_management/load_initial.test.tsx +++ b/x-pack/plugins/lens/public/state_management/load_initial.test.tsx @@ -18,7 +18,7 @@ import { act } from 'react-dom/test-utils'; import { LensEmbeddableInput } from '../embeddable'; import { loadInitial } from './lens_slice'; import { Filter } from '@kbn/es-query'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const history = { location: { diff --git a/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx index 14b3796fbd145..992e79681d415 100644 --- a/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { fireEvent, render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { I18nProvider } from '@kbn/i18n-react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { act } from 'react-dom/test-utils'; import { IFieldFormat } from '@kbn/field-formats-plugin/common'; import { coreMock } from '@kbn/core/public/mocks'; @@ -504,7 +504,7 @@ describe('DatatableComponent', () => { data.rows = new Array(rowNumbers).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); args.pageSize = pageSize; @@ -537,7 +537,7 @@ describe('DatatableComponent', () => { data.rows = new Array(rowNumbers).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); args.pageSize = pageSize; @@ -558,7 +558,7 @@ describe('DatatableComponent', () => { data.rows = new Array(20).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); renderDatatableComponent({ args, @@ -584,7 +584,7 @@ describe('DatatableComponent', () => { data.rows = new Array(rowNumbers).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); args.pageSize = pageSize; @@ -624,7 +624,7 @@ describe('DatatableComponent', () => { data.rows = new Array(rowNumbers).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); args.pageSize = pageSize; diff --git a/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx b/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx index 73f07d66bcb8b..7a143d3c9ba8a 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import userEvent from '@testing-library/user-event'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { euiLightVars } from '@kbn/ui-theme'; @@ -77,7 +77,7 @@ describe('dimension editor', () => { id: 'first', rows: Array(3).fill({ 'metric-col-id': faker.lorem.word(3), - 'max-col-id': faker.random.number(), + 'max-col-id': faker.number.int(), }), }, ]), @@ -106,8 +106,8 @@ describe('dimension editor', () => { { id: 'first', rows: Array(3).fill({ - 'metric-col-id': faker.random.number(), - 'secondary-metric-col-id': faker.random.number(), + 'metric-col-id': faker.number.int(), + 'secondary-metric-col-id': faker.number.int(), }), }, ]), diff --git a/x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts b/x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts index 0b04c90ee633d..7042a6538dceb 100644 --- a/x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts +++ b/x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts @@ -5,7 +5,7 @@ * 2.0. */ -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { LogEntry, LogViewColumnConfiguration } from '@kbn/logs-shared-plugin/common'; export function generateFakeEntries( @@ -51,15 +51,15 @@ export function generateFakeEntries( function fakeColumnValue(field: string): string { switch (field) { case 'message': - return faker.fake( - '{{internet.ip}} - [{{date.past}}] "GET {{internet.url}} HTTP/1.1" 200 {{random.number}} "-" "{{internet.userAgent}}"' + return faker.helpers.fake( + '{{internet.ip}} - [{{date.past}}] "GET {{internet.url}} HTTP/1.1" 200 {{number.int}} "-" "{{internet.userAgent}}"' ); case 'event.dataset': - return faker.fake('{{hacker.noun}}.{{hacker.noun}}'); + return faker.helpers.fake('{{hacker.noun}}.{{hacker.noun}}'); case 'log.file.path': return faker.system.filePath(); case 'log.level': - return faker.random.arrayElement(['debug', 'info', 'warn', 'error']); + return faker.helpers.arrayElement(['debug', 'info', 'warn', 'error']); case 'host.name': return faker.hacker.noun(); default: diff --git a/x-pack/plugins/observability_solution/logs_shared/public/test_utils/entries.ts b/x-pack/plugins/observability_solution/logs_shared/public/test_utils/entries.ts index 5277f49b1175e..dc6a1526bba0c 100644 --- a/x-pack/plugins/observability_solution/logs_shared/public/test_utils/entries.ts +++ b/x-pack/plugins/observability_solution/logs_shared/public/test_utils/entries.ts @@ -5,7 +5,7 @@ * 2.0. */ -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { LogEntry } from '../../common/log_entry'; import { LogViewColumnConfiguration } from '../../common/log_views'; @@ -60,15 +60,15 @@ export function generateFakeEntries( function fakeColumnValue(field: string): string { switch (field) { case 'message': - return faker.fake( - '{{internet.ip}} - [{{date.past}}] "GET {{internet.url}} HTTP/1.1" 200 {{random.number}} "-" "{{internet.userAgent}}"' + return faker.helpers.fake( + '{{internet.ip}} - [{{date.past}}] "GET {{internet.url}} HTTP/1.1" 200 {{number.int}} "-" "{{internet.userAgent}}"' ); case 'event.dataset': - return faker.fake('{{hacker.noun}}.{{hacker.noun}}'); + return faker.helpers.fake('{{hacker.noun}}.{{hacker.noun}}'); case 'log.file.path': return faker.system.filePath(); case 'log.level': - return faker.random.arrayElement(['debug', 'info', 'warn', 'error']); + return faker.helpers.arrayElement(['debug', 'info', 'warn', 'error']); case 'host.name': return faker.hacker.noun(); default: diff --git a/x-pack/plugins/threat_intelligence/scripts/generate_indicators.js b/x-pack/plugins/threat_intelligence/scripts/generate_indicators.js index 0d5c170965fe7..daa869c76cf70 100644 --- a/x-pack/plugins/threat_intelligence/scripts/generate_indicators.js +++ b/x-pack/plugins/threat_intelligence/scripts/generate_indicators.js @@ -6,7 +6,7 @@ */ const { Client } = require('@elastic/elasticsearch'); -const faker = require('faker'); +const { faker } = require('@faker-js/faker'); const THREAT_INDEX = 'logs-ti'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts index e828767a39650..e73211b053959 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import type { IndexingInterval } from './types'; export const getTimestamp = (interval?: IndexingInterval) => { diff --git a/yarn.lock b/yarn.lock index d5acff31b563b..d2420ba2c02f6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11435,11 +11435,6 @@ resolved "https://registry.yarnpkg.com/@types/extract-zip/-/extract-zip-1.6.2.tgz#5c7eb441c41136167a42b88b64051e6260c29e86" integrity sha1-XH60QcQRNhZ6QriLZAUeYmDCnoY= -"@types/faker@^5.1.5": - version "5.1.5" - resolved "https://registry.yarnpkg.com/@types/faker/-/faker-5.1.5.tgz#f14b015e0100232bb00c6dd7611505efb08709a0" - integrity sha512-2uEQFb7bsx68rqD4F8q95wZq6LTLOyexjv6BnvJogCO4jStkyc6IDEkODPQcWfovI6g6M3uPQ2/uD/oedJKkNw== - "@types/fetch-mock@^7.3.1": version "7.3.1" resolved "https://registry.yarnpkg.com/@types/fetch-mock/-/fetch-mock-7.3.1.tgz#df7421e8bcb351b430bfbfa5c52bb353826ac94f" @@ -18700,11 +18695,6 @@ extsprintf@1.3.0, extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= -faker@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/faker/-/faker-5.1.0.tgz#e10fa1dec4502551aee0eb771617a7e7b94692e8" - integrity sha512-RrWKFSSA/aNLP0g3o2WW1Zez7/MnMr7xkiZmoCfAGZmdkDQZ6l2KtuXHN5XjdvpRjDl8+3vf+Rrtl06Z352+Mw== - fancy-log@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7"