diff --git a/packages/react-core/src/components/Timestamp/__tests__/Timestamp.test.tsx b/packages/react-core/src/components/Timestamp/__tests__/Timestamp.test.tsx index 482378b2420..9f6f3cdf0a5 100644 --- a/packages/react-core/src/components/Timestamp/__tests__/Timestamp.test.tsx +++ b/packages/react-core/src/components/Timestamp/__tests__/Timestamp.test.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { render, screen } from '@testing-library/react'; +import { render, screen, getDefaultNormalizer } from '@testing-library/react'; import { Timestamp, TimestampFormat, TimestampTooltipVariant } from '../Timestamp'; jest.mock('../../Tooltip', () => ({ @@ -33,7 +33,9 @@ test('Renders component', () => { test('Renders with current date by default with default formatting', () => { render(); - expect(screen.getByText(new Date().toLocaleString())).toBeInTheDocument(); + expect( + screen.getByText(new Date().toLocaleString(), { normalizer: getDefaultNormalizer({ collapseWhitespace: false }) }) + ).toBeInTheDocument(); }); test('Renders with correct datetime attribute with current date by default', () => { @@ -42,7 +44,7 @@ test('Renders with correct datetime attribute with current date by default', () // we want an ISO value without the ms to expect as the datetime value. const isoDateWithoutMS = new Date().toISOString().split('.')[0]; - expect(screen.getByText(new Date().toLocaleString())).toHaveAttribute( + expect(screen.getByText(new Date().toLocaleString(), { normalizer: getDefaultNormalizer({ collapseWhitespace: false }) })).toHaveAttribute( 'datetime', expect.stringMatching(isoDateWithoutMS) ); diff --git a/packages/react-core/src/components/Timestamp/__tests__/__snapshots__/Timestamp.test.tsx.snap b/packages/react-core/src/components/Timestamp/__tests__/__snapshots__/Timestamp.test.tsx.snap index 6eaa5d032d2..9b9cfe43e0d 100644 --- a/packages/react-core/src/components/Timestamp/__tests__/__snapshots__/Timestamp.test.tsx.snap +++ b/packages/react-core/src/components/Timestamp/__tests__/__snapshots__/Timestamp.test.tsx.snap @@ -9,7 +9,7 @@ exports[`Matches snapshot 1`] = ` class="pf-c-timestamp__text" datetime="2022-01-01T00:00:00.000Z" > - 1/1/2022, 12:00:00 AM + 1/1/2022, 12:00:00 AM diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 41ddc8199d7..6a436590c50 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -16,7 +16,8 @@ "analyze": "yarn build:docs --analyze", "build:docs": "pf-docs-framework build all --legacySSL", "clean": "rimraf .cache public static/assets static/base.css src/generated/**/*.js", - "develop": "pf-docs-framework start", + "develop": "./startDevServer.sh", + "start": "pf-docs-framework start", "serve": "pf-docs-framework serve public", "screenshots": "pf-docs-framework screenshots --urlPrefix http://localhost:5000", "test:a11y": "patternfly-a11y --config patternfly-a11y.config" diff --git a/packages/react-docs/startDevServer.sh b/packages/react-docs/startDevServer.sh new file mode 100755 index 00000000000..f1440fc7e77 --- /dev/null +++ b/packages/react-docs/startDevServer.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +STR=$NODE_OPTIONS +SUB='--openssl-legacy-provider' + +if [[ "$STR" != *"$SUB"* ]]; then + NEW_OPTIONS="$NODE_OPTIONS --openssl-legacy-provider" + export NODE_OPTIONS="${NEW_OPTIONS}" + echo "NODE_OPTIONS: ${NODE_OPTIONS}" +fi + +yarn start