Skip to content

Commit a0239f4

Browse files
committed
переезд на Vite
1 parent 07e58a0 commit a0239f4

File tree

12 files changed

+12036
-13987
lines changed

12 files changed

+12036
-13987
lines changed

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": [
3+
"react-app",
4+
"react-app/jest"
5+
]
6+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/node_modules
2+
/src/__image_snapshots__/__diff_output__
3+
.DS_STORE

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
npm install
77
```
88

9-
В файле `src/App.css` опишите стили для вёрстки из файла `src/index.html`
9+
В файле `src/App.css` опишите стили для вёрстки из файла `index.html`
1010

1111
1. Файл `src/index.html` редактировать нельзя
1212
2. Контейнер должен быть шириной `700px` и высотой `300px`
@@ -19,6 +19,6 @@ npm install
1919

2020
Итоговый вариант будет выглядеть вот так: ![](./src/__image_snapshots__/app-test-ts-flexbox-рисуется-нужное-изображение-1-snap.png)
2121

22-
Проверить себя можно запустив команду `npm run test -- --watchAll`.
22+
Проверить себя можно запустив команду `npm run test`.
2323

2424
После выполнения задания создайте pull request с решением.

src/index.html renamed to index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<title>Flex</title>
5-
<link rel="stylesheet" type="text/css" href="App.css" />
5+
<link rel="stylesheet" type="text/css" href="./src/App.css" />
66
</head>
77
<body>
88
<section class="flex-container">

package-lock.json

Lines changed: 11968 additions & 13950 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,35 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@types/jest": "^26.0.15",
7-
"@types/node": "^12.0.0",
8-
"@types/react": "^17.0.0",
9-
"@types/react-dom": "^17.0.0",
10-
"jest-image-snapshot": "^4.5.1",
11-
"puppeteer": "^10.4.0",
12-
"react": "^17.0.2",
13-
"react-dom": "^17.0.2",
14-
"react-scripts": "4.0.3",
15-
"typescript": "^4.1.2"
6+
"@testing-library/react": "^14.2.1",
7+
"@types/jest": "^29.5.12",
8+
"@types/jest-image-snapshot": "^6.4.0",
9+
"@types/node": "^20.11.25",
10+
"@types/puppeteer": "^5.4.7",
11+
"@types/react": "^18.2.64",
12+
"@types/react-dom": "^18.2.21",
13+
"@vitejs/plugin-react": "^4.2.1",
14+
"eslint": "^8.57.0",
15+
"eslint-config-react-app": "^7.0.1",
16+
"husky": "^9.0.11",
17+
"jest": "^29.7.0",
18+
"jest-image-snapshot": "^6.4.0",
19+
"prettier": "^3.2.5",
20+
"pretty-quick": "^4.0.0",
21+
"puppeteer": "^22.4.1",
22+
"react": "^18.2.0",
23+
"react-dom": "^18.2.0",
24+
"ts-jest": "^29.1.2",
25+
"typescript": "^5.4.2",
26+
"vite": "^5.1.5",
27+
"vite-plugin-eslint": "^1.8.1",
28+
"vite-tsconfig-paths": "^4.3.1"
1629
},
1730
"scripts": {
18-
"test": "react-scripts test",
19-
"lint": "eslint ./src",
20-
"prepare": "husky install"
21-
},
22-
"eslintConfig": {
23-
"extends": [
24-
"react-app",
25-
"react-app/jest"
26-
]
31+
"start": "vite",
32+
"build": "tsc && vite build",
33+
"preview": "vite preview",
34+
"test": "jest --watchAll"
2735
},
2836
"browserslist": {
2937
"production": [
@@ -37,11 +45,14 @@
3745
"last 1 safari version"
3846
]
3947
},
40-
"devDependencies": {
41-
"@types/jest-image-snapshot": "^4.3.1",
42-
"@types/puppeteer": "^5.4.4",
43-
"husky": "^7.0.0",
44-
"prettier": "^2.4.1",
45-
"pretty-quick": "^3.1.1"
48+
"jest": {
49+
"preset": "ts-jest/presets/js-with-ts",
50+
"moduleNameMapper": {
51+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
52+
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
53+
},
54+
"modulePaths": [
55+
"<rootDir>/src"
56+
]
4657
}
4758
}

src/App.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ const customConfig = { threshold: 0 };
66
const toMatchImageSnapshot = configureToMatchImageSnapshot({
77
customDiffConfig: customConfig,
88
noColors: true,
9-
failureThreshold: 0.08,
10-
failureThresholdType: 'percent'
119
});
1210
expect.extend({ toMatchImageSnapshot });
1311

@@ -27,7 +25,7 @@ describe('Flexbox', () => {
2725
let page: Page;
2826
beforeEach(async () => {
2927
page = await browser.newPage();
30-
await page.goto(`file:${path.join(__dirname, 'index.html')}`);
28+
await page.goto(`file:${path.join(__dirname, '/..', 'index.html')}`);
3129
});
3230

3331
it('Верстка не тронута', async () => {

src/__snapshots__/App.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`Flexbox Верстка не тронута 1`] = `
44
"
5-
<section class=\\"flex-container\\">
5+
<section class="flex-container">
66
<div></div>
77
<div></div>
88
<div></div>

src/react-app-env.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

0 commit comments

Comments
 (0)