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
4 changes: 3 additions & 1 deletion modules/10-basics/10-hello-world/test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// @ts-check

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

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

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

expect(firstArg).toBe('Hello, World!')
})
2 changes: 1 addition & 1 deletion modules/10-basics/20-comments/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
2 changes: 1 addition & 1 deletion modules/10-basics/40-instructions/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
12 changes: 9 additions & 3 deletions modules/10-basics/40-instructions/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// @ts-check

import { expectOutput } from 'hexlet-basics/tests';
import { expect, test, vi } from 'vitest'

const expected = 'Robert\nStannis\nRenly';
expectOutput(expected);
test('hello world', async () => {
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
await import('./index.js')

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

expect(firstArg).toBe('Robert\nStannis\nRenly')
})
2 changes: 1 addition & 1 deletion modules/10-basics/45-testing/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/10-basics/45-testing/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '9780262531962';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('9780262531962')
})
2 changes: 1 addition & 1 deletion modules/10-basics/50-syntax-errors/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/10-basics/50-syntax-errors/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = 'What Is Dead May Never Die';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('What Is Dead May Never Die')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/20-basic/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/20-basic/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '9';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('9')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/25-operator/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/25-operator/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '87';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('87')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/27-commutativity/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/27-commutativity/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '243\n2';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('243\n2')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/30-composition/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/30-composition/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '10.5';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('10.5')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/40-priority/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/40-priority/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '49';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('49')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/50-float/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/50-float/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = 0.39 * 0.22;
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('0.0858')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/60-infinity/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/60-infinity/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = Infinity;
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('Infinity')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/70-nan/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/70-nan/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = 'NaN';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('NaN')
})
2 changes: 1 addition & 1 deletion modules/20-arithmetics/80-linting/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/20-arithmetics/80-linting/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '4';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('4')
})
2 changes: 1 addition & 1 deletion modules/25-strings/10-quotes/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/25-strings/10-quotes/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = "\"Khal Drogo's favorite word is \"athjahakar\"\"";
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe("\"Khal Drogo's favorite word is \"athjahakar\"\"")
})
2 changes: 1 addition & 1 deletion modules/25-strings/15-escape-characters/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/25-strings/15-escape-characters/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '- Did Joffrey agree?\n- He did. He also said "I love using \\n".';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('- Did Joffrey agree?\n- He did. He also said "I love using \\n".')
})
2 changes: 1 addition & 1 deletion modules/25-strings/20-string-concatenation/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/25-strings/20-string-concatenation/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = 'Winter came for the House of Frey.';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('Winter came for the House of Frey.')
})
2 changes: 1 addition & 1 deletion modules/25-strings/30-encoding/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/25-strings/30-encoding/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = '~\n^\n%';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('~\n^\n%')
})
2 changes: 1 addition & 1 deletion modules/30-variables/10-definition/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/30-variables/10-definition/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = 'What Is Dead May Never Die!';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('What Is Dead May Never Die!')
})
2 changes: 1 addition & 1 deletion modules/30-variables/11-change/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/30-variables/11-change/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = 'anneirB';
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('anneirB')
})
2 changes: 1 addition & 1 deletion modules/30-variables/13-variables-naming/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test:
@ test-output.sh
@ test2.sh
14 changes: 11 additions & 3 deletions modules/30-variables/13-variables-naming/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { expectOutput } from 'hexlet-basics/tests';
// @ts-check

const expected = 2;
expectOutput(expected);
import { expect, test, vi } from 'vitest'

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

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

expect(firstArg).toBe('2')
})
Loading