Skip to content

Commit d1049e6

Browse files
committed
update
1 parent 447d52a commit d1049e6

File tree

132 files changed

+3072
-8095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3072
-8095
lines changed

Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
FROM hexletbasics/base-image
22

3-
ENV NODE_PATH /exercises-pre-course-javascript/src
4-
ENV PATH=/exercises-pre-course-javascript/bin:$PATH
3+
ENV NODE_PATH=/exercises-pre-course-javascript/src
4+
ENV PATH=/exercises-pre-course-javascript/bin:/exercises-pre-course-javascript/node_modules/.bin:$PATH
55

66
WORKDIR /exercises-pre-course-javascript
77

8-
RUN npm i -g vitest
98
COPY package.json package-lock.json ./
109
RUN npm ci
1110

Makefile

+8-5
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,26 @@ compose:
88
compose-build:
99
docker-compose build
1010

11+
compose-down:
12+
docker-compose down -v --remove-orphans
13+
1114
compose-install:
12-
docker-compose run exercises npm ci
15+
docker-compose run --rm exercises npm ci
1316

1417
code-lint:
1518
npx eslint modules
1619

1720
compose-bash:
18-
docker-compose run exercises bash
21+
docker-compose run --rm exercises bash
1922

2023
compose-test:
21-
docker-compose run exercises make test
24+
docker-compose run --rm exercises make test
2225

2326
compose-description-lint:
24-
docker-compose run exercises make description-lint
27+
docker-compose run --rm exercises make description-lint
2528

2629
compose-schema-validate:
27-
docker-compose run exercises make schema-validate
30+
docker-compose run --rm exercises make schema-validate
2831

2932
ci-check:
3033
docker-compose --file docker-compose.yml build

bin/test.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
npx jest --colors `pwd`/test.js
2+
3+
FORCE_COLOR=1 vitest related --run `pwd`/test.js

bin/test2.sh

-3
This file was deleted.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

modules/10-basics/10-hello-world/test.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import { expect, test, vi } from 'vitest'
44

5-
const expected = 'Hello, World!';
6-
75
test('hello world', async () => {
86
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
97
await import('./index.js')
108

119
const firstArg = consoleLogSpy.mock.calls.join('\n');
1210

13-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('Hello, World!')
1412
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

modules/10-basics/20-comments/ru/data.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ tips:
55
[Подробнее о комментариях](https://www.w3schools.com/js/js_comments.asp)
66
definitions:
77
- name: Комментарий
8-
description: |
8+
description: >
99
текст в коде программы, который не влияет на функциональность и
1010
добавляется программистами для себя и своих коллег.
1111
1212
13-
```javascript
14-
// однострочный комментарий
13+
`// однострочный комментарий`
14+
15+
1516
```
1617
17-
```javascript
1818
/*
1919
многострочный комментарий
20+
многострочный комментарий
2021
*/
22+
2123
```
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

modules/10-basics/40-instructions/test.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import { expect, test, vi } from 'vitest'
44

5-
const expected = 'Robert\nStannis\nRenly';
6-
75
test('hello world', async () => {
86
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
97
await import('./index.js')
108

119
const firstArg = consoleLogSpy.mock.calls.join('\n');
1210

13-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('Robert\nStannis\nRenly')
1412
})

modules/10-basics/45-testing/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

modules/10-basics/45-testing/ru/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ Expected – ожидаемое значение, а Received, то которо
3232

3333
Иногда в процессе решения будет казаться, что вы сделали все правильно, но система "капризничает" и не принимает решение. Подобное поведение практически исключено. Нерабочие тесты просто не могут попасть на сайт, они автоматически запускаются после каждого изменения. В подавляющем большинстве таких случаев, (а все наши проекты в сумме провели миллионы проверок за много лет), ошибка содержится в коде решения. Она может быть очень незаметной, вместо английской буквы случайно ввели русскую, вместо верхнего регистра использовали нижний или забыли вывести запятую. Другие случаи сложнее. Возможно ваше решение работает для одного набора входных данных, но не работает для другого. Поэтому всегда внимательно читайте условие задачи и вывод тестов. Там почти наверняка есть указание на ошибку.
3434

35-
Однако, если вы уверены в ошибке или нашли какую-то неточность, то вы всегда можете указать на нее. В конце каждой теории есть ссылка на содержимое урока на гитхабе (этот проект полностью открытый!). Перейдя туда, вы можете написать issue, посмотреть содержимое тестов (там видно, как вызывается ваш код) и даже отправить pullrequest. Если для вас это пока темный лес, то подключитесь в наше сообщество [Telegram](https://t.me/hexletcommunity), там в канале *Обратная связь* мы всегда поможем.
35+
Однако, если вы уверены в ошибке или нашли какую-то неточность, то вы всегда можете указать на нее. В конце каждой теории есть ссылка на содержимое урока на гитхабе (этот проект полностью открытый!). Перейдя туда, вы можете написать issue, посмотреть содержимое тестов (там видно, как вызывается ваш код) и даже отправить pullrequest. Если для вас это пока темный лес, то подключитесь в наше сообщество [Telegram] (https://t.me/hexletcommunity), там в канале *Обратная связь* мы всегда поможем.

modules/10-basics/45-testing/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = '9780262531962';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('9780262531962')
1212
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = 'What Is Dead May Never Die';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('What Is Dead May Never Die')
1212
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

modules/20-arithmetics/20-basic/ru/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ console.log(3 + 4);
2727
- `*`: умножение
2828
- `/`: деление
2929
- `-`: вычитание
30-
- `%`: [остаток от деления](https://ru.wikipedia.org/wiki/Деление_с_остатком)
30+
- "%": [остаток от деления](https://ru.wikipedia.org/wiki/Деление_с_остатком)
3131
- `**`: возведение в степень
3232

3333
Теперь давайте выведем на экран результат деления, а потом результат возведения в степень:
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = '9';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('9')
1212
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = '87';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('87')
1212
})
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = '243\n2';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('243\n2')
1212
})
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = '10.5';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('10.5')
1212
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = '49';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('49')
1212
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

modules/20-arithmetics/50-float/ru/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ JavaScript не делает различий между рациональны
88
Но как бы от нас ни скрывали, рациональные числа, в силу своих особенностей, устроены совсем по-другому. Нам, как прикладным программистам, это было бы не особенно важно, если бы не одна деталь. Посмотрите на этот пример:
99

1010
```javascript
11-
// Проверьте этот код в консоли браузера
1211
0.2 * 0.2 // 0.04000000000000001
1312
```
1413

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = 0.39 * 0.22;
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

9-
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
9+
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('0.0858')
1212
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = Infinity;
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

9-
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
9+
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('Infinity')
1212
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

modules/20-arithmetics/70-nan/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = 'NaN';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('NaN')
1212
})
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = '4';
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe('4')
1212
})

modules/25-strings/10-quotes/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

modules/25-strings/10-quotes/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { expect, test, vi } from 'vitest'
1+
// @ts-check
22

3-
const expected = "\"Khal Drogo's favorite word is \"athjahakar\"\"";
3+
import { expect, test, vi } from 'vitest'
44

55
test('hello world', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
77
await import('./index.js')
88

99
const firstArg = consoleLogSpy.mock.calls.join('\n');
1010

11-
expect(firstArg).toBe(expected)
11+
expect(firstArg).toBe("\"Khal Drogo's favorite word is \"athjahakar\"\"")
1212
})
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test2.sh
2+
@ test.sh

0 commit comments

Comments
 (0)