diff --git a/packages/core/jest.config.js b/packages/core/jest.config.js index 678efc9..8606069 100644 --- a/packages/core/jest.config.js +++ b/packages/core/jest.config.js @@ -1,5 +1,6 @@ module.exports = async () => { return { + setupFilesAfterEnv: ['/setup-tests.js'], rootDir: __dirname, reporters: ['default', 'jest-summary-reporter'], testPathIgnorePatterns: [ diff --git a/packages/core/setup-tests.js b/packages/core/setup-tests.js new file mode 100644 index 0000000..0ceaa48 --- /dev/null +++ b/packages/core/setup-tests.js @@ -0,0 +1,4 @@ +import '@testing-library/jest-dom'; +import { TextEncoder, TextDecoder } from 'util'; +global.TextEncoder = TextEncoder; +global.TextDecoder = TextDecoder; diff --git a/packages/core/test/components/mapper/array.test.js b/packages/core/test/components/mapper/array.test.js index 38a0214..e4dd1f4 100644 --- a/packages/core/test/components/mapper/array.test.js +++ b/packages/core/test/components/mapper/array.test.js @@ -1,7 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import { ArrayComponent } from '../../../src/components/mapper/array'; -import '@testing-library/jest-dom/extend-expect'; -import shortid from 'shortid'; import { SchemaForm, util, constants } from '../../../src'; import React from 'react'; diff --git a/packages/core/test/components/mapper/checkbox.test.js b/packages/core/test/components/mapper/checkbox.test.js index 32afb16..100dbd1 100644 --- a/packages/core/test/components/mapper/checkbox.test.js +++ b/packages/core/test/components/mapper/checkbox.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import * as barebones from '@forml/decorator-barebones'; import { SchemaForm, getLocalizer, util } from '../../../src'; diff --git a/packages/core/test/components/mapper/date.test.js b/packages/core/test/components/mapper/date.test.js index 7409894..af26e0e 100644 --- a/packages/core/test/components/mapper/date.test.js +++ b/packages/core/test/components/mapper/date.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { createElement as h } from 'react'; import { SchemaForm, getLocalizer, util } from '../../../src'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/components/mapper/fieldset.test.js b/packages/core/test/components/mapper/fieldset.test.js index 961bd8b..5471e91 100644 --- a/packages/core/test/components/mapper/fieldset.test.js +++ b/packages/core/test/components/mapper/fieldset.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { createElement as h } from 'react'; import { SchemaForm, getLocalizer, util, decorators } from '../../../src'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/components/mapper/integer.test.js b/packages/core/test/components/mapper/integer.test.js index 75cd764..aa91c0d 100644 --- a/packages/core/test/components/mapper/integer.test.js +++ b/packages/core/test/components/mapper/integer.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { createElement as h } from 'react'; import { SchemaForm, getLocalizer, util } from '../../../src'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/components/mapper/number.test.js b/packages/core/test/components/mapper/number.test.js index adae37c..ca2e645 100644 --- a/packages/core/test/components/mapper/number.test.js +++ b/packages/core/test/components/mapper/number.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { createElement as h } from 'react'; import { SchemaForm, getLocalizer, util } from '../../../src'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/components/mapper/select.test.js b/packages/core/test/components/mapper/select.test.js index 7b03912..b30e4c0 100644 --- a/packages/core/test/components/mapper/select.test.js +++ b/packages/core/test/components/mapper/select.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { config } from 'react-transition-group'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/general.test.js b/packages/core/test/general.test.js index f181b9d..1169481 100644 --- a/packages/core/test/general.test.js +++ b/packages/core/test/general.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { SchemaForm, getLocalizer, util } from '../src'; import { createElement as h } from 'react'; diff --git a/packages/decorator-mui/src/__tests__/mui.test.js b/packages/decorator-mui/src/__tests__/mui.test.js index afe4415..8d4112b 100644 --- a/packages/decorator-mui/src/__tests__/mui.test.js +++ b/packages/decorator-mui/src/__tests__/mui.test.js @@ -1,5 +1,3 @@ -import '@testing-library/jest-dom/extend-expect'; - import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { render } from '@testing-library/react';