Skip to content

Commit

Permalink
replace ts-jest and babel-jest to swc/jest
Browse files Browse the repository at this point in the history
  • Loading branch information
akellbl4 committed Apr 12, 2022
1 parent 5ed9e9d commit ca45ef8
Show file tree
Hide file tree
Showing 15 changed files with 497 additions and 22 deletions.
1 change: 0 additions & 1 deletion frontend/app/components/auth-panel/auth-panel.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'preact';
import { mount } from 'enzyme';
import createMockStore from 'redux-mock-store';
import { Middleware } from 'redux';
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/auth/auth.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@testing-library/jest-dom';
import { h } from 'preact';

import { fireEvent, waitFor, screen } from '@testing-library/preact';
import { render } from 'tests/utils';

Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/auth/components/oauth.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'preact';
import { render } from 'tests/utils';
import { BASE_URL } from 'common/constants.config';

Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/avatar/avatar.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '@testing-library/jest-dom';
import { h } from 'preact';
import { render } from '@testing-library/preact';

import { Avatar } from './avatar';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'preact';
import { mount } from 'enzyme';
import { act } from 'preact/test-utils';
import { Provider } from 'react-redux';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'preact';
import { shallow } from 'enzyme';

import { SubscribeByRSS, createSubscribeUrl } from '.';
Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/comment-form/comment-form.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'preact';
import { shallow } from 'enzyme';

import { user, anonymousUser } from '__stubs__/user';
Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/comment/comment.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'preact';
import { mount } from 'enzyme';

jest.mock('react-intl', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'preact';
import '@testing-library/jest-dom';
import { render } from 'tests/utils';
import { Counter } from '.';
Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/profile/profile.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from 'preact';
import '@testing-library/jest-dom';
import { waitFor } from '@testing-library/preact';
import { fireEvent } from '@testing-library/dom';
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/select/select.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@testing-library/jest-dom';
import { fireEvent } from '@testing-library/preact';
import { h } from 'preact';

import { render } from 'tests/utils';
import { Select } from './select';

Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/sort-picker.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '@testing-library/jest-dom';
import { fireEvent, waitFor } from '@testing-library/preact';
import { h } from 'preact';

import { render } from 'tests/utils';
import * as commentsActions from 'store/comments/actions';
Expand Down
27 changes: 20 additions & 7 deletions frontend/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
const fs = require('fs');
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.jsx?$': 'babel-jest',
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: false,
},
target: 'es2016',
transform: {
react: {
runtime: 'automatic',
importSource: 'preact',
},
},
},
},
],
},
moduleDirectories: ['node_modules', 'app'],
moduleNameMapper: {
Expand Down Expand Up @@ -32,9 +50,4 @@ module.exports = {
'!app/utils/loadLocale.ts',
'!app/tests',
],
globals: {
'ts-jest': {
babelConfig: true,
},
},
};
Loading

0 comments on commit ca45ef8

Please sign in to comment.