Skip to content

Commit 18859bc

Browse files
committed
init using vitest
Signed-off-by: Kirill Mokevnin <mokevnin@gmail.com>
1 parent cf1352d commit 18859bc

File tree

11 files changed

+9271
-11846
lines changed

11 files changed

+9271
-11846
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
FROM hexletbasics/base-image
22

3-
ENV NODE_PATH /exercises-javascript/src
3+
ENV NODE_PATH=/exercises-javascript/src
44
ENV PATH=/exercises-javascript/bin:$PATH
55

66
WORKDIR /exercises-javascript
77

8+
RUN npm i -g vitest
89
COPY package.json package-lock.json ./
910
RUN npm ci
1011

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ compose-schema-validate:
2929
ci-check:
3030
docker-compose --file docker-compose.yml build
3131
docker-compose --file docker-compose.yml up --abort-on-container-exit
32+
33+
docker-build-original:
34+
docker buildx build -t hexletbasics/exercises-javascript .

bin/test2.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FORCE_COLOR=1 vitest related --run `pwd`/test.js
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test-output.sh
2+
@ test2.sh
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
// @ts-check
1+
import { expect, test, vi } from 'vitest'
22

3-
import { expectOutput } from 'hexlet-basics/tests';
3+
test('hello world', async () => {
4+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
5+
// @ts-ignore
6+
await import('./index.js')
47

5-
const expected = 'Hello, World!';
6-
expectOutput(expected);
8+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
9+
10+
expect(firstArg).toBe('Hello, World!')
11+
})

modules/50-loops/70-for/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
@ test.sh
2+
@ test2.sh

modules/50-loops/70-for/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '@jest/globals';
1+
import { expect, test } from 'vitest'
22
import f from './index.js';
33

44
test('test', () => {

0 commit comments

Comments
 (0)