Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into chellen-04-query
Browse files Browse the repository at this point in the history
  • Loading branch information
ncovercash committed Apr 26, 2024
2 parents 442a3ac + 75766bf commit 1f177fd
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 29 deletions.
28 changes: 10 additions & 18 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
const { join } = require('path');
const config = require('@folio/jest-config-stripes');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
module.exports = {
testEnvironment: 'jsdom',
...config,

preset: 'ts-jest',
transform: {
'^.+\\.(t|j)sx?$': 'ts-jest',
},
transformIgnorePatterns: ['node_modules/(?!@folio|ky)'],
coverageProvider: 'v8',

moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json'],

testMatch: ['**/src/**/?(*.)test.{js,jsx,ts,tsx}'],
testPathIgnorePatterns: ['/node_modules/', 'src/typings/'],

reporters: ['default', 'jest-junit'],

coverageReporters: ['lcov', 'text'],
coverageDirectory: './artifacts/coverage-jest/',
collectCoverageFrom: [
'<rootDir>/index.ts',
'<rootDir>/src/**/*.{ts,tsx}',
Expand All @@ -29,9 +21,15 @@ module.exports = {
'!**/node_modules/**',
],

setupFiles: [join(__dirname, './src/test/setupTests.ts')],
setupFiles: [...config.setupFiles, join(__dirname, './src/test/setupTests.ts')],
setupFilesAfterEnv: [join(__dirname, './src/test/jest.setup.ts')],

preset: 'ts-jest',
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
...config.transform,
},

moduleNameMapper: {
'^.+\\.(css|svg)$': 'identity-obj-proxy',

Expand All @@ -41,10 +39,4 @@ module.exports = {

slowTestThreshold: 10,
testTimeout: 20000,

globals: {
'ts-jest': {
tsconfig: 'src/tsconfig.json',
},
},
};
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"devDependencies": {
"@folio/eslint-config-stripes": "^7.0.0",
"@folio/jest-config-stripes": "^2.0.0",
"@folio/stripes": "^9.0.0",
"@folio/stripes-cli": "^3.0.0",
"@formatjs/cli": "^4.2.21",
Expand All @@ -35,10 +36,6 @@
"eslint-plugin-jest": "^23.0.4",
"eslint-import-resolver-webpack": "^0.13.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^28.0.0",
"jest-css-modules": "^2.1.0",
"jest-environment-jsdom": "^29.6.1",
"jest-junit": "^16.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-final-form": "^6.5.9",
Expand Down
2 changes: 1 addition & 1 deletion src/test/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import '@testing-library/jest-dom';
import '@folio/jest-config-stripes/testing-library/jest-dom';
6 changes: 2 additions & 4 deletions src/test/util/expectRender.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { render } from '@testing-library/react';
import { render } from '@folio/jest-config-stripes/testing-library/react';
import { ReactNode } from 'react';
import withIntlConfiguration from './withIntlConfiguration';

export default function expectRender(
error: ReactNode
): jest.JestMatchers<string> {
export default function expectRender(error: ReactNode): jest.JestMatchers<string> {
return expect(render(withIntlConfiguration(error)).container.textContent);
}
2 changes: 1 addition & 1 deletion src/test/util/getIntl.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cleanup, render } from '@testing-library/react';
import { cleanup, render } from '@folio/jest-config-stripes/testing-library/react';
import React from 'react';
import { IntlContext, IntlShape } from 'react-intl';
import withIntlConfiguration from './withIntlConfiguration';
Expand Down
11 changes: 11 additions & 0 deletions src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
/* eslint-disable import/no-extraneous-dependencies */
declare module '*.css';

// see STTYPES-9 to understand why this is necessary
declare module '@folio/jest-config-stripes/testing-library/react' {
export { default } from '@testing-library/react';
export * from '@testing-library/react';
}
declare module '@folio/jest-config-stripes/testing-library/user-event' {
export { default } from '@testing-library/user-event';
export * from '@testing-library/user-event';
}
2 changes: 1 addition & 1 deletion src/views/MainPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@testing-library/react';
import { render, screen } from '@folio/jest-config-stripes/testing-library/react';
import React from 'react';
import MainPage from './MainPage';

Expand Down
File renamed without changes.

0 comments on commit 1f177fd

Please sign in to comment.