Skip to content

Commit 10158ea

Browse files
authored
Merge pull request #12 from ilyasudakov/develop
Fix Jest and Prettier issues w/ TypeScript project
2 parents 06e59bb + 4d7a326 commit 10158ea

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ node_modules/
55
internals/generators/
66
bin/typescript/
77
package-lock.json
8-
package.json
8+
package.json
9+
src/setupTests.ts

bin/setup.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,9 @@ function copyTypeScriptFiles() {
125125
shell.cp('bin/typescript/webpack.prod.ts', 'webpack.prod.ts');
126126
shell.cp('bin/typescript/.eslintrc.js', '.eslintrc.js');
127127
shell.cp('bin/typescript/App.tsx', 'src/components/App.tsx');
128-
shell.cp('bin/typescript/App.test.js', 'src/components/App.test.js');
129-
shell.cp(
130-
'bin/typescript/jest.config.js',
131-
'jest.config.js',
132-
);
128+
shell.cp('bin/typescript/App.test.tsx', 'src/components/App.test.tsx');
129+
shell.cp('bin/typescript/jest.config.js', 'jest.config.js');
130+
shell.cp('bin/typescript/setupTests.ts', 'src/setupTests.ts');
133131
shell.cp('bin/typescript/index.tsx', 'src/index.tsx');
134132
resolve();
135133
} catch (err) {
@@ -143,6 +141,8 @@ function removeOldWebpackConfigs() {
143141
try {
144142
shell.rm('-rf', 'webpack.config.js');
145143
shell.rm('-rf', 'src/components/App.jsx');
144+
shell.rm('-rf', 'src/components/App.test.js');
145+
shell.rm('-rf', 'src/setupTests.js');
146146
shell.rm('-rf', 'src/index.js');
147147
resolve();
148148
} catch (err) {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render } from '@testing-library/react';
2-
import { App } from './App.tsx';
2+
import { App } from './App';
33

44
describe('App component', () => {
55
test('renders', () => {
66
const { getByText } = render(<App />);
7-
expect(getByText('App')).toBeInTheDocument();
7+
expect(getByText('MyApp')).toBeInTheDocument();
88
});
99
});

bin/typescript/jest.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,5 @@ module.exports = {
66
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
77
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
88
testPathIgnorePatterns: ['/node_modules/', '/public/'],
9-
setupFilesAfterEnv: [
10-
'./src/setupTests.js',
11-
'@testing-library/jest-dom/extend-expect',
12-
],
9+
setupFilesAfterEnv: ['./src/setupTests.ts'],
1310
};

bin/typescript/setupTests.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@testing-library/jest-dom/extend-expect';

readme.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ You can run commands bellow manually, or they will run automatically with pre-co
5656

5757
## Future Features
5858

59-
### In Testing
60-
61-
- TypeScript
62-
6359
### Maybe?
6460

6561
- React DnD

0 commit comments

Comments
 (0)