Skip to content

Commit

Permalink
test files and prettify .
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyshulga1cs committed Mar 31, 2024
1 parent 05018f7 commit b555f70
Show file tree
Hide file tree
Showing 124 changed files with 4,041 additions and 4,090 deletions.
48 changes: 24 additions & 24 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-namespace": "off",
env: {
browser: true,
es2021: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-namespace": "off",
},
};
54 changes: 27 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,35 @@ jobs:
matrix:
node-version: [16.x]
steps:
- name: Set up GitHub Actions
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Сheck if the repository is private
if: ${{github.event.repository.private}}
run: exit 1
- name: Install testing libs
uses: mig4/setup-bats@v1
- name: Get testing lib
run: set -eu && git clone https://github.com/Yandex-Practicum/tests-middle-frontend.git /tmp/tests-middle-frontend
- name: Set up GitHub Actions
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Сheck if the repository is private
if: ${{github.event.repository.private}}
run: exit 1
- name: Install testing libs
uses: mig4/setup-bats@v1
- name: Get testing lib
run: set -eu && git clone https://github.com/Yandex-Practicum/tests-middle-frontend.git /tmp/tests-middle-frontend

- name: Run tests (sprint_1)
if: ${{github.head_ref >= 'sprint_1'}}
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/sprint_1.bats
- name: Run tests (sprint_1)
if: ${{github.head_ref >= 'sprint_1'}}
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/sprint_1.bats

- name: Run tests (sprint_2)
if: ${{github.head_ref >= 'sprint_2'}}
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/sprint_2.bats
- name: Run tests (sprint_2)
if: ${{github.head_ref >= 'sprint_2'}}
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/sprint_2.bats

- name: Run tests (sprint_3)
if: ${{github.head_ref >= 'sprint_3'}}
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/sprint_3.bats
- name: Run tests (sprint_3)
if: ${{github.head_ref >= 'sprint_3'}}
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/sprint_3.bats

- name: Run tests (sprint_4)
if: ${{github.head_ref >= 'sprint_4'}}
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/sprint_4.bats
- name: Run tests (sprint_4)
if: ${{github.head_ref >= 'sprint_4'}}
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/sprint_4.bats

- name: Run tests (server)
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/node_build.bats
- name: Run tests (server)
run: bats --formatter pretty /tmp/tests-middle-frontend/tests/node_build.bats
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run test && npm run lint
6 changes: 3 additions & 3 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extension": ["ts"],
"spec": "src/**/*.test.ts",
"require": ["./mochaSetup.js"]
"extension": ["ts"],
"spec": "test/**/*.test.ts",
"require": ["./mochaSetup.js"]
}
2 changes: 1 addition & 1 deletion .stylelintcache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\account\\components\\AccountPhoto\\styles.scss":"1"},{"size":925,"mtime":1710782243881,"hashOfConfig":"2"},"1v6j01t"]
[{"C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\account\\components\\AccountPhoto\\styles.scss":"1"},{"size":749,"mtime":1711892640682,"hashOfConfig":"2"},"17kz3jp"]
15 changes: 9 additions & 6 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"extends": "stylelint-config-standard-scss",
"rules": {
"selector-class-pattern": [".", {
"resolveNestedSelectors": true
}]
}
"extends": "stylelint-config-standard-scss",
"rules": {
"selector-class-pattern": [
".",
{
"resolveNestedSelectors": true
}
]
}
}
2 changes: 1 addition & 1 deletion .vite/deps/_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"browserHash": "48340304",
"optimized": {},
"chunks": {}
}
}
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ https://github.com/site-for-design/middle.messenger.praktikum.yandex

## Страницы

- [Login Page](https://yaproject2.netlify.app),
- [Registration Page](https://yaproject2.netlify.app/registration),
- [Messenger Page](https://yaproject2.netlify.app/messenger),
- [Settings Page](https://yaproject2.netlify.app/settings),
- [404 Page](https://yaproject2.netlify.app/smth),
- [500 Page](https://yaproject2.netlify.app/error500),
- [Login Page](https://yaproject2.netlify.app),
- [Registration Page](https://yaproject2.netlify.app/registration),
- [Messenger Page](https://yaproject2.netlify.app/messenger),
- [Settings Page](https://yaproject2.netlify.app/settings),
- [404 Page](https://yaproject2.netlify.app/smth),
- [500 Page](https://yaproject2.netlify.app/error500),

## Установка

- `npm run start` — запуск сборки и превью.
- `npm run dev` — запуск проекта в режиме разработки.
- `npm run build` — запуск сборки.
- `npm run preview` — запуск просмотра сборки.
- `npm run start` — запуск сборки и превью.
- `npm run dev` — запуск проекта в режиме разработки.
- `npm run build` — запуск сборки.
- `npm run preview` — запуск просмотра сборки.
6 changes: 2 additions & 4 deletions mochaImports.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import { register } from "node:module";
import { pathToFileURL } from "node:url";

console.log(3);

register("ts-node/esm", pathToFileURL("./"));

register("esmock", pathToFileURL("./"));
register("node-esm-loader", pathToFileURL("./"));
// register("esmock", pathToFileURL("./"));
// register("node-esm-loader", pathToFileURL("./"));
14 changes: 8 additions & 6 deletions mochaSetup.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { JSDOM } from "jsdom";

const jsdom = new JSDOM("<body></body>", {
url: "https://example.org",
});
const dom = new JSDOM(
"<!DOCTYPE html><html><head></head><body id='app'></body></html>",
{
url: "http://localhost",
},
);

global.window = jsdom.window;
global.document = jsdom.document;
global.FormData = jsdom.window.FormData;
global.window = dom.window;
global.document = dom.window.document;
// (global.HTTPTransport as typeof HTTPTransport) = HTTPTransport;
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@
"test": "node --trace-deprecation --import ./mochaImports.js ./node_modules/mocha/bin/mocha",
"preview": "vite preview",
"lint": "prettier --check .",
"format": "prettier --write ."
},
"husky": {
"hooks": {
"pre-commit": "echo \"[Husky] post-applypatch\""
}
"format": "prettier --write .",
"prepare": "husky"
},
"devDependencies": {
"@types/chai": "^4.3.14",
"@types/jsdom": "^21.1.6",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.28",
"@types/sinon": "^17.0.3",
"@types/sinon-chai": "^3.2.12",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
Expand All @@ -36,9 +33,11 @@
"jsdom": "^24.0.0",
"mocha": "^10.3.0",
"node-esm-loader": "^0.3.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"sass": "^1.71.1",
"sinon": "^17.0.1",
"sinon-chai": "^3.7.0",
"stylelint": "^16.2.1",
"stylelint-config-standard": "^36.0.0",
"stylelint-config-standard-scss": "^13.0.0",
Expand All @@ -48,7 +47,6 @@
},
"dependencies": {
"express": "^4.18.2",
"sinon-chai": "^3.7.0",
"uuid": "^9.0.1",
"vite-express": "^0.15.0",
"vite-plugin-eslint": "^1.8.1",
Expand Down
6 changes: 3 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ const app = express();
const PORT = 3000;

app.listen(PORT, function (err) {
if (err) console.log("Error in server setup");
console.log("Server listening on Port", PORT);
if (err) console.log("Error in server setup");
console.log("Server listening on Port", PORT);
});

app.use("/assets", express.static(__dirname + "/dist/assets"));
app.use("/img", express.static(__dirname + "/dist/img"));
app.use("/scss", express.static(__dirname + "/dist/scss"));

app.get("*", function (_, res) {
res.sendFile("dist/index.html", { root: __dirname });
res.sendFile("dist/index.html", { root: __dirname });
});
Loading

0 comments on commit b555f70

Please sign in to comment.