From 8408336fa6da1e9f17a6361e59b0720c86bd2da4 Mon Sep 17 00:00:00 2001 From: Ivan Gagarinov Date: Thu, 27 Feb 2025 23:47:05 +0500 Subject: [PATCH 1/2] update tests --- modules/10-basics/10-hello-world/test.js | 2 ++ modules/10-basics/40-instructions/test.js | 12 +++++++++--- modules/10-basics/45-testing/test.js | 14 +++++++++++--- modules/10-basics/50-syntax-errors/test.js | 14 +++++++++++--- modules/20-arithmetics/20-basic/test.js | 14 +++++++++++--- modules/20-arithmetics/25-operator/test.js | 14 +++++++++++--- modules/20-arithmetics/27-commutativity/test.js | 14 +++++++++++--- modules/20-arithmetics/30-composition/test.js | 14 +++++++++++--- modules/20-arithmetics/40-priority/test.js | 14 +++++++++++--- modules/20-arithmetics/50-float/test.js | 14 +++++++++++--- modules/20-arithmetics/60-infinity/test.js | 14 +++++++++++--- modules/20-arithmetics/70-nan/test.js | 14 +++++++++++--- modules/20-arithmetics/80-linting/test.js | 14 +++++++++++--- modules/25-strings/10-quotes/test.js | 14 +++++++++++--- modules/25-strings/15-escape-characters/test.js | 14 +++++++++++--- .../25-strings/20-string-concatenation/test.js | 14 +++++++++++--- modules/25-strings/30-encoding/test.js | 14 +++++++++++--- modules/30-variables/10-definition/test.js | 14 +++++++++++--- modules/30-variables/11-change/test.js | 14 +++++++++++--- modules/30-variables/13-variables-naming/test.js | 14 +++++++++++--- modules/30-variables/14-errors/test.js | 14 +++++++++++--- .../30-variables/15-variables-expressions/test.js | 14 +++++++++++--- .../18-variable-concatenation/test.js | 14 +++++++++++--- modules/30-variables/19-naming-style/test.js | 14 +++++++++++--- modules/30-variables/20-magic-numbers/test.js | 14 +++++++++++--- modules/30-variables/23-constants/test.js | 14 +++++++++++--- modules/30-variables/25-interpolation/test.js | 14 +++++++++++--- modules/30-variables/30-symbols/test.js | 14 +++++++++++--- .../33-data-types/10-primitive-data-types/test.js | 14 +++++++++++--- modules/33-data-types/45-undefined/test.js | 13 ++++++++++++- .../47-data-types-immutability/test.js | 14 +++++++++++--- .../50-data-types-weak-typing/test.js | 14 +++++++++++--- modules/35-calling-functions/100-call/test.js | 14 +++++++++++--- modules/35-calling-functions/110-math/test.js | 14 +++++++++++--- .../120-function-signature/test.js | 14 +++++++++++--- .../test.js | 14 +++++++++++--- .../150-calling-functions-expression/test.js | 14 +++++++++++--- .../180-variadic-parameters/test.js | 14 +++++++++++--- .../270-deterministic/test.js | 15 ++++++++++----- modules/35-calling-functions/350-stdlib/test.js | 14 +++++++++++--- .../38-properties/100-properties-syntax/test.js | 14 +++++++++++--- .../38-properties/200-properties-methods/test.js | 14 +++++++++++--- .../300-properties-immutability/test.js | 14 +++++++++++--- .../400-properties-expressions/test.js | 14 +++++++++++--- .../500-properties-chain-of-methods/test.js | 14 +++++++++++--- .../100-define-functions-syntax/test.js | 14 +++++++++++--- .../150-define-functions-return/test.js | 2 +- .../320-define-functions-parameters/test.js | 2 +- .../test.js | 2 +- .../450-define-functions-short-syntax/test.js | 2 +- modules/45-logic/10-bool-type/test.js | 2 +- modules/45-logic/15-predicates/test.js | 2 +- .../45-logic/20-logic-combine-expressions/test.js | 2 +- modules/45-logic/25-logical-operators/test.js | 2 +- modules/45-logic/28-logical-negation/test.js | 2 +- modules/45-logic/70-logical-expressions/test.js | 2 +- modules/48-conditionals/30-if/test.js | 2 +- modules/48-conditionals/40-if-else/test.js | 2 +- modules/48-conditionals/50-else-if/test.js | 2 +- .../48-conditionals/60-ternary-operator/test.js | 2 +- modules/48-conditionals/65-switch/test.js | 2 +- modules/50-loops/10-while/test.js | 15 ++++++++++++--- modules/50-loops/20-aggregation-numbers/test.js | 2 +- modules/50-loops/23-aggregation-strings/test.js | 2 +- modules/50-loops/25-iteration-over-string/test.js | 15 ++++++++++++--- .../50-loops/26-conditions-inside-loops/test.js | 2 +- modules/50-loops/28-build-strings/test.js | 2 +- modules/50-loops/30-syntax-sugar/test.js | 2 +- modules/50-loops/50-mutators/test.js | 2 +- modules/50-loops/55-return-from-loops/test.js | 2 +- src/tests.js | 2 +- vitest.config.js | 2 +- 72 files changed, 543 insertions(+), 165 deletions(-) diff --git a/modules/10-basics/10-hello-world/test.js b/modules/10-basics/10-hello-world/test.js index de2521d9..706cc31e 100644 --- a/modules/10-basics/10-hello-world/test.js +++ b/modules/10-basics/10-hello-world/test.js @@ -1,3 +1,5 @@ +// @ts-check + import { expect, test, vi } from 'vitest' test('hello world', async () => { diff --git a/modules/10-basics/40-instructions/test.js b/modules/10-basics/40-instructions/test.js index 4f84cd39..f2ad5618 100644 --- a/modules/10-basics/40-instructions/test.js +++ b/modules/10-basics/40-instructions/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('Robert\nStannis\nRenly') +}) diff --git a/modules/10-basics/45-testing/test.js b/modules/10-basics/45-testing/test.js index f5ae5628..62760fef 100644 --- a/modules/10-basics/45-testing/test.js +++ b/modules/10-basics/45-testing/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('9780262531962') +}) diff --git a/modules/10-basics/50-syntax-errors/test.js b/modules/10-basics/50-syntax-errors/test.js index 619a8ad3..1a1026c2 100644 --- a/modules/10-basics/50-syntax-errors/test.js +++ b/modules/10-basics/50-syntax-errors/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('What Is Dead May Never Die') +}) diff --git a/modules/20-arithmetics/20-basic/test.js b/modules/20-arithmetics/20-basic/test.js index 381cdf63..476d9108 100644 --- a/modules/20-arithmetics/20-basic/test.js +++ b/modules/20-arithmetics/20-basic/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('9') +}) diff --git a/modules/20-arithmetics/25-operator/test.js b/modules/20-arithmetics/25-operator/test.js index 2a501d98..e5b232e3 100644 --- a/modules/20-arithmetics/25-operator/test.js +++ b/modules/20-arithmetics/25-operator/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('87') +}) diff --git a/modules/20-arithmetics/27-commutativity/test.js b/modules/20-arithmetics/27-commutativity/test.js index 878ca2a4..3b09b371 100644 --- a/modules/20-arithmetics/27-commutativity/test.js +++ b/modules/20-arithmetics/27-commutativity/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('243\n2') +}) diff --git a/modules/20-arithmetics/30-composition/test.js b/modules/20-arithmetics/30-composition/test.js index d9a875ff..92ea50de 100644 --- a/modules/20-arithmetics/30-composition/test.js +++ b/modules/20-arithmetics/30-composition/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('10.5') +}) diff --git a/modules/20-arithmetics/40-priority/test.js b/modules/20-arithmetics/40-priority/test.js index c492b7d8..b1113dd3 100644 --- a/modules/20-arithmetics/40-priority/test.js +++ b/modules/20-arithmetics/40-priority/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('49') +}) diff --git a/modules/20-arithmetics/50-float/test.js b/modules/20-arithmetics/50-float/test.js index aa62c30b..58864076 100644 --- a/modules/20-arithmetics/50-float/test.js +++ b/modules/20-arithmetics/50-float/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('0.39 * 0.22') +}) diff --git a/modules/20-arithmetics/60-infinity/test.js b/modules/20-arithmetics/60-infinity/test.js index 40ea4f4c..7c2b759f 100644 --- a/modules/20-arithmetics/60-infinity/test.js +++ b/modules/20-arithmetics/60-infinity/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe(Infinity) +}) diff --git a/modules/20-arithmetics/70-nan/test.js b/modules/20-arithmetics/70-nan/test.js index d8c80665..033de3ef 100644 --- a/modules/20-arithmetics/70-nan/test.js +++ b/modules/20-arithmetics/70-nan/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('NaN') +}) diff --git a/modules/20-arithmetics/80-linting/test.js b/modules/20-arithmetics/80-linting/test.js index 966127c3..30cf0320 100644 --- a/modules/20-arithmetics/80-linting/test.js +++ b/modules/20-arithmetics/80-linting/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('4') +}) diff --git a/modules/25-strings/10-quotes/test.js b/modules/25-strings/10-quotes/test.js index db6228d6..9c033793 100644 --- a/modules/25-strings/10-quotes/test.js +++ b/modules/25-strings/10-quotes/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe("\"Khal Drogo's favorite word is \"athjahakar\"\"") +}) diff --git a/modules/25-strings/15-escape-characters/test.js b/modules/25-strings/15-escape-characters/test.js index 0a14103b..f82d86d6 100644 --- a/modules/25-strings/15-escape-characters/test.js +++ b/modules/25-strings/15-escape-characters/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('- Did Joffrey agree?\n- He did. He also said "I love using \\n".') +}) diff --git a/modules/25-strings/20-string-concatenation/test.js b/modules/25-strings/20-string-concatenation/test.js index fc9bd95e..7d81def8 100644 --- a/modules/25-strings/20-string-concatenation/test.js +++ b/modules/25-strings/20-string-concatenation/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('Winter came for the House of Frey.') +}) diff --git a/modules/25-strings/30-encoding/test.js b/modules/25-strings/30-encoding/test.js index 51333beb..b5c9f874 100644 --- a/modules/25-strings/30-encoding/test.js +++ b/modules/25-strings/30-encoding/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('~\n^\n%') +}) diff --git a/modules/30-variables/10-definition/test.js b/modules/30-variables/10-definition/test.js index 9d80fc44..8a2749fc 100644 --- a/modules/30-variables/10-definition/test.js +++ b/modules/30-variables/10-definition/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('What Is Dead May Never Die!') +}) diff --git a/modules/30-variables/11-change/test.js b/modules/30-variables/11-change/test.js index 4273a44e..f7c6f23b 100644 --- a/modules/30-variables/11-change/test.js +++ b/modules/30-variables/11-change/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe('anneirB') +}) diff --git a/modules/30-variables/13-variables-naming/test.js b/modules/30-variables/13-variables-naming/test.js index 99a68d06..c11b3870 100644 --- a/modules/30-variables/13-variables-naming/test.js +++ b/modules/30-variables/13-variables-naming/test.js @@ -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[0]?.[0]; + + expect(firstArg).toBe(2) +}) diff --git a/modules/30-variables/14-errors/test.js b/modules/30-variables/14-errors/test.js index d81cb661..02f12c07 100644 --- a/modules/30-variables/14-errors/test.js +++ b/modules/30-variables/14-errors/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'Targaryen\nand\nDragon'; -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[0]?.[0]; + + expect(firstArg).toBe('Targaryen\nand\nDragon') +}) diff --git a/modules/30-variables/15-variables-expressions/test.js b/modules/30-variables/15-variables-expressions/test.js index 047eeb6d..7da570f2 100644 --- a/modules/30-variables/15-variables-expressions/test.js +++ b/modules/30-variables/15-variables-expressions/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '125\n863.75'; -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[0]?.[0]; + + expect(firstArg).toBe('125\n863.75') +}) diff --git a/modules/30-variables/18-variable-concatenation/test.js b/modules/30-variables/18-variable-concatenation/test.js index 0da330f6..9ecf676d 100644 --- a/modules/30-variables/18-variable-concatenation/test.js +++ b/modules/30-variables/18-variable-concatenation/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = "Hello, Joffrey!\nHere is important information about your account security.\nWe couldn't verify your mother's maiden name."; -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[0]?.[0]; + + expect(firstArg).toBe("Hello, Joffrey!\nHere is important information about your account security.\nWe couldn't verify your mother's maiden name.") +}) diff --git a/modules/30-variables/19-naming-style/test.js b/modules/30-variables/19-naming-style/test.js index cabe1a0e..11c8b1bf 100644 --- a/modules/30-variables/19-naming-style/test.js +++ b/modules/30-variables/19-naming-style/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '-1100'; -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[0]?.[0]; + + expect(firstArg).toBe('-1100') +}) diff --git a/modules/30-variables/20-magic-numbers/test.js b/modules/30-variables/20-magic-numbers/test.js index cd0739cc..e3f7632a 100644 --- a/modules/30-variables/20-magic-numbers/test.js +++ b/modules/30-variables/20-magic-numbers/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'King Balon the 6th has 102 rooms.'; -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[0]?.[0]; + + expect(firstArg).toBe('King Balon the 6th has 102 rooms.') +}) diff --git a/modules/30-variables/23-constants/test.js b/modules/30-variables/23-constants/test.js index e04450c0..259ff535 100644 --- a/modules/30-variables/23-constants/test.js +++ b/modules/30-variables/23-constants/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'the white walkers'; -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[0]?.[0]; + + expect(firstArg).toBe('the white walkers') +}) diff --git a/modules/30-variables/25-interpolation/test.js b/modules/30-variables/25-interpolation/test.js index 16ffdd25..3abf2bdb 100644 --- a/modules/30-variables/25-interpolation/test.js +++ b/modules/30-variables/25-interpolation/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'Do you want to eat, Arya?'; -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[0]?.[0]; + + expect(firstArg).toBe('Do you want to eat, Arya?') +}) diff --git a/modules/30-variables/30-symbols/test.js b/modules/30-variables/30-symbols/test.js index 2fcf9ab1..69c7ace5 100644 --- a/modules/30-variables/30-symbols/test.js +++ b/modules/30-variables/30-symbols/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 's'; -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[0]?.[0]; + + expect(firstArg).toBe('s') +}) diff --git a/modules/33-data-types/10-primitive-data-types/test.js b/modules/33-data-types/10-primitive-data-types/test.js index 1c3811e4..87036ade 100644 --- a/modules/33-data-types/10-primitive-data-types/test.js +++ b/modules/33-data-types/10-primitive-data-types/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '-0.304'; -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[0]?.[0]; + + expect(firstArg).toBe('-0.304') +}) diff --git a/modules/33-data-types/45-undefined/test.js b/modules/33-data-types/45-undefined/test.js index 067ab668..7b1b66a1 100644 --- a/modules/33-data-types/45-undefined/test.js +++ b/modules/33-data-types/45-undefined/test.js @@ -1,4 +1,15 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @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]; + + expect(firstArg).toBe('undefined') +}) const expected = 'undefined'; expectOutput(expected); diff --git a/modules/33-data-types/47-data-types-immutability/test.js b/modules/33-data-types/47-data-types-immutability/test.js index 0adc65ba..72218b84 100644 --- a/modules/33-data-types/47-data-types-immutability/test.js +++ b/modules/33-data-types/47-data-types-immutability/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'hodor'; -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[0]?.[0]; + + expect(firstArg).toBe('hodor') +}) diff --git a/modules/33-data-types/50-data-types-weak-typing/test.js b/modules/33-data-types/50-data-types-weak-typing/test.js index 4b272e4e..75fc9921 100644 --- a/modules/33-data-types/50-data-types-weak-typing/test.js +++ b/modules/33-data-types/50-data-types-weak-typing/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '13'; -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[0]?.[0]; + + expect(firstArg).toBe('13') +}) diff --git a/modules/35-calling-functions/100-call/test.js b/modules/35-calling-functions/100-call/test.js index 7e897146..229e50f6 100644 --- a/modules/35-calling-functions/100-call/test.js +++ b/modules/35-calling-functions/100-call/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '12'; -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[0]?.[0]; + + expect(firstArg).toBe('12') +}) diff --git a/modules/35-calling-functions/110-math/test.js b/modules/35-calling-functions/110-math/test.js index dd5540a4..8791e1f3 100644 --- a/modules/35-calling-functions/110-math/test.js +++ b/modules/35-calling-functions/110-math/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '2309'; -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[0]?.[0]; + + expect(firstArg).toBe('2309') +}) diff --git a/modules/35-calling-functions/120-function-signature/test.js b/modules/35-calling-functions/120-function-signature/test.js index 9abfe291..0c4c26f1 100644 --- a/modules/35-calling-functions/120-function-signature/test.js +++ b/modules/35-calling-functions/120-function-signature/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 924; -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[0]?.[0]; + + expect(firstArg).toBe(924) +}) diff --git a/modules/35-calling-functions/135-calling-functions-default-arguments/test.js b/modules/35-calling-functions/135-calling-functions-default-arguments/test.js index 4d2c1fe1..4d98f0c1 100644 --- a/modules/35-calling-functions/135-calling-functions-default-arguments/test.js +++ b/modules/35-calling-functions/135-calling-functions-default-arguments/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '10.12'; -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[0]?.[0]; + + expect(firstArg).toBe('10.12') +}) diff --git a/modules/35-calling-functions/150-calling-functions-expression/test.js b/modules/35-calling-functions/150-calling-functions-expression/test.js index 24809fcf..36cb34b2 100644 --- a/modules/35-calling-functions/150-calling-functions-expression/test.js +++ b/modules/35-calling-functions/150-calling-functions-expression/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'First: N\nLast: t'; -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[0]?.[0]; + + expect(firstArg).toBe('First: N\nLast: t') +}) diff --git a/modules/35-calling-functions/180-variadic-parameters/test.js b/modules/35-calling-functions/180-variadic-parameters/test.js index 933a99d0..b84e27ba 100644 --- a/modules/35-calling-functions/180-variadic-parameters/test.js +++ b/modules/35-calling-functions/180-variadic-parameters/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '-3'; -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[0]?.[0]; + + expect(firstArg).toBe('-3') +}) diff --git a/modules/35-calling-functions/270-deterministic/test.js b/modules/35-calling-functions/270-deterministic/test.js index 7681c49f..d27c00ff 100644 --- a/modules/35-calling-functions/270-deterministic/test.js +++ b/modules/35-calling-functions/270-deterministic/test.js @@ -1,11 +1,16 @@ // @ts-check -import { expectOutput, expect } from 'hexlet-basics/tests'; +import { expect, test, vi } from 'vitest' -expectOutput((content) => { - expect(content).not.toEqual(''); - const value = Number(content); +test('hello world', async () => { + const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); + await import('./index.js') + + const firstArg = consoleLogSpy.mock.calls[0]?.[0]; + + expect(firstArg).not.toEqual(''); + const value = Number(firstArg); expect(Number.isInteger(value)).toEqual(true); expect(value).toBeGreaterThanOrEqual(0); expect(value).toBeLessThanOrEqual(10); -}); +}) diff --git a/modules/35-calling-functions/350-stdlib/test.js b/modules/35-calling-functions/350-stdlib/test.js index af8731e2..8b3e726b 100644 --- a/modules/35-calling-functions/350-stdlib/test.js +++ b/modules/35-calling-functions/350-stdlib/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'string'; -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[0]?.[0]; + + expect(firstArg).toBe('string') +}) diff --git a/modules/38-properties/100-properties-syntax/test.js b/modules/38-properties/100-properties-syntax/test.js index e596ef0d..8a3e9725 100644 --- a/modules/38-properties/100-properties-syntax/test.js +++ b/modules/38-properties/100-properties-syntax/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 75; -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[0]?.[0]; + + expect(firstArg).toBe(75) +}) diff --git a/modules/38-properties/200-properties-methods/test.js b/modules/38-properties/200-properties-methods/test.js index 664a2368..231c09e0 100644 --- a/modules/38-properties/200-properties-methods/test.js +++ b/modules/38-properties/200-properties-methods/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'a mind needs books as a sword needs a whetstone, if it is to keep its edge.'; -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[0]?.[0]; + + expect(firstArg).toBe('a mind needs books as a sword needs a whetstone, if it is to keep its edge.') +}) diff --git a/modules/38-properties/300-properties-immutability/test.js b/modules/38-properties/300-properties-immutability/test.js index b2f2aa7a..ffb48fb3 100644 --- a/modules/38-properties/300-properties-immutability/test.js +++ b/modules/38-properties/300-properties-immutability/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'Grigor'; -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[0]?.[0]; + + expect(firstArg).toBe('Grigor') +}) diff --git a/modules/38-properties/400-properties-expressions/test.js b/modules/38-properties/400-properties-expressions/test.js index 24809fcf..36cb34b2 100644 --- a/modules/38-properties/400-properties-expressions/test.js +++ b/modules/38-properties/400-properties-expressions/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'First: N\nLast: t'; -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[0]?.[0]; + + expect(firstArg).toBe('First: N\nLast: t') +}) diff --git a/modules/38-properties/500-properties-chain-of-methods/test.js b/modules/38-properties/500-properties-chain-of-methods/test.js index 51b1f77f..420777c2 100644 --- a/modules/38-properties/500-properties-chain-of-methods/test.js +++ b/modules/38-properties/500-properties-chain-of-methods/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 7; -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[0]?.[0]; + + expect(firstArg).toBe(7) +}) diff --git a/modules/40-define-functions/100-define-functions-syntax/test.js b/modules/40-define-functions/100-define-functions-syntax/test.js index 9678890c..9c3f5f4a 100644 --- a/modules/40-define-functions/100-define-functions-syntax/test.js +++ b/modules/40-define-functions/100-define-functions-syntax/test.js @@ -1,4 +1,12 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 'Winter is coming'; -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[0]?.[0]; + + expect(firstArg).toBe('Winter is coming') +}) diff --git a/modules/40-define-functions/150-define-functions-return/test.js b/modules/40-define-functions/150-define-functions-return/test.js index 0b0e7ca6..4ff854ef 100644 --- a/modules/40-define-functions/150-define-functions-return/test.js +++ b/modules/40-define-functions/150-define-functions-return/test.js @@ -1,6 +1,6 @@ // @ts-check -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/40-define-functions/320-define-functions-parameters/test.js b/modules/40-define-functions/320-define-functions-parameters/test.js index 9f1e6cf4..0adcef8a 100644 --- a/modules/40-define-functions/320-define-functions-parameters/test.js +++ b/modules/40-define-functions/320-define-functions-parameters/test.js @@ -1,6 +1,6 @@ // @ts-check -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/40-define-functions/340-define-functions-default-parameters/test.js b/modules/40-define-functions/340-define-functions-default-parameters/test.js index 0bd6dabc..2bd1df4c 100644 --- a/modules/40-define-functions/340-define-functions-default-parameters/test.js +++ b/modules/40-define-functions/340-define-functions-default-parameters/test.js @@ -1,6 +1,6 @@ // @ts-check -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/40-define-functions/450-define-functions-short-syntax/test.js b/modules/40-define-functions/450-define-functions-short-syntax/test.js index 948f783c..cd93f80e 100644 --- a/modules/40-define-functions/450-define-functions-short-syntax/test.js +++ b/modules/40-define-functions/450-define-functions-short-syntax/test.js @@ -1,6 +1,6 @@ // @ts-check -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/45-logic/10-bool-type/test.js b/modules/45-logic/10-bool-type/test.js index 83bfa071..59b7f622 100644 --- a/modules/45-logic/10-bool-type/test.js +++ b/modules/45-logic/10-bool-type/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/45-logic/15-predicates/test.js b/modules/45-logic/15-predicates/test.js index 0c7bdea2..6f789f1a 100644 --- a/modules/45-logic/15-predicates/test.js +++ b/modules/45-logic/15-predicates/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/45-logic/20-logic-combine-expressions/test.js b/modules/45-logic/20-logic-combine-expressions/test.js index b72ae092..95c637e1 100644 --- a/modules/45-logic/20-logic-combine-expressions/test.js +++ b/modules/45-logic/20-logic-combine-expressions/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/45-logic/25-logical-operators/test.js b/modules/45-logic/25-logical-operators/test.js index bb15b2fa..28dfffba 100644 --- a/modules/45-logic/25-logical-operators/test.js +++ b/modules/45-logic/25-logical-operators/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/45-logic/28-logical-negation/test.js b/modules/45-logic/28-logical-negation/test.js index 01799211..1e8047ba 100644 --- a/modules/45-logic/28-logical-negation/test.js +++ b/modules/45-logic/28-logical-negation/test.js @@ -1,6 +1,6 @@ // @ts-check -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/45-logic/70-logical-expressions/test.js b/modules/45-logic/70-logical-expressions/test.js index b62d0888..ee6e81e3 100644 --- a/modules/45-logic/70-logical-expressions/test.js +++ b/modules/45-logic/70-logical-expressions/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/48-conditionals/30-if/test.js b/modules/48-conditionals/30-if/test.js index 13d4949e..64971bef 100644 --- a/modules/48-conditionals/30-if/test.js +++ b/modules/48-conditionals/30-if/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/48-conditionals/40-if-else/test.js b/modules/48-conditionals/40-if-else/test.js index 3167ede0..b201ac70 100644 --- a/modules/48-conditionals/40-if-else/test.js +++ b/modules/48-conditionals/40-if-else/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/48-conditionals/50-else-if/test.js b/modules/48-conditionals/50-else-if/test.js index 89143249..f212969e 100644 --- a/modules/48-conditionals/50-else-if/test.js +++ b/modules/48-conditionals/50-else-if/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/48-conditionals/60-ternary-operator/test.js b/modules/48-conditionals/60-ternary-operator/test.js index 27ced3be..03875798 100644 --- a/modules/48-conditionals/60-ternary-operator/test.js +++ b/modules/48-conditionals/60-ternary-operator/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/48-conditionals/65-switch/test.js b/modules/48-conditionals/65-switch/test.js index d1b283f6..e9f8b18c 100644 --- a/modules/48-conditionals/65-switch/test.js +++ b/modules/48-conditionals/65-switch/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/50-loops/10-while/test.js b/modules/50-loops/10-while/test.js index 6e7dd0d2..42c980d7 100644 --- a/modules/50-loops/10-while/test.js +++ b/modules/50-loops/10-while/test.js @@ -1,4 +1,13 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = '6\n5\n4\n3\n2\n1\nfinished!'; -expectOutput(expected, (f) => f(6)); +import { expect, test, vi } from 'vitest' +import f from './index.js'; + +test('hello world', async () => { + const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); + f(6); + + const firstArg = consoleLogSpy.mock.calls[0]?.[0]; + + expect(firstArg).toBe('6\n5\n4\n3\n2\n1\nfinished!') +}) diff --git a/modules/50-loops/20-aggregation-numbers/test.js b/modules/50-loops/20-aggregation-numbers/test.js index 358506ba..f9c71448 100644 --- a/modules/50-loops/20-aggregation-numbers/test.js +++ b/modules/50-loops/20-aggregation-numbers/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/50-loops/23-aggregation-strings/test.js b/modules/50-loops/23-aggregation-strings/test.js index 57d2a677..fd5c355c 100644 --- a/modules/50-loops/23-aggregation-strings/test.js +++ b/modules/50-loops/23-aggregation-strings/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/50-loops/25-iteration-over-string/test.js b/modules/50-loops/25-iteration-over-string/test.js index d2753348..0525fc35 100644 --- a/modules/50-loops/25-iteration-over-string/test.js +++ b/modules/50-loops/25-iteration-over-string/test.js @@ -1,4 +1,13 @@ -import { expectOutput } from 'hexlet-basics/tests'; +// @ts-check -const expected = 't\ne\nl\nx\ne\nH'; -expectOutput(expected, (f) => f('Hexlet')); +import { expect, test, vi } from 'vitest' +import f from './index.js'; + +test('hello world', async () => { + const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); + f('Hexlet') + + const firstArg = consoleLogSpy.mock.calls[0]?.[0]; + + expect(firstArg).toBe('t\ne\nl\nx\ne\nH') +}) diff --git a/modules/50-loops/26-conditions-inside-loops/test.js b/modules/50-loops/26-conditions-inside-loops/test.js index 5f6ce00e..2b45c92e 100644 --- a/modules/50-loops/26-conditions-inside-loops/test.js +++ b/modules/50-loops/26-conditions-inside-loops/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/50-loops/28-build-strings/test.js b/modules/50-loops/28-build-strings/test.js index 4af85ab7..071742cd 100644 --- a/modules/50-loops/28-build-strings/test.js +++ b/modules/50-loops/28-build-strings/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/50-loops/30-syntax-sugar/test.js b/modules/50-loops/30-syntax-sugar/test.js index 496b8444..34f3704e 100644 --- a/modules/50-loops/30-syntax-sugar/test.js +++ b/modules/50-loops/30-syntax-sugar/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/50-loops/50-mutators/test.js b/modules/50-loops/50-mutators/test.js index ed01b637..7843897f 100644 --- a/modules/50-loops/50-mutators/test.js +++ b/modules/50-loops/50-mutators/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/modules/50-loops/55-return-from-loops/test.js b/modules/50-loops/55-return-from-loops/test.js index 5fde2c44..e820bef3 100644 --- a/modules/50-loops/55-return-from-loops/test.js +++ b/modules/50-loops/55-return-from-loops/test.js @@ -1,4 +1,4 @@ -import { test, expect } from '@jest/globals'; +import { expect, test } from 'vitest'; import f from './index.js'; test('test', () => { diff --git a/src/tests.js b/src/tests.js index 37e0f5ee..098f0b2b 100644 --- a/src/tests.js +++ b/src/tests.js @@ -1,7 +1,7 @@ // @ts-check // TODO use vitest -import { expect } from 'expect'; +import { expect } from 'vitest' import chalk from 'chalk'; import StackTracey from 'stacktracey'; import _ from 'lodash'; diff --git a/vitest.config.js b/vitest.config.js index b0d04711..6c034a83 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -1,4 +1,4 @@ -import { defineConfig } from 'vite' +import { defineConfig } from 'vitest/config' export default defineConfig({ test: { From 0f16dc285e14d34df96b2f630b4b115f341105e1 Mon Sep 17 00:00:00 2001 From: Ivan Gagarinov Date: Fri, 28 Feb 2025 02:09:36 +0500 Subject: [PATCH 2/2] fix test --- modules/10-basics/10-hello-world/test.js | 2 +- modules/10-basics/20-comments/Makefile | 2 +- modules/10-basics/40-instructions/Makefile | 2 +- modules/10-basics/40-instructions/test.js | 2 +- modules/10-basics/45-testing/Makefile | 2 +- modules/10-basics/45-testing/test.js | 2 +- modules/10-basics/50-syntax-errors/Makefile | 2 +- modules/10-basics/50-syntax-errors/test.js | 2 +- modules/20-arithmetics/20-basic/Makefile | 2 +- modules/20-arithmetics/20-basic/test.js | 2 +- modules/20-arithmetics/25-operator/Makefile | 2 +- modules/20-arithmetics/25-operator/test.js | 2 +- modules/20-arithmetics/27-commutativity/Makefile | 2 +- modules/20-arithmetics/27-commutativity/test.js | 2 +- modules/20-arithmetics/30-composition/Makefile | 2 +- modules/20-arithmetics/30-composition/test.js | 2 +- modules/20-arithmetics/40-priority/Makefile | 2 +- modules/20-arithmetics/40-priority/test.js | 2 +- modules/20-arithmetics/50-float/Makefile | 2 +- modules/20-arithmetics/50-float/test.js | 4 ++-- modules/20-arithmetics/60-infinity/Makefile | 2 +- modules/20-arithmetics/60-infinity/test.js | 4 ++-- modules/20-arithmetics/70-nan/Makefile | 2 +- modules/20-arithmetics/70-nan/test.js | 2 +- modules/20-arithmetics/80-linting/Makefile | 2 +- modules/20-arithmetics/80-linting/test.js | 2 +- modules/25-strings/10-quotes/Makefile | 2 +- modules/25-strings/10-quotes/test.js | 2 +- modules/25-strings/15-escape-characters/Makefile | 2 +- modules/25-strings/15-escape-characters/test.js | 2 +- modules/25-strings/20-string-concatenation/Makefile | 2 +- modules/25-strings/20-string-concatenation/test.js | 2 +- modules/25-strings/30-encoding/Makefile | 2 +- modules/25-strings/30-encoding/test.js | 2 +- modules/30-variables/10-definition/Makefile | 2 +- modules/30-variables/10-definition/test.js | 2 +- modules/30-variables/11-change/Makefile | 2 +- modules/30-variables/11-change/test.js | 2 +- modules/30-variables/13-variables-naming/Makefile | 2 +- modules/30-variables/13-variables-naming/test.js | 4 ++-- modules/30-variables/14-errors/Makefile | 2 +- modules/30-variables/14-errors/test.js | 2 +- modules/30-variables/15-variables-expressions/Makefile | 2 +- modules/30-variables/15-variables-expressions/test.js | 2 +- modules/30-variables/18-variable-concatenation/Makefile | 2 +- modules/30-variables/18-variable-concatenation/test.js | 2 +- modules/30-variables/19-naming-style/Makefile | 2 +- modules/30-variables/19-naming-style/test.js | 2 +- modules/30-variables/20-magic-numbers/Makefile | 2 +- modules/30-variables/20-magic-numbers/test.js | 2 +- modules/30-variables/23-constants/Makefile | 2 +- modules/30-variables/23-constants/test.js | 2 +- modules/30-variables/25-interpolation/Makefile | 2 +- modules/30-variables/25-interpolation/test.js | 2 +- modules/30-variables/30-symbols/Makefile | 2 +- modules/30-variables/30-symbols/test.js | 2 +- modules/33-data-types/10-primitive-data-types/Makefile | 2 +- modules/33-data-types/10-primitive-data-types/test.js | 2 +- modules/33-data-types/45-undefined/Makefile | 2 +- modules/33-data-types/45-undefined/test.js | 5 +---- modules/33-data-types/47-data-types-immutability/Makefile | 2 +- modules/33-data-types/47-data-types-immutability/test.js | 2 +- modules/33-data-types/50-data-types-weak-typing/Makefile | 2 +- modules/33-data-types/50-data-types-weak-typing/test.js | 2 +- modules/35-calling-functions/100-call/Makefile | 2 +- modules/35-calling-functions/100-call/test.js | 2 +- modules/35-calling-functions/110-math/Makefile | 2 +- modules/35-calling-functions/110-math/test.js | 2 +- modules/35-calling-functions/120-function-signature/Makefile | 2 +- modules/35-calling-functions/120-function-signature/test.js | 4 ++-- .../135-calling-functions-default-arguments/Makefile | 2 +- .../135-calling-functions-default-arguments/test.js | 2 +- .../150-calling-functions-expression/Makefile | 2 +- .../150-calling-functions-expression/test.js | 2 +- .../35-calling-functions/180-variadic-parameters/Makefile | 2 +- modules/35-calling-functions/180-variadic-parameters/test.js | 2 +- modules/35-calling-functions/270-deterministic/Makefile | 2 +- modules/35-calling-functions/270-deterministic/test.js | 2 +- modules/35-calling-functions/350-stdlib/Makefile | 2 +- modules/35-calling-functions/350-stdlib/test.js | 2 +- modules/38-properties/100-properties-syntax/Makefile | 2 +- modules/38-properties/100-properties-syntax/test.js | 4 ++-- modules/38-properties/200-properties-methods/Makefile | 2 +- modules/38-properties/200-properties-methods/test.js | 2 +- modules/38-properties/300-properties-immutability/Makefile | 2 +- modules/38-properties/300-properties-immutability/test.js | 2 +- modules/38-properties/400-properties-expressions/Makefile | 2 +- modules/38-properties/400-properties-expressions/test.js | 2 +- .../38-properties/500-properties-chain-of-methods/Makefile | 2 +- .../38-properties/500-properties-chain-of-methods/test.js | 4 ++-- .../40-define-functions/100-define-functions-syntax/Makefile | 2 +- .../40-define-functions/100-define-functions-syntax/test.js | 5 +++-- .../40-define-functions/150-define-functions-return/Makefile | 2 +- .../320-define-functions-parameters/Makefile | 2 +- .../340-define-functions-default-parameters/Makefile | 2 +- .../450-define-functions-short-syntax/Makefile | 2 +- modules/45-logic/10-bool-type/Makefile | 2 +- modules/45-logic/15-predicates/Makefile | 2 +- modules/45-logic/20-logic-combine-expressions/Makefile | 2 +- modules/45-logic/25-logical-operators/Makefile | 2 +- modules/45-logic/28-logical-negation/Makefile | 2 +- modules/45-logic/70-logical-expressions/Makefile | 2 +- modules/48-conditionals/30-if/Makefile | 2 +- modules/48-conditionals/40-if-else/Makefile | 2 +- modules/48-conditionals/50-else-if/Makefile | 2 +- modules/48-conditionals/60-ternary-operator/Makefile | 2 +- modules/48-conditionals/65-switch/Makefile | 2 +- modules/50-loops/10-while/Makefile | 2 +- modules/50-loops/10-while/test.js | 2 +- modules/50-loops/20-aggregation-numbers/Makefile | 2 +- modules/50-loops/23-aggregation-strings/Makefile | 2 +- modules/50-loops/25-iteration-over-string/Makefile | 2 +- modules/50-loops/25-iteration-over-string/test.js | 2 +- modules/50-loops/26-conditions-inside-loops/Makefile | 2 +- modules/50-loops/28-build-strings/Makefile | 2 +- modules/50-loops/30-syntax-sugar/Makefile | 2 +- modules/50-loops/50-mutators/Makefile | 2 +- modules/50-loops/55-return-from-loops/Makefile | 2 +- vitest.config.js | 2 +- 119 files changed, 127 insertions(+), 129 deletions(-) diff --git a/modules/10-basics/10-hello-world/test.js b/modules/10-basics/10-hello-world/test.js index 706cc31e..27c42c04 100644 --- a/modules/10-basics/10-hello-world/test.js +++ b/modules/10-basics/10-hello-world/test.js @@ -6,7 +6,7 @@ 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!') }) diff --git a/modules/10-basics/20-comments/Makefile b/modules/10-basics/20-comments/Makefile index 24e31e38..990011b4 100644 --- a/modules/10-basics/20-comments/Makefile +++ b/modules/10-basics/20-comments/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/10-basics/40-instructions/Makefile b/modules/10-basics/40-instructions/Makefile index 24e31e38..990011b4 100644 --- a/modules/10-basics/40-instructions/Makefile +++ b/modules/10-basics/40-instructions/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/10-basics/40-instructions/test.js b/modules/10-basics/40-instructions/test.js index f2ad5618..de722a30 100644 --- a/modules/10-basics/40-instructions/test.js +++ b/modules/10-basics/40-instructions/test.js @@ -6,7 +6,7 @@ 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('Robert\nStannis\nRenly') }) diff --git a/modules/10-basics/45-testing/Makefile b/modules/10-basics/45-testing/Makefile index 24e31e38..990011b4 100644 --- a/modules/10-basics/45-testing/Makefile +++ b/modules/10-basics/45-testing/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/10-basics/45-testing/test.js b/modules/10-basics/45-testing/test.js index 62760fef..4006ce67 100644 --- a/modules/10-basics/45-testing/test.js +++ b/modules/10-basics/45-testing/test.js @@ -6,7 +6,7 @@ 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('9780262531962') }) diff --git a/modules/10-basics/50-syntax-errors/Makefile b/modules/10-basics/50-syntax-errors/Makefile index 24e31e38..990011b4 100644 --- a/modules/10-basics/50-syntax-errors/Makefile +++ b/modules/10-basics/50-syntax-errors/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/10-basics/50-syntax-errors/test.js b/modules/10-basics/50-syntax-errors/test.js index 1a1026c2..70221e16 100644 --- a/modules/10-basics/50-syntax-errors/test.js +++ b/modules/10-basics/50-syntax-errors/test.js @@ -6,7 +6,7 @@ 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('What Is Dead May Never Die') }) diff --git a/modules/20-arithmetics/20-basic/Makefile b/modules/20-arithmetics/20-basic/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/20-basic/Makefile +++ b/modules/20-arithmetics/20-basic/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/20-basic/test.js b/modules/20-arithmetics/20-basic/test.js index 476d9108..c75b0ce2 100644 --- a/modules/20-arithmetics/20-basic/test.js +++ b/modules/20-arithmetics/20-basic/test.js @@ -6,7 +6,7 @@ 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('9') }) diff --git a/modules/20-arithmetics/25-operator/Makefile b/modules/20-arithmetics/25-operator/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/25-operator/Makefile +++ b/modules/20-arithmetics/25-operator/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/25-operator/test.js b/modules/20-arithmetics/25-operator/test.js index e5b232e3..3a08b430 100644 --- a/modules/20-arithmetics/25-operator/test.js +++ b/modules/20-arithmetics/25-operator/test.js @@ -6,7 +6,7 @@ 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('87') }) diff --git a/modules/20-arithmetics/27-commutativity/Makefile b/modules/20-arithmetics/27-commutativity/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/27-commutativity/Makefile +++ b/modules/20-arithmetics/27-commutativity/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/27-commutativity/test.js b/modules/20-arithmetics/27-commutativity/test.js index 3b09b371..7f17fdec 100644 --- a/modules/20-arithmetics/27-commutativity/test.js +++ b/modules/20-arithmetics/27-commutativity/test.js @@ -6,7 +6,7 @@ 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('243\n2') }) diff --git a/modules/20-arithmetics/30-composition/Makefile b/modules/20-arithmetics/30-composition/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/30-composition/Makefile +++ b/modules/20-arithmetics/30-composition/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/30-composition/test.js b/modules/20-arithmetics/30-composition/test.js index 92ea50de..588c0883 100644 --- a/modules/20-arithmetics/30-composition/test.js +++ b/modules/20-arithmetics/30-composition/test.js @@ -6,7 +6,7 @@ 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('10.5') }) diff --git a/modules/20-arithmetics/40-priority/Makefile b/modules/20-arithmetics/40-priority/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/40-priority/Makefile +++ b/modules/20-arithmetics/40-priority/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/40-priority/test.js b/modules/20-arithmetics/40-priority/test.js index b1113dd3..b9c8fd22 100644 --- a/modules/20-arithmetics/40-priority/test.js +++ b/modules/20-arithmetics/40-priority/test.js @@ -6,7 +6,7 @@ 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('49') }) diff --git a/modules/20-arithmetics/50-float/Makefile b/modules/20-arithmetics/50-float/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/50-float/Makefile +++ b/modules/20-arithmetics/50-float/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/50-float/test.js b/modules/20-arithmetics/50-float/test.js index 58864076..f935a52a 100644 --- a/modules/20-arithmetics/50-float/test.js +++ b/modules/20-arithmetics/50-float/test.js @@ -6,7 +6,7 @@ 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('0.39 * 0.22') + expect(firstArg).toBe('0.0858') }) diff --git a/modules/20-arithmetics/60-infinity/Makefile b/modules/20-arithmetics/60-infinity/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/60-infinity/Makefile +++ b/modules/20-arithmetics/60-infinity/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/60-infinity/test.js b/modules/20-arithmetics/60-infinity/test.js index 7c2b759f..8439ee93 100644 --- a/modules/20-arithmetics/60-infinity/test.js +++ b/modules/20-arithmetics/60-infinity/test.js @@ -6,7 +6,7 @@ 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(Infinity) + expect(firstArg).toBe('Infinity') }) diff --git a/modules/20-arithmetics/70-nan/Makefile b/modules/20-arithmetics/70-nan/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/70-nan/Makefile +++ b/modules/20-arithmetics/70-nan/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/70-nan/test.js b/modules/20-arithmetics/70-nan/test.js index 033de3ef..150a763c 100644 --- a/modules/20-arithmetics/70-nan/test.js +++ b/modules/20-arithmetics/70-nan/test.js @@ -6,7 +6,7 @@ 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('NaN') }) diff --git a/modules/20-arithmetics/80-linting/Makefile b/modules/20-arithmetics/80-linting/Makefile index 24e31e38..990011b4 100644 --- a/modules/20-arithmetics/80-linting/Makefile +++ b/modules/20-arithmetics/80-linting/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/20-arithmetics/80-linting/test.js b/modules/20-arithmetics/80-linting/test.js index 30cf0320..9d4779bb 100644 --- a/modules/20-arithmetics/80-linting/test.js +++ b/modules/20-arithmetics/80-linting/test.js @@ -6,7 +6,7 @@ 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('4') }) diff --git a/modules/25-strings/10-quotes/Makefile b/modules/25-strings/10-quotes/Makefile index 24e31e38..990011b4 100644 --- a/modules/25-strings/10-quotes/Makefile +++ b/modules/25-strings/10-quotes/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/25-strings/10-quotes/test.js b/modules/25-strings/10-quotes/test.js index 9c033793..675516e7 100644 --- a/modules/25-strings/10-quotes/test.js +++ b/modules/25-strings/10-quotes/test.js @@ -6,7 +6,7 @@ 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("\"Khal Drogo's favorite word is \"athjahakar\"\"") }) diff --git a/modules/25-strings/15-escape-characters/Makefile b/modules/25-strings/15-escape-characters/Makefile index 24e31e38..990011b4 100644 --- a/modules/25-strings/15-escape-characters/Makefile +++ b/modules/25-strings/15-escape-characters/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/25-strings/15-escape-characters/test.js b/modules/25-strings/15-escape-characters/test.js index f82d86d6..6cbfd310 100644 --- a/modules/25-strings/15-escape-characters/test.js +++ b/modules/25-strings/15-escape-characters/test.js @@ -6,7 +6,7 @@ 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('- Did Joffrey agree?\n- He did. He also said "I love using \\n".') }) diff --git a/modules/25-strings/20-string-concatenation/Makefile b/modules/25-strings/20-string-concatenation/Makefile index 24e31e38..990011b4 100644 --- a/modules/25-strings/20-string-concatenation/Makefile +++ b/modules/25-strings/20-string-concatenation/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/25-strings/20-string-concatenation/test.js b/modules/25-strings/20-string-concatenation/test.js index 7d81def8..f8ed0287 100644 --- a/modules/25-strings/20-string-concatenation/test.js +++ b/modules/25-strings/20-string-concatenation/test.js @@ -6,7 +6,7 @@ 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('Winter came for the House of Frey.') }) diff --git a/modules/25-strings/30-encoding/Makefile b/modules/25-strings/30-encoding/Makefile index 24e31e38..990011b4 100644 --- a/modules/25-strings/30-encoding/Makefile +++ b/modules/25-strings/30-encoding/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/25-strings/30-encoding/test.js b/modules/25-strings/30-encoding/test.js index b5c9f874..00f359d8 100644 --- a/modules/25-strings/30-encoding/test.js +++ b/modules/25-strings/30-encoding/test.js @@ -6,7 +6,7 @@ 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('~\n^\n%') }) diff --git a/modules/30-variables/10-definition/Makefile b/modules/30-variables/10-definition/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/10-definition/Makefile +++ b/modules/30-variables/10-definition/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/10-definition/test.js b/modules/30-variables/10-definition/test.js index 8a2749fc..a1ed5867 100644 --- a/modules/30-variables/10-definition/test.js +++ b/modules/30-variables/10-definition/test.js @@ -6,7 +6,7 @@ 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('What Is Dead May Never Die!') }) diff --git a/modules/30-variables/11-change/Makefile b/modules/30-variables/11-change/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/11-change/Makefile +++ b/modules/30-variables/11-change/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/11-change/test.js b/modules/30-variables/11-change/test.js index f7c6f23b..6252d0b4 100644 --- a/modules/30-variables/11-change/test.js +++ b/modules/30-variables/11-change/test.js @@ -6,7 +6,7 @@ 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('anneirB') }) diff --git a/modules/30-variables/13-variables-naming/Makefile b/modules/30-variables/13-variables-naming/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/13-variables-naming/Makefile +++ b/modules/30-variables/13-variables-naming/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/13-variables-naming/test.js b/modules/30-variables/13-variables-naming/test.js index c11b3870..4f2bee70 100644 --- a/modules/30-variables/13-variables-naming/test.js +++ b/modules/30-variables/13-variables-naming/test.js @@ -6,7 +6,7 @@ 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(2) + expect(firstArg).toBe('2') }) diff --git a/modules/30-variables/14-errors/Makefile b/modules/30-variables/14-errors/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/14-errors/Makefile +++ b/modules/30-variables/14-errors/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/14-errors/test.js b/modules/30-variables/14-errors/test.js index 02f12c07..43b50e6e 100644 --- a/modules/30-variables/14-errors/test.js +++ b/modules/30-variables/14-errors/test.js @@ -6,7 +6,7 @@ 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('Targaryen\nand\nDragon') }) diff --git a/modules/30-variables/15-variables-expressions/Makefile b/modules/30-variables/15-variables-expressions/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/15-variables-expressions/Makefile +++ b/modules/30-variables/15-variables-expressions/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/15-variables-expressions/test.js b/modules/30-variables/15-variables-expressions/test.js index 7da570f2..8fd0faac 100644 --- a/modules/30-variables/15-variables-expressions/test.js +++ b/modules/30-variables/15-variables-expressions/test.js @@ -6,7 +6,7 @@ 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('125\n863.75') }) diff --git a/modules/30-variables/18-variable-concatenation/Makefile b/modules/30-variables/18-variable-concatenation/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/18-variable-concatenation/Makefile +++ b/modules/30-variables/18-variable-concatenation/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/18-variable-concatenation/test.js b/modules/30-variables/18-variable-concatenation/test.js index 9ecf676d..5b37a729 100644 --- a/modules/30-variables/18-variable-concatenation/test.js +++ b/modules/30-variables/18-variable-concatenation/test.js @@ -6,7 +6,7 @@ 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, Joffrey!\nHere is important information about your account security.\nWe couldn't verify your mother's maiden name.") }) diff --git a/modules/30-variables/19-naming-style/Makefile b/modules/30-variables/19-naming-style/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/19-naming-style/Makefile +++ b/modules/30-variables/19-naming-style/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/19-naming-style/test.js b/modules/30-variables/19-naming-style/test.js index 11c8b1bf..477fbbfb 100644 --- a/modules/30-variables/19-naming-style/test.js +++ b/modules/30-variables/19-naming-style/test.js @@ -6,7 +6,7 @@ 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('-1100') }) diff --git a/modules/30-variables/20-magic-numbers/Makefile b/modules/30-variables/20-magic-numbers/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/20-magic-numbers/Makefile +++ b/modules/30-variables/20-magic-numbers/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/20-magic-numbers/test.js b/modules/30-variables/20-magic-numbers/test.js index e3f7632a..c1632ed1 100644 --- a/modules/30-variables/20-magic-numbers/test.js +++ b/modules/30-variables/20-magic-numbers/test.js @@ -6,7 +6,7 @@ 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('King Balon the 6th has 102 rooms.') }) diff --git a/modules/30-variables/23-constants/Makefile b/modules/30-variables/23-constants/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/23-constants/Makefile +++ b/modules/30-variables/23-constants/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/23-constants/test.js b/modules/30-variables/23-constants/test.js index 259ff535..4c61c94b 100644 --- a/modules/30-variables/23-constants/test.js +++ b/modules/30-variables/23-constants/test.js @@ -6,7 +6,7 @@ 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('the white walkers') }) diff --git a/modules/30-variables/25-interpolation/Makefile b/modules/30-variables/25-interpolation/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/25-interpolation/Makefile +++ b/modules/30-variables/25-interpolation/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/25-interpolation/test.js b/modules/30-variables/25-interpolation/test.js index 3abf2bdb..db43d720 100644 --- a/modules/30-variables/25-interpolation/test.js +++ b/modules/30-variables/25-interpolation/test.js @@ -6,7 +6,7 @@ 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('Do you want to eat, Arya?') }) diff --git a/modules/30-variables/30-symbols/Makefile b/modules/30-variables/30-symbols/Makefile index 24e31e38..990011b4 100644 --- a/modules/30-variables/30-symbols/Makefile +++ b/modules/30-variables/30-symbols/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/30-variables/30-symbols/test.js b/modules/30-variables/30-symbols/test.js index 69c7ace5..a6023ce0 100644 --- a/modules/30-variables/30-symbols/test.js +++ b/modules/30-variables/30-symbols/test.js @@ -6,7 +6,7 @@ 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('s') }) diff --git a/modules/33-data-types/10-primitive-data-types/Makefile b/modules/33-data-types/10-primitive-data-types/Makefile index 24e31e38..990011b4 100644 --- a/modules/33-data-types/10-primitive-data-types/Makefile +++ b/modules/33-data-types/10-primitive-data-types/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/33-data-types/10-primitive-data-types/test.js b/modules/33-data-types/10-primitive-data-types/test.js index 87036ade..599e52e7 100644 --- a/modules/33-data-types/10-primitive-data-types/test.js +++ b/modules/33-data-types/10-primitive-data-types/test.js @@ -6,7 +6,7 @@ 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('-0.304') }) diff --git a/modules/33-data-types/45-undefined/Makefile b/modules/33-data-types/45-undefined/Makefile index 24e31e38..990011b4 100644 --- a/modules/33-data-types/45-undefined/Makefile +++ b/modules/33-data-types/45-undefined/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/33-data-types/45-undefined/test.js b/modules/33-data-types/45-undefined/test.js index 7b1b66a1..3ea9d796 100644 --- a/modules/33-data-types/45-undefined/test.js +++ b/modules/33-data-types/45-undefined/test.js @@ -8,8 +8,5 @@ test('hello world', async () => { const firstArg = consoleLogSpy.mock.calls[0]?.[0]; - expect(firstArg).toBe('undefined') + expect(firstArg).toBe(undefined) }) - -const expected = 'undefined'; -expectOutput(expected); diff --git a/modules/33-data-types/47-data-types-immutability/Makefile b/modules/33-data-types/47-data-types-immutability/Makefile index 24e31e38..990011b4 100644 --- a/modules/33-data-types/47-data-types-immutability/Makefile +++ b/modules/33-data-types/47-data-types-immutability/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/33-data-types/47-data-types-immutability/test.js b/modules/33-data-types/47-data-types-immutability/test.js index 72218b84..d2dd7198 100644 --- a/modules/33-data-types/47-data-types-immutability/test.js +++ b/modules/33-data-types/47-data-types-immutability/test.js @@ -6,7 +6,7 @@ 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('hodor') }) diff --git a/modules/33-data-types/50-data-types-weak-typing/Makefile b/modules/33-data-types/50-data-types-weak-typing/Makefile index 24e31e38..990011b4 100644 --- a/modules/33-data-types/50-data-types-weak-typing/Makefile +++ b/modules/33-data-types/50-data-types-weak-typing/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/33-data-types/50-data-types-weak-typing/test.js b/modules/33-data-types/50-data-types-weak-typing/test.js index 75fc9921..a4770a34 100644 --- a/modules/33-data-types/50-data-types-weak-typing/test.js +++ b/modules/33-data-types/50-data-types-weak-typing/test.js @@ -6,7 +6,7 @@ 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('13') }) diff --git a/modules/35-calling-functions/100-call/Makefile b/modules/35-calling-functions/100-call/Makefile index 24e31e38..990011b4 100644 --- a/modules/35-calling-functions/100-call/Makefile +++ b/modules/35-calling-functions/100-call/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/35-calling-functions/100-call/test.js b/modules/35-calling-functions/100-call/test.js index 229e50f6..e5b120e8 100644 --- a/modules/35-calling-functions/100-call/test.js +++ b/modules/35-calling-functions/100-call/test.js @@ -6,7 +6,7 @@ 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('12') }) diff --git a/modules/35-calling-functions/110-math/Makefile b/modules/35-calling-functions/110-math/Makefile index 24e31e38..990011b4 100644 --- a/modules/35-calling-functions/110-math/Makefile +++ b/modules/35-calling-functions/110-math/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/35-calling-functions/110-math/test.js b/modules/35-calling-functions/110-math/test.js index 8791e1f3..12b4f659 100644 --- a/modules/35-calling-functions/110-math/test.js +++ b/modules/35-calling-functions/110-math/test.js @@ -6,7 +6,7 @@ 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('2309') }) diff --git a/modules/35-calling-functions/120-function-signature/Makefile b/modules/35-calling-functions/120-function-signature/Makefile index 24e31e38..990011b4 100644 --- a/modules/35-calling-functions/120-function-signature/Makefile +++ b/modules/35-calling-functions/120-function-signature/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/35-calling-functions/120-function-signature/test.js b/modules/35-calling-functions/120-function-signature/test.js index 0c4c26f1..285deefe 100644 --- a/modules/35-calling-functions/120-function-signature/test.js +++ b/modules/35-calling-functions/120-function-signature/test.js @@ -6,7 +6,7 @@ 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(924) + expect(firstArg).toBe('924') }) diff --git a/modules/35-calling-functions/135-calling-functions-default-arguments/Makefile b/modules/35-calling-functions/135-calling-functions-default-arguments/Makefile index 24e31e38..990011b4 100644 --- a/modules/35-calling-functions/135-calling-functions-default-arguments/Makefile +++ b/modules/35-calling-functions/135-calling-functions-default-arguments/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/35-calling-functions/135-calling-functions-default-arguments/test.js b/modules/35-calling-functions/135-calling-functions-default-arguments/test.js index 4d98f0c1..3205f1f4 100644 --- a/modules/35-calling-functions/135-calling-functions-default-arguments/test.js +++ b/modules/35-calling-functions/135-calling-functions-default-arguments/test.js @@ -6,7 +6,7 @@ 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('10.12') }) diff --git a/modules/35-calling-functions/150-calling-functions-expression/Makefile b/modules/35-calling-functions/150-calling-functions-expression/Makefile index 24e31e38..990011b4 100644 --- a/modules/35-calling-functions/150-calling-functions-expression/Makefile +++ b/modules/35-calling-functions/150-calling-functions-expression/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/35-calling-functions/150-calling-functions-expression/test.js b/modules/35-calling-functions/150-calling-functions-expression/test.js index 36cb34b2..ac96751b 100644 --- a/modules/35-calling-functions/150-calling-functions-expression/test.js +++ b/modules/35-calling-functions/150-calling-functions-expression/test.js @@ -6,7 +6,7 @@ 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('First: N\nLast: t') }) diff --git a/modules/35-calling-functions/180-variadic-parameters/Makefile b/modules/35-calling-functions/180-variadic-parameters/Makefile index 24e31e38..990011b4 100644 --- a/modules/35-calling-functions/180-variadic-parameters/Makefile +++ b/modules/35-calling-functions/180-variadic-parameters/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/35-calling-functions/180-variadic-parameters/test.js b/modules/35-calling-functions/180-variadic-parameters/test.js index b84e27ba..7d0baf21 100644 --- a/modules/35-calling-functions/180-variadic-parameters/test.js +++ b/modules/35-calling-functions/180-variadic-parameters/test.js @@ -6,7 +6,7 @@ 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('-3') }) diff --git a/modules/35-calling-functions/270-deterministic/Makefile b/modules/35-calling-functions/270-deterministic/Makefile index 24e31e38..990011b4 100644 --- a/modules/35-calling-functions/270-deterministic/Makefile +++ b/modules/35-calling-functions/270-deterministic/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/35-calling-functions/270-deterministic/test.js b/modules/35-calling-functions/270-deterministic/test.js index d27c00ff..dcf272b8 100644 --- a/modules/35-calling-functions/270-deterministic/test.js +++ b/modules/35-calling-functions/270-deterministic/test.js @@ -6,7 +6,7 @@ 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).not.toEqual(''); const value = Number(firstArg); diff --git a/modules/35-calling-functions/350-stdlib/Makefile b/modules/35-calling-functions/350-stdlib/Makefile index 24e31e38..990011b4 100644 --- a/modules/35-calling-functions/350-stdlib/Makefile +++ b/modules/35-calling-functions/350-stdlib/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/35-calling-functions/350-stdlib/test.js b/modules/35-calling-functions/350-stdlib/test.js index 8b3e726b..182788a2 100644 --- a/modules/35-calling-functions/350-stdlib/test.js +++ b/modules/35-calling-functions/350-stdlib/test.js @@ -6,7 +6,7 @@ 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('string') }) diff --git a/modules/38-properties/100-properties-syntax/Makefile b/modules/38-properties/100-properties-syntax/Makefile index 24e31e38..990011b4 100644 --- a/modules/38-properties/100-properties-syntax/Makefile +++ b/modules/38-properties/100-properties-syntax/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/38-properties/100-properties-syntax/test.js b/modules/38-properties/100-properties-syntax/test.js index 8a3e9725..2ad052f2 100644 --- a/modules/38-properties/100-properties-syntax/test.js +++ b/modules/38-properties/100-properties-syntax/test.js @@ -6,7 +6,7 @@ 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(75) + expect(firstArg).toBe('75') }) diff --git a/modules/38-properties/200-properties-methods/Makefile b/modules/38-properties/200-properties-methods/Makefile index 24e31e38..990011b4 100644 --- a/modules/38-properties/200-properties-methods/Makefile +++ b/modules/38-properties/200-properties-methods/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/38-properties/200-properties-methods/test.js b/modules/38-properties/200-properties-methods/test.js index 231c09e0..f98c4736 100644 --- a/modules/38-properties/200-properties-methods/test.js +++ b/modules/38-properties/200-properties-methods/test.js @@ -6,7 +6,7 @@ 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('a mind needs books as a sword needs a whetstone, if it is to keep its edge.') }) diff --git a/modules/38-properties/300-properties-immutability/Makefile b/modules/38-properties/300-properties-immutability/Makefile index 24e31e38..990011b4 100644 --- a/modules/38-properties/300-properties-immutability/Makefile +++ b/modules/38-properties/300-properties-immutability/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/38-properties/300-properties-immutability/test.js b/modules/38-properties/300-properties-immutability/test.js index ffb48fb3..128549d6 100644 --- a/modules/38-properties/300-properties-immutability/test.js +++ b/modules/38-properties/300-properties-immutability/test.js @@ -6,7 +6,7 @@ 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('Grigor') }) diff --git a/modules/38-properties/400-properties-expressions/Makefile b/modules/38-properties/400-properties-expressions/Makefile index 24e31e38..990011b4 100644 --- a/modules/38-properties/400-properties-expressions/Makefile +++ b/modules/38-properties/400-properties-expressions/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/38-properties/400-properties-expressions/test.js b/modules/38-properties/400-properties-expressions/test.js index 36cb34b2..ac96751b 100644 --- a/modules/38-properties/400-properties-expressions/test.js +++ b/modules/38-properties/400-properties-expressions/test.js @@ -6,7 +6,7 @@ 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('First: N\nLast: t') }) diff --git a/modules/38-properties/500-properties-chain-of-methods/Makefile b/modules/38-properties/500-properties-chain-of-methods/Makefile index 24e31e38..990011b4 100644 --- a/modules/38-properties/500-properties-chain-of-methods/Makefile +++ b/modules/38-properties/500-properties-chain-of-methods/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/38-properties/500-properties-chain-of-methods/test.js b/modules/38-properties/500-properties-chain-of-methods/test.js index 420777c2..98dd8d4e 100644 --- a/modules/38-properties/500-properties-chain-of-methods/test.js +++ b/modules/38-properties/500-properties-chain-of-methods/test.js @@ -6,7 +6,7 @@ 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(7) + expect(firstArg).toBe('7') }) diff --git a/modules/40-define-functions/100-define-functions-syntax/Makefile b/modules/40-define-functions/100-define-functions-syntax/Makefile index 24e31e38..990011b4 100644 --- a/modules/40-define-functions/100-define-functions-syntax/Makefile +++ b/modules/40-define-functions/100-define-functions-syntax/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/40-define-functions/100-define-functions-syntax/test.js b/modules/40-define-functions/100-define-functions-syntax/test.js index 9c3f5f4a..5e1e705d 100644 --- a/modules/40-define-functions/100-define-functions-syntax/test.js +++ b/modules/40-define-functions/100-define-functions-syntax/test.js @@ -1,12 +1,13 @@ // @ts-check import { expect, test, vi } from 'vitest' +import f from './index.js'; test('hello world', async () => { const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); - await import('./index.js') + f() - const firstArg = consoleLogSpy.mock.calls[0]?.[0]; + const firstArg = consoleLogSpy.mock.calls.join('\n'); expect(firstArg).toBe('Winter is coming') }) diff --git a/modules/40-define-functions/150-define-functions-return/Makefile b/modules/40-define-functions/150-define-functions-return/Makefile index d0d0a48c..990011b4 100644 --- a/modules/40-define-functions/150-define-functions-return/Makefile +++ b/modules/40-define-functions/150-define-functions-return/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/40-define-functions/320-define-functions-parameters/Makefile b/modules/40-define-functions/320-define-functions-parameters/Makefile index d0d0a48c..990011b4 100644 --- a/modules/40-define-functions/320-define-functions-parameters/Makefile +++ b/modules/40-define-functions/320-define-functions-parameters/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/40-define-functions/340-define-functions-default-parameters/Makefile b/modules/40-define-functions/340-define-functions-default-parameters/Makefile index d0d0a48c..990011b4 100644 --- a/modules/40-define-functions/340-define-functions-default-parameters/Makefile +++ b/modules/40-define-functions/340-define-functions-default-parameters/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/40-define-functions/450-define-functions-short-syntax/Makefile b/modules/40-define-functions/450-define-functions-short-syntax/Makefile index d0d0a48c..990011b4 100644 --- a/modules/40-define-functions/450-define-functions-short-syntax/Makefile +++ b/modules/40-define-functions/450-define-functions-short-syntax/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/45-logic/10-bool-type/Makefile b/modules/45-logic/10-bool-type/Makefile index d0d0a48c..990011b4 100644 --- a/modules/45-logic/10-bool-type/Makefile +++ b/modules/45-logic/10-bool-type/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/45-logic/15-predicates/Makefile b/modules/45-logic/15-predicates/Makefile index d0d0a48c..990011b4 100644 --- a/modules/45-logic/15-predicates/Makefile +++ b/modules/45-logic/15-predicates/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/45-logic/20-logic-combine-expressions/Makefile b/modules/45-logic/20-logic-combine-expressions/Makefile index d0d0a48c..990011b4 100644 --- a/modules/45-logic/20-logic-combine-expressions/Makefile +++ b/modules/45-logic/20-logic-combine-expressions/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/45-logic/25-logical-operators/Makefile b/modules/45-logic/25-logical-operators/Makefile index d0d0a48c..990011b4 100644 --- a/modules/45-logic/25-logical-operators/Makefile +++ b/modules/45-logic/25-logical-operators/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/45-logic/28-logical-negation/Makefile b/modules/45-logic/28-logical-negation/Makefile index d0d0a48c..990011b4 100644 --- a/modules/45-logic/28-logical-negation/Makefile +++ b/modules/45-logic/28-logical-negation/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/45-logic/70-logical-expressions/Makefile b/modules/45-logic/70-logical-expressions/Makefile index d0d0a48c..990011b4 100644 --- a/modules/45-logic/70-logical-expressions/Makefile +++ b/modules/45-logic/70-logical-expressions/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/48-conditionals/30-if/Makefile b/modules/48-conditionals/30-if/Makefile index b7c38a92..943ecde3 100644 --- a/modules/48-conditionals/30-if/Makefile +++ b/modules/48-conditionals/30-if/Makefile @@ -1,3 +1,3 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/48-conditionals/40-if-else/Makefile b/modules/48-conditionals/40-if-else/Makefile index d0d0a48c..990011b4 100644 --- a/modules/48-conditionals/40-if-else/Makefile +++ b/modules/48-conditionals/40-if-else/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/48-conditionals/50-else-if/Makefile b/modules/48-conditionals/50-else-if/Makefile index d0d0a48c..990011b4 100644 --- a/modules/48-conditionals/50-else-if/Makefile +++ b/modules/48-conditionals/50-else-if/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/48-conditionals/60-ternary-operator/Makefile b/modules/48-conditionals/60-ternary-operator/Makefile index d0d0a48c..990011b4 100644 --- a/modules/48-conditionals/60-ternary-operator/Makefile +++ b/modules/48-conditionals/60-ternary-operator/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/48-conditionals/65-switch/Makefile b/modules/48-conditionals/65-switch/Makefile index d0d0a48c..990011b4 100644 --- a/modules/48-conditionals/65-switch/Makefile +++ b/modules/48-conditionals/65-switch/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/50-loops/10-while/Makefile b/modules/50-loops/10-while/Makefile index 24e31e38..990011b4 100644 --- a/modules/50-loops/10-while/Makefile +++ b/modules/50-loops/10-while/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/50-loops/10-while/test.js b/modules/50-loops/10-while/test.js index 42c980d7..d05d50b3 100644 --- a/modules/50-loops/10-while/test.js +++ b/modules/50-loops/10-while/test.js @@ -7,7 +7,7 @@ test('hello world', async () => { const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); f(6); - const firstArg = consoleLogSpy.mock.calls[0]?.[0]; + const firstArg = consoleLogSpy.mock.calls.join('\n'); expect(firstArg).toBe('6\n5\n4\n3\n2\n1\nfinished!') }) diff --git a/modules/50-loops/20-aggregation-numbers/Makefile b/modules/50-loops/20-aggregation-numbers/Makefile index d0d0a48c..990011b4 100644 --- a/modules/50-loops/20-aggregation-numbers/Makefile +++ b/modules/50-loops/20-aggregation-numbers/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/50-loops/23-aggregation-strings/Makefile b/modules/50-loops/23-aggregation-strings/Makefile index d0d0a48c..990011b4 100644 --- a/modules/50-loops/23-aggregation-strings/Makefile +++ b/modules/50-loops/23-aggregation-strings/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/50-loops/25-iteration-over-string/Makefile b/modules/50-loops/25-iteration-over-string/Makefile index 24e31e38..990011b4 100644 --- a/modules/50-loops/25-iteration-over-string/Makefile +++ b/modules/50-loops/25-iteration-over-string/Makefile @@ -1,2 +1,2 @@ test: - @ test-output.sh + @ test2.sh diff --git a/modules/50-loops/25-iteration-over-string/test.js b/modules/50-loops/25-iteration-over-string/test.js index 0525fc35..e6c0226d 100644 --- a/modules/50-loops/25-iteration-over-string/test.js +++ b/modules/50-loops/25-iteration-over-string/test.js @@ -7,7 +7,7 @@ test('hello world', async () => { const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); f('Hexlet') - const firstArg = consoleLogSpy.mock.calls[0]?.[0]; + const firstArg = consoleLogSpy.mock.calls.join('\n'); expect(firstArg).toBe('t\ne\nl\nx\ne\nH') }) diff --git a/modules/50-loops/26-conditions-inside-loops/Makefile b/modules/50-loops/26-conditions-inside-loops/Makefile index d0d0a48c..990011b4 100644 --- a/modules/50-loops/26-conditions-inside-loops/Makefile +++ b/modules/50-loops/26-conditions-inside-loops/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/50-loops/28-build-strings/Makefile b/modules/50-loops/28-build-strings/Makefile index d0d0a48c..990011b4 100644 --- a/modules/50-loops/28-build-strings/Makefile +++ b/modules/50-loops/28-build-strings/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/50-loops/30-syntax-sugar/Makefile b/modules/50-loops/30-syntax-sugar/Makefile index d0d0a48c..990011b4 100644 --- a/modules/50-loops/30-syntax-sugar/Makefile +++ b/modules/50-loops/30-syntax-sugar/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/50-loops/50-mutators/Makefile b/modules/50-loops/50-mutators/Makefile index d0d0a48c..990011b4 100644 --- a/modules/50-loops/50-mutators/Makefile +++ b/modules/50-loops/50-mutators/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/modules/50-loops/55-return-from-loops/Makefile b/modules/50-loops/55-return-from-loops/Makefile index d0d0a48c..990011b4 100644 --- a/modules/50-loops/55-return-from-loops/Makefile +++ b/modules/50-loops/55-return-from-loops/Makefile @@ -1,2 +1,2 @@ test: - @ test.sh + @ test2.sh diff --git a/vitest.config.js b/vitest.config.js index 6c034a83..b0d04711 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -1,4 +1,4 @@ -import { defineConfig } from 'vitest/config' +import { defineConfig } from 'vite' export default defineConfig({ test: {