Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

15 changes: 0 additions & 15 deletions .eslintrc.yml

This file was deleted.

14 changes: 9 additions & 5 deletions .github/workflows/nodeci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: Node CI

on:
- push
- pull_request
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: '14.x'
- name: Check node version
run: node -v
node-version: '26.x'
cache: 'npm'
- name: Install
run: make install
- name: Run linter
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test:
DEBUG=@hexlet/http-request npm test -s

lint:
npx eslint .
npx biome check .

publish:
npm publish --access public
Expand Down
22 changes: 13 additions & 9 deletions __tests__/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ describe('HexletHttpRequest', () => {
it('#get 1', () => {
const host = 'http://ru.hexlet.io';
const body = 'hello, world';
nock(host)
.get('/')
.reply(200, body);
nock(host).get('/').reply(200, body);

return expect(get(host)).resolves.toMatchObject({ data: body });
});
Expand Down Expand Up @@ -42,16 +40,19 @@ describe('HexletHttpRequest', () => {
const body = 'hello, world';
nock(host).get(pathname).reply(200, body);

return expect(get(`${host}${pathname}`)).resolves.toMatchObject({ data: body });
return expect(get(`${host}${pathname}`)).resolves.toMatchObject({
data: body,
});
});

it('#get 4', () => {
const host = 'http://ru.hexlet.io';
const pathname = '/users/new';
nock(host).get(pathname).replyWithError('timeout error');

return expect(get(`${host}${pathname}`)).rejects
.toMatchObject({ message: 'timeout error' });
return expect(get(`${host}${pathname}`)).rejects.toMatchObject({
message: 'timeout error',
});
});

it('#post', () => {
Expand All @@ -65,9 +66,12 @@ describe('HexletHttpRequest', () => {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': preparedData.length.toString(),
},
}).post(pathname, data).reply(status);
})
.post(pathname, data)
.reply(status);

return expect(post(`${host}${pathname}`, data)).resolves
.toMatchObject({ status });
return expect(post(`${host}${pathname}`, data)).resolves.toMatchObject({
status,
});
});
});
36 changes: 36 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "always"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}
Loading