diff --git a/.eslintrc b/.eslintrc index 5805269f5..dc01e1822 100644 --- a/.eslintrc +++ b/.eslintrc @@ -69,6 +69,9 @@ "plugins": ["jest"], "env": { "jest/globals": true + }, + "parserOptions": { + "project": "./test/frontend/tsconfig.json" } } ], diff --git a/test/frontend/components/accounting/accounting-codes-settings.test.js b/test/frontend/components/accounting/accounting-codes-settings.test.tsx similarity index 92% rename from test/frontend/components/accounting/accounting-codes-settings.test.js rename to test/frontend/components/accounting/accounting-codes-settings.test.tsx index f7e95f520..b5c08520c 100644 --- a/test/frontend/components/accounting/accounting-codes-settings.test.js +++ b/test/frontend/components/accounting/accounting-codes-settings.test.tsx @@ -1,11 +1,10 @@ -import React from 'react'; import { AccountingCodesSettings } from 'components/accounting/accounting-codes-settings'; import { render, fireEvent, waitFor, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; describe('AccountingCodesSettings', () => { - const onSuccess = jest.fn(message => {}); - const onError = jest.fn(e => {}); + const onSuccess = jest.fn(); + const onError = jest.fn(); test('render AccountingCodesSettings', async () => { render(); diff --git a/test/frontend/components/accounting/advanced-accounting-form.test.js b/test/frontend/components/accounting/advanced-accounting-form.test.tsx similarity index 98% rename from test/frontend/components/accounting/advanced-accounting-form.test.js rename to test/frontend/components/accounting/advanced-accounting-form.test.tsx index 86d69d03a..de7085068 100644 --- a/test/frontend/components/accounting/advanced-accounting-form.test.js +++ b/test/frontend/components/accounting/advanced-accounting-form.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { AdvancedAccountingForm } from 'components/accounting/advanced-accounting-form'; import { render, waitFor, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; diff --git a/test/frontend/components/plans/plan-form.test.js b/test/frontend/components/plans/plan-form.test.tsx similarity index 99% rename from test/frontend/components/plans/plan-form.test.js rename to test/frontend/components/plans/plan-form.test.tsx index b7895efab..35435a118 100644 --- a/test/frontend/components/plans/plan-form.test.js +++ b/test/frontend/components/plans/plan-form.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { render, fireEvent, waitFor, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import { PlanForm } from 'components/plans/plan-form'; diff --git a/test/frontend/tsconfig.json b/test/frontend/tsconfig.json new file mode 100644 index 000000000..0ca845ecf --- /dev/null +++ b/test/frontend/tsconfig.json @@ -0,0 +1,13 @@ +{ + "references": [ + { "path": "../../" } + ], + "include": ["components/**/*", "__fixtures__/**/*"], + "compilerOptions": { + "jsx": "react-jsx", + "target": "es2015", + "module": "ES2020", + "moduleResolution": "node", + "baseUrl": "../../app/frontend/src/javascript" + } +} diff --git a/tsconfig.json b/tsconfig.json index 4d9b910b3..fe2643938 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,12 +12,17 @@ "noEmit": true, "allowSyntheticDefaultImports": true, "downlevelIteration": true, + "rootDir": "app/frontend/src/javascript" }, "exclude": [ "**/*.spec.ts", "node_modules", "vendor", - "public" + "public", + "test/frontend/**/*" + ], + "include": [ + "app/frontend/src/javascript/**/*" ], "compileOnSave": false }