From 1545665fce6234eb286c57c5696563bb89388c3c Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Mon, 1 May 2023 23:42:41 +0300 Subject: [PATCH] test: clean tests, add coverage + verbose --- __tests__/lexer_test.ts | 12 ++++++------ __tests__/parser_test.ts | 1 - jest.config.js | 2 ++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/__tests__/lexer_test.ts b/__tests__/lexer_test.ts index 2e7b07d..68a7098 100644 --- a/__tests__/lexer_test.ts +++ b/__tests__/lexer_test.ts @@ -89,7 +89,7 @@ describe('Groups', () => { }) describe('Logical operator OR', () => { - test('should parse OR separator', () => { + test('Should parse OR separator', () => { const reader = new StringReader('word OR word') const lexer = new Lexer(reader) const tokens = lexer.parse() @@ -110,7 +110,7 @@ describe('Logical operator OR', () => { expect(tokens[4].value).toBe('word') }) - test('should not parse OR separator mid-word', () => { + test('Should not parse OR separator mid-word', () => { const reader = new StringReader('wordORword') const lexer = new Lexer(reader) const tokens = lexer.parse() @@ -119,7 +119,7 @@ describe('Logical operator OR', () => { expect(tokens[0].value).toBe('wordORword') }) - test('should parse | separator', () => { + test('Should parse | separator', () => { const reader = new StringReader('word | word') const lexer = new Lexer(reader) const tokens = lexer.parse() @@ -142,7 +142,7 @@ describe('Logical operator OR', () => { }) describe('Logical operator AND', () => { - test('should parse AND separator', () => { + test('Should parse AND separator', () => { const reader = new StringReader('word AND word') const lexer = new Lexer(reader) const tokens = lexer.parse() @@ -163,7 +163,7 @@ describe('Logical operator AND', () => { expect(tokens[4].value).toBe('word') }) - test('should not parse AND separator mid-word', () => { + test('Should not parse AND separator mid-word', () => { const reader = new StringReader('wordANDword') const lexer = new Lexer(reader) const tokens = lexer.parse() @@ -172,7 +172,7 @@ describe('Logical operator AND', () => { expect(tokens[0].value).toBe('wordANDword') }) - test('should parse & separator', () => { + test('Should parse & separator', () => { const reader = new StringReader('word & word') const lexer = new Lexer(reader) const tokens = lexer.parse() diff --git a/__tests__/parser_test.ts b/__tests__/parser_test.ts index 38933a4..3236873 100644 --- a/__tests__/parser_test.ts +++ b/__tests__/parser_test.ts @@ -57,7 +57,6 @@ test('should parse multiple groups and logical operators', () => { const lexer = new Lexer(reader) const parser = new Parser(lexer) const tokens = parser.parse() - console.log('tokens', JSON.stringify(tokens, undefined, 2)) expect(tokens[0]).toEqual({ type: 'operator', value: 'and', diff --git a/jest.config.js b/jest.config.js index 43cbbdc..6e64b35 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,9 @@ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ module.exports = { + verbose: true, preset: 'ts-jest', testEnvironment: 'node', + collectCoverage: true, testMatch: [ '**/tests/**/*.[jt]s?(x)', '**/__tests__/**/*.[jt]s?(x)',