Skip to content

Commit 94275a6

Browse files
committed
fix: test
1 parent 24d5333 commit 94275a6

File tree

5 files changed

+17
-24
lines changed

5 files changed

+17
-24
lines changed

README.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
1-
# typescript-swc-starter
1+
# typescript-react-lib-swc
22

3-
A simple node boilerplate made in typescript using swc.
4-
5-
> NOTE : A version without rust compiler [swc](https://swc.rs/) is available [here](https://github.com/maxgfr/boilerplate-typescript-node).
3+
A simple react boilerplate made in typescript using swc.
64

75
## Clone repository and install dependencies
86

97
```sh
10-
git clone https://github.com/maxgfr/typescript-swc-starter # For cloning the repository
11-
cd typescript-swc-starter # To navigate to the repository root
8+
git clone https://github.com/maxgfr/typescript-react-lib-swc # For cloning the repository
9+
cd typescript-react-lib-swc # To navigate to the repository root
1210
yarn # Install dependencies
13-
cp .env.example .env
1411
```
1512

16-
## Running the code
13+
## Building the code
1714

1815
```sh
1916
yarn build # For building the code with typechecking
2017
yarn build:swc # For building without typechecking
21-
yarn start # For running the code builded
22-
```
23-
24-
Or in `development` mode:
25-
26-
```sh
27-
yarn dev # For running the code in development thanks to swc and nodemon
2818
```
2919

3020
> **:warning: No typechecking made in dev mode**

nodemon.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"watch": ["src"],
3-
"ext": "ts,json",
3+
"ext": "ts,json,tsx,js,jsx",
44
"ignore": ["src/**/*.spec.{ts,tsx}", "src/**/*.test.{tsx,ts}"],
55
"exec": "yarn develop"
66
}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"swc"
2323
],
2424
"scripts": {
25-
"start": "node build/index.js",
2625
"dev": "nodemon",
2726
"develop": "node -r @swc-node/register ./src/index.ts",
2827
"test": "jest",
@@ -32,8 +31,8 @@
3231
"build:watch": "tsc -w -p tsconfig.build.json",
3332
"build:swc": "swc ./src -d build",
3433
"build:swc:watch": "swc ./src -d build -w",
35-
"lint": "eslint ./src --ext .ts",
36-
"prettier": "prettier --write './src/**/*.{ts,js,json}'",
34+
"lint": "eslint ./src --ext .ts,.tsx",
35+
"prettier": "prettier --write './src/**/*.{ts,js,json,tsx,jsx}'",
3736
"storybook:start": "start-storybook -p 6006",
3837
"storybook:build": "build-storybook",
3938
"storybook:deploy": "npm run storybook:build && gh-pages -d storybook-static",

src/__tests__/Input.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { render, screen } from '@testing-library/react';
2+
import { render, screen, fireEvent } from '@testing-library/react';
33
import userEvent from '@testing-library/user-event';
44
import { Input } from '../Input';
55

@@ -11,10 +11,9 @@ describe('<Input />', () => {
1111
test('Input writing', () => {
1212
render(<Input />);
1313
const input = screen.getByLabelText(/enter a value/i);
14-
userEvent.type(input, 'résultat');
15-
console.log(input);
14+
fireEvent.change(input, { target: { value: 'résultat' } });
1615
expect(input).toHaveValue('résultat');
1716
const result = screen.getByTestId('input-result');
18-
expect(result).toBe('Input result : résultat!');
17+
expect(result).toHaveTextContent('Input result : résultat!');
1918
});
2019
});

tsconfig.build.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
22
"extends": "./tsconfig.json",
3-
"exclude": ["src/**/*.spec.tsx", "src/**/*.test.tsx"]
3+
"exclude": [
4+
"src/**/*.spec.tsx",
5+
"src/**/*.test.tsx",
6+
"src/**/*.spec.ts",
7+
"src/**/*.test.ts"
8+
]
49
}

0 commit comments

Comments
 (0)