1
0
Fork 0
mirror of https://github.com/IRS-Public/direct-file.git synced 2025-08-14 00:30:53 +00:00

Updated to latest node version, typing, compatibility

This commit is contained in:
Kai Sereni 2025-08-07 15:23:36 -07:00
parent 665271d546
commit 5d754abe13
110 changed files with 3088 additions and 1494 deletions

View file

@ -7,4 +7,6 @@
"files.watcherExclude": {
"**/target": true
},
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "interactive",
}

View file

@ -28,7 +28,7 @@
"react-router-dom": "^6.27.0",
"ts-pattern": "^5.5.0",
"uuid": "^9.0.0",
"vite": "^5.4.15",
"vite": "^7.1.0",
"vite-tsconfig-paths": "^4.2.0",
"web-vitals": "^2.1.0"
},
@ -43,8 +43,6 @@
"coverage": "vitest --coverage",
"export-locales": "vite-node src/scripts/exportLocales.ts",
"export-ga-events": "vite-node src/scripts/exportGAEvents.ts",
"format-write": "cd .. && npm run format-write",
"format": "cd .. && npm run format",
"generate-dependency-graph": "vite-node src/fact-dictionary/generateDependencyGraph.ts",
"generate-fact-dictionary": "vite-node src/fact-dictionary/generate-src/generate.ts",
"generate-module-graph": "vite-node src/fact-dictionary/generateModuleGraph.ts",
@ -57,7 +55,7 @@
"postimport-locales": "prettier -w src/locales",
"prebuild:ts": "npm run generate-fact-dictionary",
"prelint:ts": "npm run build:ts",
"prestart": "npm install; npm run generate-fact-dictionary",
"prestart": "npm install && npm run generate-fact-dictionary",
"prestart:promisc": "npm run generate-fact-dictionary",
"pretest:ci:3": "npm run generate-fact-dictionary",
"pretest:ci:2": "npm run generate-fact-dictionary",
@ -87,8 +85,8 @@
"@types/react-dom": "^18.3.1",
"@types/stringify-object": "^4.0.5",
"@types/uuid": "^9.0.1",
"@vitest/coverage-v8": "^1.4.0",
"@vitest/ui": "^1.4.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"autoprefixer": "^10.4.14",
"browserslist-to-esbuild": "^1.2.0",
"eslint-plugin-df-rules": "^1.0.0",
@ -101,9 +99,9 @@
"stringify-object": "^5.0.0",
"ts-node": "^10.9.1",
"typescript": "5.6.3",
"vite-node": "^2.1.8",
"vite-node": "^3.2.4",
"vite-plugin-singlefile": "^0.13.5",
"vitest": "^1.6.1",
"vitest": "^3.2.4",
"zod": "^3.23.8"
}
}

View file

@ -1,4 +1,4 @@
module.exports = {
export default {
plugins: {
autoprefixer: {},
},

View file

@ -1,6 +1,7 @@
import { render, screen } from '@testing-library/react';
import { mockUseTranslation } from './test/mocks/mockFunctions.js';
import App from './App.js';
import { vi } from 'vitest';
vi.mock(`react-i18next`, () => ({
useTranslation: mockUseTranslation,

View file

@ -36,7 +36,7 @@ import { isFlowEnabled } from './constants/pageConstants.js';
import { store } from './redux/store.js';
// These styles are global so we make sure it is imported at the root
import '@trussworks/react-uswds/lib/index.css';
import '../node_modules/@trussworks/react-uswds/lib/index.css'
import FileYourStateTaxesDetails from './components/FileYourStateTaxesDetails/FileYourStateTaxesDetails.js';
import { FactGraphTranslationContext } from './context/FactGraphTranslationContext.js';
import { DataImportMagicScreen } from './components/DataImportMagicScreen/DataImportMagicScreen.js';

View file

@ -208,28 +208,28 @@ const AllScreensMenu: FC<AllScreensMenuProps> = ({
id='check-show-conditionals'
name='conditionals'
label='Show conditional screen logic'
onChange={(e) => onConditionalScreenLogicToggle(e.target.checked)}
onChange={(e: any) => onConditionalScreenLogicToggle(e.target.checked)}
checked={showConditionalScreenLogic}
/>
<Checkbox
id='check-show-modals'
name='show-modals'
label='Show modals'
onChange={(e) => setShowModals(e.target.checked)}
onChange={(e: any) => setShowModals(e.target.checked)}
checked={showModals}
/>
<Checkbox
id='check-show-dataviews'
name='show-dataviews'
label='Show dataviews'
onChange={(e) => setShowDataviews(e.target.checked)}
onChange={(e: any) => setShowDataviews(e.target.checked)}
checked={showDataviews}
/>
<Checkbox
id='check-hide-alerts'
name='hide-alerts'
label='Hide alerts'
onChange={(e) => setHideAlerts(e.target.checked)}
onChange={(e: any) => setHideAlerts(e.target.checked)}
checked={hideAlerts}
/>
</fieldset>

View file

@ -1,6 +1,6 @@
import { FC } from 'react';
import { Accordion, Tag } from '@trussworks/react-uswds';
import { AccordionItemProps } from '@trussworks/react-uswds/lib/components/Accordion/Accordion.js';
import { CommonAccordionItemProps } from '@irs/df-common';
import { dependenciesPerTaxTest } from './AllScreensContext.js';
import { BatchDetails, CONTENT_BATCHES, calculateScreenStatus } from '../flow/batches.js';
import { ScreenConfig } from '../flow/ScreenConfig.js';
@ -85,7 +85,7 @@ const AllScreensScreenHeader: FC<AllScreensScreenHeaderProps> = ({ screen }) =>
</>
);
if (taxTestsAffectedByScreen.length > 0) {
const taxTestsItems: AccordionItemProps[] = [
const taxTestsItems: CommonAccordionItemProps[] = [
{
title: `Tax tests affected (${taxTestsAffectedByScreen.length})`,
content: (
@ -106,7 +106,7 @@ const AllScreensScreenHeader: FC<AllScreensScreenHeaderProps> = ({ screen }) =>
if (screen.batches.length > 0) {
const batchDetailsContent = getBatchDetailsContent(screen);
const batchDetailsItems: AccordionItemProps[] = [
const batchDetailsItems: CommonAccordionItemProps[] = [
{
title: `Batch Details`,
content: batchDetailsContent,
@ -135,7 +135,7 @@ const AllScreensScreenHeader: FC<AllScreensScreenHeaderProps> = ({ screen }) =>
screenHeaderTitle.push(<Tag background='#783cb9'>{taxTestsAffectedByScreen.length} tests</Tag>);
}
const screenHeaderItems: AccordionItemProps[] = [
const screenHeaderItems: CommonAccordionItemProps[] = [
{
title: screenHeaderTitle,
content: screenHeaderContent,

View file

@ -6,7 +6,7 @@ import { v4 as uuidv4 } from 'uuid';
import { SubmissionStatusContextType } from '../../context/SubmissionStatusContext/SubmissionStatusContext.js';
import { TaxReturnSubmissionStatus } from '../../types/core.js';
import { InterceptingFactGraph } from '../../factgraph/InterceptingFactGraph.js';
import scenarioJson from '../../test/scenarioTests/jsonScenarios/mfj-all-income-types-withholding.json';
import scenarioJson from '../../../../../backend/src/test/resources/scenarios/mfj-all-income-types-withholding.json'
import { TaxReturnsSliceStateData } from '../../redux/slices/tax-return/taxReturnSlice.js';
const noop = () => {

View file

@ -1,5 +1,6 @@
import { sessionStorageMock } from '../test/mocks/mockFunctions.js';
import { SessionClock } from './session.js';
import { vi } from 'vitest';
const SessionManagerMock = {
closeAlert: vi.fn(),

View file

@ -1,5 +1,6 @@
import MefAlert, { MefAlertProps } from './MefAlert.js';
import { render, screen, within } from '@testing-library/react';
import { vi } from 'vitest';
const { mockT, mockI18n } = vi.hoisted(() => {
return {

View file

@ -1,4 +1,5 @@
import { i18n, renderWithTranslationProvider as render } from '../../test/test-utils.js';
import { vi } from 'vitest';
import CertifyCheckbox from './CertifyCheckbox.js';

View file

@ -5,6 +5,7 @@ import { Mock } from 'vitest';
import mockEnYaml from '../../locales/en.yaml';
import { mockUseTranslation } from '../../test/mocks/mockFunctions.js';
import ClosingSoonBanner from './index.js';
import { vi } from 'vitest';
vi.mock(`react-i18next`, () => ({
useTranslation: mockUseTranslation,

View file

@ -5,13 +5,14 @@ import CollectionDataPreview from './CollectionDataPreview.js';
import { Path } from '../../flow/Path.js';
import { Provider } from 'react-redux';
import { store } from '../../redux/store.js';
import marge from '../../redux/slices/data-import/mocks/marge.json';
import marge from '../../../../../backend/src/main/resources/dataimportservice/mocks/marge.json'
import { processPopulateResult } from '../../redux/slices/data-import/processPopulateResult.js';
import { DataImportRootResponseSchema } from '../../redux/slices/data-import/schema/DataImportServiceResponse.js';
import { FactGraphContextProvider } from '../../factgraph/FactGraphContext.js';
import mockEnYaml from '../../locales/en.yaml';
import { getEmptySystemAlertsMap, SystemAlertContext } from '../../context/SystemAlertContext/SystemAlertContext.js';
import * as useApiHook from '../../hooks/useApiHook.js';
import { vi } from 'vitest';
vi.mock(`react-i18next`, () => ({
useTranslation: mockUseTranslation,

View file

@ -2,6 +2,7 @@
import { render, screen } from '@testing-library/react';
import { initI18n } from '../../i18n.js';
import ConfirmationModal from './ConfirmationModal.js';
import { vi } from 'vitest';
const i18next = await initI18n();
i18next.addResourceBundle(`test`, `translation`, {

View file

@ -7,6 +7,7 @@ import { mockUseTranslation } from '../../test/mocks/mockFunctions.js';
import { NetworkConnectionContext } from '../../context/networkConnectionContext.js';
import ConnectivityBanner from './index.js';
import { NetworkStatus } from '../../hooks/useNetworkConnectionStatus.js';
import { vi } from 'vitest';
vi.mock(`react-i18next`, () => ({
useTranslation: mockUseTranslation,

View file

@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
import { initI18n } from '../../i18n.js';
import ContentDisplay from './ContentDisplay.js';
import { vi } from 'vitest';
vi.mock(`../../hooks/useTranslationContextFromFacts`, () => ({
default: () => {

View file

@ -9,6 +9,7 @@ import {
} from '../../constants/taxConstants.js';
import { v4 as uuidv4 } from 'uuid';
import { expect } from 'vitest';
import { vi } from 'vitest';
// This mock allows for testing of any component that is rendered using the
// useTranslation hook from react-i18next.

View file

@ -8,6 +8,7 @@ import { v4 as uuidv4 } from 'uuid';
import { beforeAll, afterAll } from 'vitest';
import { MEF_REJECTION_ERROR_CODES } from '../../constants/rejectionConstants.js';
import { FactGraphContextProvider } from '../../factgraph/FactGraphContext.js';
import { vi } from 'vitest';
const { t } = vi.hoisted(() => {
return {

View file

@ -4,6 +4,7 @@ import { ComplexFormControl } from './ComplexFormControl.js';
import { PAGE_HEADING_ID } from '../PageTitle/index.js';
import { ConcretePath } from '@irs/js-factgraph-scala';
import { Path } from '../../fact-dictionary/Path.js';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
return {

View file

@ -1,6 +1,6 @@
import React, { forwardRef, useEffect, useState } from 'react';
import classnames from 'classnames';
import type { TextInputProps } from '@trussworks/react-uswds/lib/components/forms/TextInput/TextInput.js';
import type { TextInputProps } from './DFTextInput.js';
import { DFTextInput } from './DFTextInput.js';
export type AllProps = TextInputProps & {

View file

@ -4,6 +4,7 @@ import { userEvent } from '@testing-library/user-event';
import { TextFormControl } from './TextFormControl.js';
import { ConcretePath, JSEitherL, JSEitherR, JSeither } from '@irs/js-factgraph-scala';
import { Path } from '../../fact-dictionary/Path.js';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
return {

View file

@ -1,7 +1,7 @@
import { Dispatch, SetStateAction, useId } from 'react';
import { ConcretePath, JSeither } from '@irs/js-factgraph-scala';
import { FormGroup, InputGroup, InputPrefix, TextInput, InputSuffix } from '@trussworks/react-uswds';
import type { TextInputProps } from '@trussworks/react-uswds/lib/components/forms/TextInput/TextInput.js';
import type { TextInputProps } from './DFTextInput.js';
import { useFactControl } from '../../hooks/useFactControl.js';
import { buildControlErrorId, buildFormControlId, buildHintId, buildHintKey, sanitizeString } from './helpers.js';
import Translation from '../Translation/index.js';
@ -191,7 +191,7 @@ export function TextFormControl<FactValue, FactError>({
<SimpleTextFormControl
errorMessage={errorMessage}
required={required}
onChange={(event) => onChange(event.target.value)}
onChange={(event: any) => onChange(event.target.value)}
{...formControlProps}
/>
);

View file

@ -5,6 +5,7 @@ import { mockUseTranslation } from '../../test/mocks/mockFunctions.js';
import Head from './Head.js';
import { NetworkConnectionContext } from '../../context/networkConnectionContext.js';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { vi } from 'vitest';
vi.mock(`react-i18next`, () => ({
useTranslation: mockUseTranslation,

View file

@ -5,6 +5,7 @@ import { BrowserRouter } from 'react-router-dom';
import mockEnYaml from '../../locales/en.yaml';
import { sessionStorageMock, mockUseTranslation } from '../../test/mocks/mockFunctions.js';
import { authKeys } from '../../auth/constants.js';
import { vi } from 'vitest';
import Header from './Header.js';

View file

@ -2,7 +2,6 @@ import { FC, PropsWithChildren } from 'react';
import { Icon } from '@trussworks/react-uswds';
// mysterious linter error, but the build is fine
// eslint-disable-next-line import/no-unresolved
import { IconProps } from '@trussworks/react-uswds/lib/components/Icon/Icon.js';
import classNames from 'classnames';
import styles from './IconDisplay.module.scss';
import { useTranslation } from 'react-i18next';
@ -18,7 +17,7 @@ export type IconDisplayProps = PropsWithChildren<
style?: React.CSSProperties;
i18nKey?: string;
isCentered?: boolean;
} & Omit<IconProps, `path`>
} & any
>;
/* we can pass in className and bare style props, which will be merged with the styles from the module,

View file

@ -4,6 +4,7 @@ import { FactGraphContextProvider } from '../../factgraph/FactGraphContext.js';
import { setupStore } from '../../redux/store.js';
import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';
import { vi } from 'vitest';
import IconList from './IconList.js';

View file

@ -2,6 +2,7 @@ import { PropsWithoutRef, ComponentProps } from 'react';
import { render, screen } from '@testing-library/react';
import IntroContent from './IntroContent.js';
import { initI18n } from '../../i18n.js';
import { vi } from 'vitest';
vi.mock(`../../hooks/useTranslationContextFromFacts`, () => ({
default: () => {

View file

@ -1,10 +1,16 @@
import type { ErrorMessage } from '@trussworks/react-uswds';
import classnames from 'classnames';
import React from 'react';
/**
* Stylistically identical to trusswork's ErrorMessage component, but without the alert role
*/
export const QuietErrorMessage: typeof ErrorMessage = ({ children, className, id }) => {
type Props = {
children: React.ReactNode;
className: string;
id: string;
}
export const QuietErrorMessage: typeof ErrorMessage = ({ children, className, id }: Props) => {
const classes = classnames(`usa-error-message`, className);
return (

View file

@ -28,8 +28,6 @@ function parseAlertsByType<AlertConfig extends AggregatedAlertConfig>(alerts: Al
case `error`:
errors.push(alert);
break;
default:
assertNever(alert.props.type);
}
});
@ -94,7 +92,7 @@ const ScreenAlertAggregator = ({
// Mef errors
mefErrors.map((mefError) => (
<MefAlert
{...mefError.props}
{...mefError.props as any}
collectionId={collectionId}
key={`${buildAlertKey(mefError)}-${mefError.props.mefErrorCode}`}
/>
@ -103,7 +101,7 @@ const ScreenAlertAggregator = ({
{
// Tax return errors
taxReturnErrors.map((taxReturnError) => (
<TaxReturnAlert {...taxReturnError.props} collectionId={collectionId} key={buildAlertKey(taxReturnError)} />
<TaxReturnAlert {...taxReturnError.props as any} collectionId={collectionId} key={buildAlertKey(taxReturnError)} />
))
}
{
@ -114,7 +112,7 @@ const ScreenAlertAggregator = ({
// MeF warnings
mefWarnings.map((mefWarning) => (
<MefAlert
{...mefWarning.props}
{...mefWarning.props as any}
collectionId={collectionId}
key={`${buildAlertKey(mefWarning)}-${mefWarning.props.mefErrorCode}`}
/>
@ -126,7 +124,7 @@ const ScreenAlertAggregator = ({
const { childConfigs, ...props } = taxReturnWarning.props;
return (
<TaxReturnAlert {...props} collectionId={collectionId} key={buildAlertKey(taxReturnWarning)}>
<TaxReturnAlert {...props as any} collectionId={collectionId} key={buildAlertKey(taxReturnWarning)}>
{childConfigs?.map((childConfig) => {
return (
<RenderedScreenContent

View file

@ -17,6 +17,7 @@ import {
SystemAlertKey,
} from '../../context/SystemAlertContext/SystemAlertContext.js';
import { TaxReturnsContext, TaxReturnsContextType } from '../../context/TaxReturnsContext.js';
import { vi } from 'vitest';
const { useFact, getIsKnockedOut } = vi.hoisted(() => {
return {

View file

@ -8,6 +8,7 @@ import { FactGraphContextProvider } from '../../factgraph/FactGraphContext.js';
import { TaxReturnsContext } from '../../context/TaxReturnsContext.js';
import { wrapComponent } from '../../test/helpers.js';
import { setupStore } from '../../redux/store.js';
import { vi } from 'vitest';
const { t } = vi.hoisted(() => {
return {

View file

@ -13,6 +13,7 @@ import {
} from '../../context/SystemAlertContext/SystemAlertContext.js';
import { TaxReturnsContext } from '../../context/TaxReturnsContext.js';
import { userEvent } from '@testing-library/user-event';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
const submit = vi.fn(() => ({ hasSubmitError: false, isRetryDisabled: false }));

View file

@ -1,6 +1,7 @@
import AggregateSummaryAlert, { AggregateSummaryAlertProps } from './AggregateSummaryAlert.js';
import { render, screen } from '@testing-library/react';
import { MutableRefObject } from 'react';
import { vi } from 'vitest';
const { mockT, mockI18n } = vi.hoisted(() => {
return {

View file

@ -10,6 +10,7 @@ import { FactGraphContextProvider } from '../../factgraph/FactGraphContext.js';
import { ConcretePath } from '@irs/js-factgraph-scala';
import { MutableRefObject } from 'react';
import { setupStore } from '../../redux/store.js';
import { vi } from 'vitest';
// This mock allows for testing of any component that is rendered using the
// useTranslation hook from react-i18next.

View file

@ -3,6 +3,7 @@ import { initI18n } from '../../i18n.js';
import mockEnYaml from '../../locales/en.yaml';
import { SummaryTable } from './SummaryTable.js';
import { getByTextWithTags } from '../../utils/test-utils.js';
import { vi } from 'vitest';
const i18next = await initI18n();
i18next.addResourceBundle(`test`, `translation`, mockEnYaml);

View file

@ -122,7 +122,7 @@ const SurveyModal = ({ modalRef, toggleModal, openSurveyConfirmationModal }: Sur
checked={isChecked}
required
className='full-width-checkbox'
onChange={(e) => setIsChecked(e.target.checked ? true : false)}
onChange={(e: any) => setIsChecked(e.target.checked ? true : false)}
/>
</div>
<ModalFooter>

View file

@ -6,6 +6,7 @@ import {
SystemAlertKey,
} from '../../context/SystemAlertContext/SystemAlertContext.js';
import { render, screen } from '@testing-library/react';
import { vi } from 'vitest';
const { mockT, mockI18n } = vi.hoisted(() => {
return {

View file

@ -7,6 +7,7 @@ import { Provider } from 'react-redux';
import { TaxReturnsContext } from '../../context/TaxReturnsContext.js';
import { v4 as uuidv4 } from 'uuid';
import { getCurrentTaxYearReturn } from '../../utils/taxReturnUtils.js';
import { vi } from 'vitest';
const currentTaxYear = parseInt(CURRENT_TAX_YEAR);
const previousTaxYear = Number.parseInt(CURRENT_TAX_YEAR) - 1;

View file

@ -8,6 +8,7 @@ import { CreateTaxReturnCard } from './CreateTaxReturnCard.js';
import en from '../../locales/en.yaml';
import { store } from '../../redux/store.js';
import { Provider } from 'react-redux';
import { vi } from 'vitest';
const { mockIsFlowEnabled } = vi.hoisted(() => {
return {

View file

@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
import Translation from './Translation.js';
import { initI18n } from '../../i18n.js';
import { vi } from 'vitest';
vi.mock(`../../hooks/useTranslationContextFromFacts`, () => ({
default: () => {

View file

@ -6,6 +6,7 @@ import { screen } from '@testing-library/react';
import { HelmetProvider } from 'react-helmet-async';
import { FactGraphContextProvider } from '../../../factgraph/FactGraphContext.js';
import { setupStore } from '../../../redux/store.js';
import { vi } from 'vitest';
const sharedProps = {
isNext: true,

View file

@ -11,6 +11,7 @@ import { setupStore } from '../../../redux/store.js';
import { createRef } from 'react';
import { ConcretePath } from '@irs/js-factgraph-scala';
import { Path } from '../../../flow/Path.js';
import { vi } from 'vitest';
// This mock allows for testing of any component that is rendered using the
// useTranslation hook from react-i18next.

View file

@ -8,6 +8,7 @@ import { setupStore } from '../../../redux/store.js';
import { Path } from '../../../flow/Path.js';
import type { useFactControl } from '../../../hooks/useFactControl.js';
import type { BankAccount as SFGBankAccount, BankAccountValidationFailure } from '@irs/js-factgraph-scala';
import { vi } from 'vitest';
const mockUseFactControl = await vi.hoisted(async () => {
type UseFactControl = typeof useFactControl<SFGBankAccount, BankAccountValidationFailure, SFGBankAccount>;

View file

@ -7,6 +7,7 @@ import { setupStore } from '../../../redux/store.js';
import { ConcretePath } from '@irs/js-factgraph-scala';
import { test, expect } from 'vitest';
import { AbsolutePath } from '../../../fact-dictionary/Path.js';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
// useFact related hooks

View file

@ -10,6 +10,7 @@ import { Path } from '../../../flow/Path.js';
import { mockUseTranslation } from '../../../test/mocks/mockFunctions.js';
import CollectionItemReference from './CollectionItemReference.js';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
const getCollectionPath = vi.fn((path: FgPath) => path);

View file

@ -62,7 +62,7 @@ const CollectionItemReference = forwardRef<HTMLInputElement, FactProps>(
name={path}
label={<Translation i18nKey={translationKey} collectionId={value} />}
value={value}
onChange={(event) => onChange(event.target.value)}
onChange={(event: any) => onChange(event.target.value)}
defaultChecked={defaultChecked}
required
key={fullPath}

View file

@ -4,6 +4,7 @@ import { Path } from '../../../flow/Path.js';
import { i18n, renderWithTranslationProvider as render, fireEvent } from '../../../test/test-utils.js';
import { DatePicker, validateDate } from './DatePicker.js';
import { ConcretePath, Day } from '@irs/js-factgraph-scala';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
// useFact related hooks

View file

@ -5,6 +5,7 @@ import { createRef } from 'react';
import { Path } from '../../../flow/Path.js';
import { customRender } from '../../../utils/test-utils.js';
import Ein from './Ein.js';
import { vi } from 'vitest';
// This mock allows for testing of any component that is rendered using the
// useTranslation hook from react-i18next.

View file

@ -6,6 +6,7 @@ import { Path as FgPath } from '../../../fact-dictionary/Path.js';
import { FactGraphContextProvider } from '../../../factgraph/FactGraphContext.js';
import { setupStore } from '../../../redux/store.js';
import { Path } from '../../../flow/Path.js';
import { vi } from 'vitest';
import Enum from './Enum.js';

View file

@ -99,7 +99,7 @@ const Enum = forwardRef<HTMLInputElement, EnumFactProps>(
id={path}
name={path}
validationStatus={showError ? `error` : undefined}
onChange={(event) => handleValueChange(event.target.value)}
onChange={(event: any) => handleValueChange(event.target.value)}
value={selectedValue}
aria-describedby={errorId}
required={required}
@ -125,7 +125,7 @@ const Enum = forwardRef<HTMLInputElement, EnumFactProps>(
name={path}
label={<Translation i18nKey={[maybeCustomTranslationKey, translationKey]} collectionId={collectionId} />}
value={value}
onChange={(event) => handleValueChange(event.target.value)}
onChange={(event: any) => handleValueChange(event.target.value)}
defaultChecked={value === fact?.getValue()}
key={fullPath}
required

View file

@ -10,6 +10,7 @@ import { FactGraphContextProvider } from '../../../factgraph/FactGraphContext.js
import { setupStore } from '../../../redux/store.js';
import { ConcretePath } from '@irs/js-factgraph-scala';
import { Path } from '../../../flow/Path.js';
import { vi } from 'vitest';
// This mock allows for testing of any component that is rendered using the
// useTranslation hook from react-i18next.

View file

@ -3,6 +3,7 @@ import { render } from '@testing-library/react';
import MultiEnum from './MultiEnum.js';
import { Path as FgPath } from '../../../fact-dictionary/Path.js';
import { Path } from '../../../flow/Path.js';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
const getOptionsPath = vi.fn((path: FgPath) => {

View file

@ -104,7 +104,7 @@ const MultiEnum = forwardRef<HTMLInputElement, MultiEnumProps>(
name={path}
value={value}
checked={selectedValues.has(value)}
onChange={(event) => handleValueChange(event.target.value)}
onChange={(event: any) => handleValueChange(event.target.value)}
/>
))}
</ComplexFormControl>

View file

@ -11,6 +11,7 @@ import { setupStore } from '../../../redux/store.js';
import { createRef } from 'react';
import { ConcretePath } from '@irs/js-factgraph-scala';
import { Path } from '../../../flow/Path.js';
import { vi } from 'vitest';
// This mock allows for testing of any component that is rendered using the
// useTranslation hook from react-i18next.

View file

@ -5,6 +5,7 @@ import { createRef } from 'react';
import { Path } from '../../../flow/Path.js';
import { customRender } from '../../../utils/test-utils.js';
import Tin from './Tin.js';
import { vi } from 'vitest';
// This mock allows for testing of any component that is rendered using the
// useTranslation hook from react-i18next.

View file

@ -53,7 +53,7 @@ export function conditionsAsKeySuffix({ props: { condition, conditions } }: Scre
const normalizedConditions = condition === undefined ? conditions ?? [] : [condition];
return normalizedConditions
.map((condition) =>
.map((condition: any) =>
typeof condition === `string` ? condition : `${condition.operator ?? `isTrue`}:${condition.condition}`
)
.join(`-`);

View file

@ -52,7 +52,7 @@ const getTinMismatchCustomConfig: CustomSystemAlertConfigBuilder = (options = {}
: {
primaryFilerSsnOrItinLink: <CommonLinkRenderer url={primarySsnUrl} />,
},
};
} as any;
};
/**

View file

@ -1,9 +1,10 @@
import fs from 'fs';
import { XMLParser, XMLValidator, X2jOptions } from 'fast-xml-parser';
import { RawFact } from '../FactTypes.js';
import path from 'path';
export default function readRawFacts(): RawFact[] {
const FACT_DICTIONARY_FOLDER = `./src/fact-dictionary/generate-src/xml-src/`;
const FACT_DICTIONARY_FOLDER = `../../backend/src/main/resources/tax/`;
const XML_PARSER_OPTIONS: X2jOptions = {
ignoreAttributes: false,
@ -22,7 +23,10 @@ export default function readRawFacts(): RawFact[] {
// eslint-disable-next-line no-console
console.log(`Reading file ${dictionaryFile}`);
// nosemgrep: eslint.detect-non-literal-fs-filename
const rawXmlString = fs.readFileSync(FACT_DICTIONARY_FOLDER + dictionaryFile, `utf-8`);
const rawXmlString = fs.readFileSync(
path.join(FACT_DICTIONARY_FOLDER, dictionaryFile),
`utf-8`
);
const xmlValidationResult = XMLValidator.validate(rawXmlString, {
allowBooleanAttributes: true,

View file

@ -1 +0,0 @@
../../../../../backend/src/main/resources/tax

View file

@ -1 +0,0 @@
../../../../../backend/src/main/resources/factgraphservice/xmlFactPaths

View file

@ -9,6 +9,7 @@ import { initialState as initialTelemetryState } from '../redux/slices/telemetry
import { initialState as initialESigState } from '../redux/slices/electronic-signature/electronicSignatureSlice.js';
import { initialSystemAlertState } from '../redux/slices/system-alert/systemAlertSlice.js';
import { vi } from 'vitest';
vi.mock(`../redux/store.js`);

View file

@ -15,6 +15,7 @@ import { taxReturnFetch } from '../redux/slices/tax-return/taxReturnFetch.js';
import { Provider } from 'react-redux';
import { store } from '../redux/store.js';
import { fetchTaxReturns } from '../redux/slices/tax-return/taxReturnSlice.js';
import { vi } from 'vitest';
vi.mock(`../redux/slices/tax-return/taxReturnFetch.js`, () => ({
taxReturnFetch: vi.fn(), // Mock the function

View file

@ -1,5 +1,6 @@
import { Path } from '../fact-dictionary/Path.js';
import { useEnumOptions } from './useEnumOptions.js';
import { vi } from 'vitest';
const mockFactGraph = vi.hoisted(() => {
const getOptionsPathForEnum = vi.fn();

View file

@ -3,6 +3,7 @@ import { useFactControl, UseFactControlParameters } from './useFactControl.js';
import { EitherL, EitherR } from '@irs/js-factgraph-scala/src/typings/utils/JSEither.js';
import { Dispatch, SetStateAction } from 'react';
import { renderHook } from '@testing-library/react';
import { vi } from 'vitest';
type TestError = string;
type TestRawValue = { isValid: true } | { isValid: false; error: TestError };

View file

@ -1,6 +1,7 @@
import { useGetTranslationValues } from './useGetTranslationValues.js';
import { renderHook } from '@testing-library/react';
import { getTranslationValuesRecursive } from '../utils/i18nUtils.js';
import { vi } from 'vitest';
const { mockT, mockI18n } = vi.hoisted(() => {
return {

View file

@ -2,6 +2,7 @@ import { renderHook, act } from '@testing-library/react';
import useNetworkConnectionStatus from './useNetworkConnectionStatus.js';
import App from '../App.js';
import { renderWithTranslationProvider } from '../test/test-utils.js';
import { vi } from 'vitest';
const intervalTime = 50;
const initialStatus = { online: true, prevOnlineStatus: true };

View file

@ -10,6 +10,7 @@ import { getCurrentTaxYearReturn, getLatestSubmission } from '../utils/taxReturn
import { TaxReturnsContext } from '../context/TaxReturnsContext.js';
import { store } from '../redux/store.js';
import { Provider } from 'react-redux';
import { vi } from 'vitest';
const mockFetchTaxReturnsApiRequest = vi.fn();
const mockFetchSubmissionStatusApiRequest = vi.fn();

View file

@ -15,6 +15,7 @@ import {
SystemAlertContext,
SystemAlertKey,
} from '../context/SystemAlertContext/SystemAlertContext.js';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
return {

View file

@ -1,6 +1,7 @@
import { Path } from '../fact-dictionary/Path.js';
import useTranslationContextFromFacts from './useTranslationContextFromFacts.js';
import { Day, FactGraph } from '@irs/js-factgraph-scala';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
// translation

View file

@ -2,6 +2,7 @@ import useUrlTranslator from './useUrlTranslator.js';
import { renderHook } from '@testing-library/react';
import { LANGUAGE_CODE_PLACEHOLDER } from '../utils/urlUtils.js';
import { StateProfile } from '../types/StateProfile.js';
import { vi } from 'vitest';
const { mockUseTranslation } = vi.hoisted(() => {
return {

View file

@ -1,5 +1,6 @@
import { formatAndAppendHeaders, SM_UNIVERSALID, XFF_HEADER, TID_HEADER } from './apiHelpers.js';
import { v4 as uuidv4 } from 'uuid';
import { vi } from 'vitest';
const {
VITE_SADI_AUTH_ID,

View file

@ -5,6 +5,7 @@ import { v4 as uuidv4 } from 'uuid';
import { BrowserRouter } from 'react-router-dom';
import { TaxReturn } from '../../../types/core.js';
import enLocale from '../../../locales/en.yaml';
import { vi } from 'vitest';
const { mockT, mockI18n } = vi.hoisted(() => {
return {

View file

@ -1,25 +1,25 @@
import homer from './mocks/homer.json';
import marge from './mocks/marge.json';
import lisa from './mocks/lisa.json';
import lisaKnockout from './mocks/lisa_knockout.json';
import bart from './mocks/bart.json';
import sean from './mocks/sean.json';
import abe from './mocks/abe.json';
import grandma from './mocks/grandma.json';
import milhouse from './mocks/milhouse.json';
import sideshowbob from './mocks/sideshowbob.json';
import krusty from './mocks/krusty.json';
import margeWithOnlySadiSuccess from './mocks/marge_with_only_sadi_success.json';
import ned from './mocks/ned.json';
import december27 from './mocks/december27.json';
import kent from './mocks/kent.json';
import jon from './mocks/jon.json';
import margeWithSpaces from './mocks/marge__simpson.json';
import w2ParseError from './mocks/w2_parse_error.json';
import carly from './mocks/carly.json';
import w2_with_decimal_values from './mocks/w2_with_decimal_values.json';
import maude from './mocks/maude.json';
import rod from './mocks/rod.json';
import homer from '../../../../../../backend/src/main/resources/dataimportservice/mocks/homer.json';
import marge from '../../../../../../backend/src/main/resources/dataimportservice/mocks/marge.json';
import lisa from '../../../../../../backend/src/main/resources/dataimportservice/mocks/lisa.json';
import lisaKnockout from '../../../../../../backend/src/main/resources/dataimportservice/mocks/lisa_knockout.json';
import bart from '../../../../../../backend/src/main/resources/dataimportservice/mocks/bart.json';
import sean from '../../../../../../backend/src/main/resources/dataimportservice/mocks/sean.json';
import abe from '../../../../../../backend/src/main/resources/dataimportservice/mocks/abe.json';
import grandma from '../../../../../../backend/src/main/resources/dataimportservice/mocks/grandma.json';
import milhouse from '../../../../../../backend/src/main/resources/dataimportservice/mocks/milhouse.json';
import sideshowbob from '../../../../../../backend/src/main/resources/dataimportservice/mocks/sideshowbob.json';
import krusty from '../../../../../../backend/src/main/resources/dataimportservice/mocks/krusty.json';
import margeWithOnlySadiSuccess from '../../../../../../backend/src/main/resources/dataimportservice/mocks/marge_with_only_sadi_success.json';
import ned from '../../../../../../backend/src/main/resources/dataimportservice/mocks/ned.json';
import december27 from '../../../../../../backend/src/main/resources/dataimportservice/mocks/december27.json';
import kent from '../../../../../../backend/src/main/resources/dataimportservice/mocks/kent.json';
import jon from '../../../../../../backend/src/main/resources/dataimportservice/mocks/jon.json';
import margeWithSpaces from '../../../../../../backend/src/main/resources/dataimportservice/mocks/marge__simpson.json';
import w2ParseError from '../../../../../../backend/src/main/resources/dataimportservice/mocks/w2_parse_error.json';
import carly from '../../../../../../backend/src/main/resources/dataimportservice/mocks/carly.json';
import w2_with_decimal_values from '../../../../../../backend/src/main/resources/dataimportservice/mocks/w2_with_decimal_values.json';
import maude from '../../../../../../backend/src/main/resources/dataimportservice/mocks/maude.json';
import rod from '../../../../../../backend/src/main/resources/dataimportservice/mocks/rod.json';
import { DataImportProfile } from './dataImportProfileTypes.js';
import { DataImportRootResponseSchema } from './schema/DataImportServiceResponse.js';

View file

@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { processPopulateResult } from '../processPopulateResult.js';
import { DataImportRootResponseSchema } from '../schema/DataImportServiceResponse.js';
import marge from '../mocks/marge.json';
import marge from '../../../../../../../backend/src/main/resources/dataimportservice/mocks/marge.json'
const copy = (data: unknown) => JSON.parse(JSON.stringify(data));

View file

@ -3,7 +3,7 @@ import { store } from '../../../store.js';
import { fetchProfile } from '../dataImportProfileSlice.js';
import { fetchDataImportProfile } from '../fetchDataImportProfile.js';
import { Mock, describe, expect, it, vi } from 'vitest';
import marge from '../mocks/marge.json';
import marge from '../../../../../../../backend/src/main/resources/dataimportservice/mocks/marge.json'
vi.mock(`../fetchDataImportProfile.js`, () => ({
fetchDataImportProfile: vi.fn(), // Mock the function

View file

@ -5,6 +5,7 @@ import { SystemAlertContextProvider } from '../../../context/SystemAlertContext/
import { store } from '../../../redux/store.js';
import { Provider } from 'react-redux';
import { wrapComponent } from '../../../test/helpers.js';
import { vi } from 'vitest';
const handleGoBack = vi.fn();
const errorMessage = `Details about an error!`;

View file

@ -3,6 +3,7 @@ import { render, screen, within } from '@testing-library/react';
import { CURRENT_TAX_YEAR, FEDERAL_RETURN_STATUS } from '../../../constants/taxConstants.js';
import { userEvent } from '@testing-library/user-event';
import { wrapComponent } from '../../../test/helpers.js';
import { vi } from 'vitest';
const mockHandleGoBack = vi.fn();

View file

@ -6,6 +6,7 @@ import TransferInfoModal, { TransferInfoModalProps } from './TransferInfoModal.j
import { v4 as uuidv4 } from 'uuid';
import { userEvent } from '@testing-library/user-event';
import { InterceptingFactGraph } from '../../../factgraph/InterceptingFactGraph.js';
import { vi } from 'vitest';
const mockFetchPdf = vi.fn();
const { mockUseFetchPdf, mockI18n, mockUseFactGraph } = vi.hoisted(() => ({

View file

@ -8,6 +8,7 @@ import { InterceptingFactGraph } from '../../../factgraph/InterceptingFactGraph.
import { SystemAlertConfigs, SystemAlertContext } from '../../../context/SystemAlertContext/SystemAlertContext.js';
import { initI18n } from '../../../i18n.js';
import { StateApiErrorCode } from '../../../constants/stateApiConstants.js';
import { vi } from 'vitest';
const { mockUseFactGraph } = vi.hoisted(() => ({
mockUseFactGraph: vi.fn(() => ({

View file

@ -14,6 +14,7 @@ import { TaxReturnSubmissionStatus } from '../../../types/core.js';
import { Provider } from 'react-redux';
import { store } from '../../../redux/store.js';
import { getEmptySystemAlertsMap, SystemAlertContext } from '../../../context/SystemAlertContext/SystemAlertContext.js';
import { vi } from 'vitest';
const NOW = new Date();
const BEFORE_LOCKOUT = new Date(new Date().setSeconds(NOW.getSeconds() - (STATUS_FETCH_LOCKOUT_SECONDS + 1)));

View file

@ -33,6 +33,7 @@ import { ReactNode } from 'react';
import { getEmptySystemAlertsMap, SystemAlertContext } from '../context/SystemAlertContext/SystemAlertContext.js';
import * as pageConstants from '../constants/pageConstants.js';
import CollectionItemDataView from './data-view/CollectionItemDataView.js';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
return {

View file

@ -16,7 +16,7 @@ export const BackButton = () => {
type='button'
className='screen__back-button'
unstyled
onClick={(evt) => {
onChange={(evt: any) => {
evt.preventDefault();
// @ts-expect-error react navigation type is not defined correctly
navigate(-1, { preventScrollReset: true });

View file

@ -23,6 +23,7 @@ import { baseFilerData, primaryFilerId, makeInterestReportData } from '../../tes
import CollectionHubDataView from './CollectionHubDataView.js';
import { initI18n } from '../../i18n.js';
import { setupStore } from '../../redux/store.js';
import { vi } from 'vitest';
const intReportId1 = `9d164507-0c5a-469d-8d36-49d2f7af0b7a`;
const intReportId2 = `24aa5dee-e381-4927-a0d9-07658287086c`;

View file

@ -20,6 +20,7 @@ import en from '../../locales/en.yaml';
import { baseFilerData, primaryFilerId, makeSocialSecurityReport } from '../../test/testData.js';
import CollectionHubDataView from './CollectionHubDataView.js';
import { initI18n } from '../../i18n.js';
import { vi } from 'vitest';
const ssReportId1 = `423bef54-e524-463c-829f-0948df47a4bd`;
const ssReportId2 = `08eea4dd-c0ee-4128-9afc-2b74dca27101`;

View file

@ -24,6 +24,7 @@ import CollectionItemDataView from './CollectionItemDataView.js';
import { SystemAlertContext, getEmptySystemAlertsMap } from '../../context/SystemAlertContext/SystemAlertContext.js';
import { setupStore } from '../../redux/store.js';
import { ReactNode } from 'react';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
return {

View file

@ -25,6 +25,7 @@ import {
makeW2Data,
primaryFilerId,
} from '../../test/testData.js';
import { vi } from 'vitest';
const mocks = vi.hoisted(() => {
return {

View file

@ -21,6 +21,7 @@ import {
createTinWrapper,
} from '../../test/persistenceWrappers.js';
import { setupFactGraph } from '../../test/setupFactGraph.js';
import { vi } from 'vitest';
// Test data for rendering subsubcategories
const w2Id = `0b1e355e-3d19-415d-8470-fbafd9f58361`;

View file

@ -533,11 +533,14 @@ export function SubSubCategory({
const allAssertions = availableScreens
.flatMap((sc) =>
sc.content.filter(
(c) =>
sc.content.filter((c) =>
{
return (
conditionsPass(c.props, factGraph, collectionId) &&
(c.componentName === `FactAssertion` || c.componentName === `FactResultAssertion`)
)
}
)
)
.filter((result) => result);
const factAssertion = allAssertions.find((a) => a?.componentName === `FactAssertion`)?.props as AssertionDeclaration;

View file

@ -13,6 +13,7 @@ import { store } from '../redux/store.js';
import { taxReturnFetch } from '../redux/slices/tax-return/taxReturnFetch.js';
import { Mock } from 'vitest';
import { taxReturnCreate } from '../redux/slices/tax-return/taxReturnCreate.js';
import { vi } from 'vitest';
vi.mock(`../redux/slices/tax-return/taxReturnFetch.js`, () => ({
taxReturnFetch: vi.fn(), // Mock the function

View file

@ -4,6 +4,7 @@ import { createBooleanWrapper, createDayWrapper } from '../persistenceWrappers.j
import { baseFilerData, filerWithPaymentDueData } from '../testData.js';
import { setupFactGraph } from '../setupFactGraph.js';
import { CURRENT_TAX_YEAR } from '../../constants/taxConstants.js';
import { vi } from 'vitest';
describe(`Payment method`, () => {
const basePaymentMethodData = {

View file

@ -22,6 +22,7 @@ import { CURRENT_TAX_YEAR } from '../../constants/taxConstants.js';
import { v4 as uuidv4 } from 'uuid';
import { fetchTaxReturns } from '../../redux/slices/tax-return/taxReturnSlice.js';
import { fetchProfile } from '../../redux/slices/data-import/dataImportProfileSlice.js';
import { vi } from 'vitest';
vi.mock(`../../redux/slices/tax-return/taxReturnFetch.js`, () => ({
taxReturnFetch: vi.fn(), // Mock the function

View file

@ -12,6 +12,7 @@ import flowNodes from '../../flow/flow.js';
import makeGivenFacts from './functionalFlowUtils.js';
import { CollectionItemReferenceFactory } from '@irs/js-factgraph-scala';
import { setupFactGraph } from '../setupFactGraph.js';
import { vi } from 'vitest';
const flow = createFlowConfig(flowNodes);
const givenFacts = makeGivenFacts(flow);

View file

@ -13,6 +13,7 @@ import flowNodes from '../../flow/flow.js';
import { TAX_YEAR_2023 } from '../../constants/taxConstants.js';
import makeGivenFacts from './functionalFlowUtils.js';
import { setupFactGraph } from '../setupFactGraph.js';
import { vi } from 'vitest';
const flow = createFlowConfig(flowNodes);
const givenFacts = makeGivenFacts(flow);

View file

@ -13,6 +13,7 @@ import {
} from '../testData.js';
import makeGivenFacts from './functionalFlowUtils.js';
import { setupFactGraph } from '../setupFactGraph.js';
import { vi } from 'vitest';
const flow = createFlowConfig(flowNodes);
const givenFacts = makeGivenFacts(flow);

View file

@ -11,7 +11,8 @@ import { fetchDataImportProfile } from '../../redux/slices/data-import/fetchData
import { fetchProfile } from '../../redux/slices/data-import/dataImportProfileSlice.js';
import { store } from '../../redux/store.js';
import { TaxReturn } from '../../types/core.js';
import marge from '../../redux/slices/data-import/mocks/marge.json';
import { vi } from 'vitest';
import marge from '../../../../../backend/src/main/resources/dataimportservice/mocks/marge.json'
vi.mock(`../../redux/slices/data-import/fetchDataImportProfile.js`, () => ({
fetchDataImportProfile: vi.fn(), // Mock the function

View file

@ -1 +0,0 @@
../../../../../backend/src/test/resources/scenarios

View file

@ -1,5 +1,6 @@
// eslint-disable-next-line max-len
import scenarioO1Json from './jsonScenarios/ats-1.json';
// import scenarioO1Json from './jsonScenarios/ats-1.json';
import scenarioO1Json from '../../../../../backend/src/test/resources/scenarios/ats-1.json'
import { ConcretePath, FactGraph, ScalaList } from '@irs/js-factgraph-scala';
import { singleNoDependentsWithTwoW2s01 as snapshotScenario01 } from './goldenScenarios.js';
import { FactValue } from '../../types/core.js';

View file

@ -1,13 +1,14 @@
import { FactGraph } from '@irs/js-factgraph-scala';
import { Condition, RawCondition } from '../flow/Condition.js';
type HasConditions = { condition?: RawCondition; conditions?: RawCondition[] };
import { ConfigProps, FlowComponentName, FlowNodeType } from '../flow/ContentDeclarations.js';
import { ComponentProps } from 'react';
export const conditionsPass = (props: HasConditions, fg: FactGraph, collectionId: string | null) => {
export const conditionsPass = (props: ConfigProps<ComponentProps<FlowNodeType<FlowComponentName>>>, fg: FactGraph, collectionId: string | null) => {
if (props && props.condition) {
return new Condition(props.condition).evaluate(fg, collectionId);
// eslint-disable-next-line eqeqeq
} else if (props.conditions != undefined) {
return props.conditions.every((c) => {
return props.conditions.every((c: RawCondition) => {
const result = new Condition(c).evaluate(fg, collectionId);
return result;
});

View file

@ -4,7 +4,8 @@ import ErrorBoundary from './errorBoundary.js';
import { Provider } from 'react-redux';
import { store } from '../redux/store.js';
import { isTelemetryEnabled } from '../constants/pageConstants.js';
import { Mock } from 'vitest';
import { Mock, vi } from 'vitest';
vi.useFakeTimers();
vi.mock(`../constants/pageConstants.js`, () => ({

View file

@ -1,4 +1,4 @@
import { UserConfig, defineConfig } from 'vitest/config';
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import browserslistToEsbuild from 'browserslist-to-esbuild';
import { JSON_SCHEMA } from 'js-yaml';
@ -7,7 +7,7 @@ import viteTsconfigPaths from 'vite-tsconfig-paths';
import autoprefixer from 'autoprefixer';
import path from 'path';
export const configOptions: UserConfig = {
export default defineConfig({
base: process.env.DF_CLIENT_PUBLIC_PATH || '/df/file',
assetsInclude: ['**/*.svg'],
plugins: [react(), viteTsconfigPaths(), ViteYaml({ schema: JSON_SCHEMA })],
@ -17,11 +17,11 @@ export const configOptions: UserConfig = {
localsConvention: 'camelCaseOnly',
},
postcss: {
plugins: [autoprefixer()],
plugins: [autoprefixer() as any],
},
preprocessorOptions: {
scss: {
includePaths: ['../node_modules/@uswds', '../node_modules/@uswds/uswds/packages'],
loadPaths: ['../node_modules/@uswds', '../node_modules/@uswds/uswds/packages'],
silenceDeprecations: ['legacy-js-api'],
},
},
@ -38,7 +38,7 @@ export const configOptions: UserConfig = {
// Mock OLA
'/ola/rest/taxpayer/taxRecord': {
bypass: (_req, res, _options) => {
res.write(
res!.write(
JSON.stringify({
transcriptSummary: {
panelShowing: true,
@ -58,7 +58,7 @@ export const configOptions: UserConfig = {
},
})
);
res.end();
res!.end();
return 'Bypassed'; // string return value prevents this from going to the original req.target
},
},
@ -97,7 +97,4 @@ export const configOptions: UserConfig = {
},
},
},
};
// https://vitejs.dev/config/
export default defineConfig(configOptions);
});

Some files were not shown because too many files have changed in this diff Show more