diff --git a/.github/workflows/checkin.yml b/.github/workflows/checkin.yml index 7563e179..a4383f1b 100644 --- a/.github/workflows/checkin.yml +++ b/.github/workflows/checkin.yml @@ -1,5 +1,5 @@ name: '[🔨] Checkin' -run-name: '[🔨] Checkin: ${{ github.ref }}' +run-name: '[🔨] Checkin: ${{ github.head_ref }}' on: workflow_dispatch: pull_request: @@ -10,7 +10,7 @@ on: - synchronize jobs: - main: + Test: runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/commit-message-checker.yml b/.github/workflows/commit-message-checker.yml index 6342656c..2a68845c 100644 --- a/.github/workflows/commit-message-checker.yml +++ b/.github/workflows/commit-message-checker.yml @@ -1,5 +1,5 @@ name: '[📒] Commit Message Checker' -run-name: '[📒] Commit Message Checker: ${{ github.ref }}' +run-name: '[📒] Commit Message Checker: ${{ github.head_ref }}' on: pull_request: types: diff --git a/.github/workflows/style-checker.yml b/.github/workflows/style-checker.yml index 5548cdae..dd81dde2 100644 --- a/.github/workflows/style-checker.yml +++ b/.github/workflows/style-checker.yml @@ -1,5 +1,5 @@ name: '[🎨] Style Checker' -run-name: '[🎨] Style Checker: ${{ github.ref }}' +run-name: '[🎨] Style Checker: ${{ github.head_ref }}' on: workflow_dispatch: pull_request: @@ -10,7 +10,7 @@ on: - synchronize jobs: - main: + Lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/development/src/game.ts b/development/src/game.ts index 7f368a15..c4bb88c4 100644 --- a/development/src/game.ts +++ b/development/src/game.ts @@ -1,19 +1,19 @@ -import { Logger } from './logger'; +import { Logger } from './ui/logger'; import { initializeEventListeners, setOnAction, setOnFallOffTheBoard, setOnHighlight, -} from './events'; -import { highlightSquare, initializeBoards } from './boards'; +} from './ui/events'; +import { highlightSquare, initializeBoards } from './ui/boards'; import { onAction, onFallOffTheBoard, getCurrentPlayer, players, roundCounter, -} from './logic'; -import { Rule } from './rules'; +} from './logic/logic'; +import { Rule } from './logic/rules'; const infoDisplay = document.getElementById('info-display'); const rulesContainer = document.getElementById('rules-container'); diff --git a/development/src/logic/constants.ts b/development/src/logic/constants.ts new file mode 100644 index 00000000..c7659699 --- /dev/null +++ b/development/src/logic/constants.ts @@ -0,0 +1,21 @@ +export const OVERWORLD_BOARD_ID = 'board-overworld'; +export const HELL_BOARD_ID = 'board-hell'; +export const HEAVEN_BOARD_ID = 'board-heaven'; +export const BOTTOM_NOTATION_ID = 'bottom-notations'; +export const LEFT_NOTATION_ID = 'left-notations'; + +export const OVERWORLD_BOARD_BUTTON_ID = 'board-overworld-button'; +export const HELL_BOARD_BUTTON_ID = 'board-hell-button'; +export const HEAVEN_BOARD_BUTTON_ID = 'board-heaven-button'; + +export const LIGHT_OVERWORLD_SQUARE_COLOR = 'beige-background'; +export const DARK_OVERWORLD_SQUARE_COLOR = 'brown-background'; +export const LIGHT_HELL_SQUARE_COLOR = 'dark-orange-background'; +export const DARK_HELL_SQUARE_COLOR = 'dark-red-background'; +export const LIGHT_HEAVEN_SQUARE_COLOR = 'water-background'; +export const DARK_HEAVEN_SQUARE_COLOR = 'blue-background'; +export const GRAY_SQUARE_COLOR = 'light-gray-background'; + +export const NOTATIONS_LETTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']; +export const NOTATIONS_NUMBERS = ['8', '7', '6', '5', '4', '3', '2', '1']; +export const BOARD_WIDTH = 8; diff --git a/development/src/items.ts b/development/src/logic/items.ts similarity index 71% rename from development/src/items.ts rename to development/src/logic/items.ts index 601a5900..674a9e6f 100644 --- a/development/src/items.ts +++ b/development/src/logic/items.ts @@ -1,9 +1,6 @@ -import { spawnItemOnBoard } from './boards'; -import { Logger } from './logger'; -import { items } from './logic'; +import { Logger } from '../ui/logger'; import { Piece, Position } from './pieces'; import { Player } from './players'; -import { trapResource } from './resources'; export class Inventory { items: Array = []; @@ -64,19 +61,3 @@ export class Item implements ItemType { Logger.logGeneral(`${piece.player.color} used a ${this.name}.`); }; } - -export class Trap extends Item { - constructor(player: Player, position: Position) { - super('trap', trapResource, player, position); - } - - apply(piece: Piece) { - Logger.logGeneral(`${this.player.color} ${piece.name} - placed a ${this.name} on ${piece.position.coordinates}.`); - - this.position = piece.position; - items.push(this); - - spawnItemOnBoard(this); - } -} diff --git a/development/src/logic.ts b/development/src/logic/logic.ts similarity index 96% rename from development/src/logic.ts rename to development/src/logic/logic.ts index 6e51ef25..df3edf35 100644 --- a/development/src/logic.ts +++ b/development/src/logic/logic.ts @@ -1,4 +1,4 @@ -import { Player } from './players'; +import { Player, PlayerColors } from './players'; import { Piece, Pawn, @@ -10,24 +10,17 @@ import { Square, Position, } from './pieces'; -import { Logger } from './logger'; +import { Logger } from '../ui/logger'; import { movePieceOnBoard, destroyPieceOnBoard, spawnPieceOnBoard, - OVERWORLD_BOARD_ID, - HELL_BOARD_ID, - HEAVEN_BOARD_ID, destroyItemOnBoard, -} from './boards'; +} from '../ui/boards'; import { activeRules } from './rules'; -import { updatePlayersInformation } from './game'; +import { updatePlayersInformation } from '../game'; import { Item } from './items'; - -export enum PlayerColors { - WHITE = 'White', - BLACK = 'Black', -}; +import { HEAVEN_BOARD_ID, HELL_BOARD_ID, OVERWORLD_BOARD_ID } from './constants'; const whitePlayer = new Player(PlayerColors.WHITE); const blackPlayer = new Player(PlayerColors.BLACK); @@ -100,12 +93,6 @@ export function switchIsCastling() { isCastling = !isCastling; } -export function getPieceByPosition( - position: Position, -): Piece | undefined { - return pieces.find((piece) => comparePositions(position, piece.position)); -} - export function getPieceByPositionAndBoard( position: Position, ): Piece | undefined { diff --git a/development/src/logic/pieces.test.ts b/development/src/logic/pieces.test.ts new file mode 100644 index 00000000..6fed0438 --- /dev/null +++ b/development/src/logic/pieces.test.ts @@ -0,0 +1,205 @@ +import { OVERWORLD_BOARD_ID } from './constants'; +import { Player, PlayerColors } from './players'; +import { Position, Pawn, Bishop, Knight, Rook, Queen, King } from './pieces'; + +const whitePlayer = new Player(PlayerColors.WHITE); +const blackPlayer = new Player(PlayerColors.BLACK); + +function comparePositions( + firstPosition: Position, + secondPosition: Position, +): boolean { + const arePositionsEqual = + firstPosition.coordinates[0] === secondPosition.coordinates[0] && + firstPosition.coordinates[1] === secondPosition.coordinates[1]; + const areBoardsEqual = firstPosition.board === secondPosition.board; + + return areBoardsEqual && arePositionsEqual; +} + +jest.mock('./logic', () => ({ + getCurrentPlayer: () => whitePlayer, + switchIsCastling: jest.fn(), + items: [], + comparePositions: comparePositions, + getPieceByPositionAndBoard: () => undefined, +})); + +describe('Piece movements', () => { + test('Validating Pawn movement', () => { + const initialPosition: Position = { + coordinates: [0, 6], + board: OVERWORLD_BOARD_ID, + }; + const pawn = new Pawn(initialPosition, whitePlayer); + + const singleStepMove: Position = { + coordinates: [0, 5], + board: OVERWORLD_BOARD_ID, + }; + const singleStepValidMove = pawn.validateMove({ + position: singleStepMove, + }); + expect(singleStepValidMove).toEqual(singleStepMove); + + pawn.position = initialPosition; + const twoStepsInitialMove: Position = { + coordinates: [0, 4], + board: OVERWORLD_BOARD_ID, + }; + const twoStepsInitialValidMove = pawn.validateMove({ + position: twoStepsInitialMove, + }); + expect(twoStepsInitialValidMove).toEqual(twoStepsInitialMove); + + const diagonalAttackMove = new Pawn( + { + coordinates: [1, 5], + board: OVERWORLD_BOARD_ID, + }, + blackPlayer, + ); + const diagonalAttackValidMove = pawn.validateMove(diagonalAttackMove); + expect(diagonalAttackValidMove).toEqual(diagonalAttackMove.position); + + pawn.position = initialPosition; + const invalidPosition: Position = { + coordinates: [0, 3], + board: OVERWORLD_BOARD_ID, + }; + const invalidMove = pawn.validateMove({ position: invalidPosition }); + expect(invalidMove).toEqual(initialPosition); + }); + + test('Validating Bishop movement', () => { + const initialPosition: Position = { + coordinates: [2, 7], + board: OVERWORLD_BOARD_ID, + }; + const bishop = new Bishop(initialPosition, whitePlayer); + + const newPosition: Position = { + coordinates: [4, 5], + board: OVERWORLD_BOARD_ID, + }; + const validMove = bishop.validateMove({ position: newPosition }); + expect(validMove).toEqual(newPosition); + + const invalidPosition: Position = { + coordinates: [2, 2], + board: OVERWORLD_BOARD_ID, + }; + const invalidMove = bishop.validateMove({ position: invalidPosition }); + expect(invalidMove).toEqual(initialPosition); + }); + + test('Validating Knight movement', () => { + const initialPosition: Position = { + coordinates: [1, 7], + board: OVERWORLD_BOARD_ID, + }; + const knight = new Knight(initialPosition, whitePlayer); + + const newPosition: Position = { + coordinates: [2, 5], + board: OVERWORLD_BOARD_ID, + }; + const validMove = knight.validateMove({ position: newPosition }); + expect(validMove).toEqual(newPosition); + + const invalidPosition: Position = { + coordinates: [1, 5], + board: OVERWORLD_BOARD_ID, + }; + const invalidMove = knight.validateMove({ position: invalidPosition }); + expect(invalidMove).toEqual(initialPosition); + }); + + test('Validating Rook movement', () => { + const initialPosition: Position = { + coordinates: [0, 7], + board: OVERWORLD_BOARD_ID, + }; + const rook = new Rook(initialPosition, whitePlayer); + + const newPosition: Position = { + coordinates: [7, 7], + board: OVERWORLD_BOARD_ID, + }; + const validMove = rook.validateMove({ position: newPosition }); + expect(validMove).toEqual(newPosition); + + const invalidPosition: Position = { + coordinates: [1, 6], + board: OVERWORLD_BOARD_ID, + }; + const invalidMove = rook.validateMove({ position: invalidPosition }); + expect(invalidMove).toEqual(initialPosition); + }); + + test('Validating Queen movement', () => { + const initialPosition: Position = { + coordinates: [3, 7], + board: OVERWORLD_BOARD_ID, + }; + const queen = new Queen(initialPosition, whitePlayer); + + const newStraightPosition: Position = { + coordinates: [3, 4], + board: OVERWORLD_BOARD_ID, + }; + const validStraightMove = queen.validateMove({ + position: newStraightPosition, + }); + expect(validStraightMove).toEqual(newStraightPosition); + + const newDiagonalPosition: Position = { + coordinates: [6, 4], + board: OVERWORLD_BOARD_ID, + }; + const validDiagonalMove = queen.validateMove({ + position: newDiagonalPosition, + }); + expect(validDiagonalMove).toEqual(newDiagonalPosition); + + const invalidPosition: Position = { + coordinates: [0, 0], + board: OVERWORLD_BOARD_ID, + }; + const invalidMove = queen.validateMove({ position: invalidPosition }); + expect(invalidMove).toEqual(initialPosition); + }); + + test('Validating King movement', () => { + const initialPosition: Position = { + coordinates: [4, 7], + board: OVERWORLD_BOARD_ID, + }; + const king = new King(initialPosition, whitePlayer); + + const newStraightPosition: Position = { + coordinates: [4, 6], + board: OVERWORLD_BOARD_ID, + }; + const validStraightMove = king.validateMove({ + position: newStraightPosition, + }); + expect(validStraightMove).toEqual(newStraightPosition); + + const newDiagonalPosition: Position = { + coordinates: [5, 8], + board: OVERWORLD_BOARD_ID, + }; + const validDiagonalMove = king.validateMove({ + position: newDiagonalPosition, + }); + expect(validDiagonalMove).toEqual(newDiagonalPosition); + + const invalidPosition: Position = { + coordinates: [0, 0], + board: OVERWORLD_BOARD_ID, + }; + const invalidMove = king.validateMove({ position: invalidPosition }); + expect(invalidMove).toEqual(initialPosition); + }); +}); \ No newline at end of file diff --git a/development/src/pieces.ts b/development/src/logic/pieces.ts similarity index 98% rename from development/src/pieces.ts rename to development/src/logic/pieces.ts index 8d927db3..d4f4a63a 100644 --- a/development/src/pieces.ts +++ b/development/src/logic/pieces.ts @@ -5,18 +5,17 @@ import { rookResource, queenResource, kingResource, -} from './resources'; -import { Player } from './players'; +} from '../ui/resources'; +import { Player, PlayerColors } from './players'; import { getCurrentPlayer, switchIsCastling, getPieceByPositionAndBoard, items, comparePositions, - PlayerColors, } from './logic'; -import { OVERWORLD_BOARD_ID } from './boards'; import { Item } from './items'; +import { OVERWORLD_BOARD_ID } from './constants'; export type Position = { coordinates: [number, number], diff --git a/development/src/players.ts b/development/src/logic/players.ts similarity index 84% rename from development/src/players.ts rename to development/src/logic/players.ts index 394e6560..cf74e317 100644 --- a/development/src/players.ts +++ b/development/src/logic/players.ts @@ -7,6 +7,11 @@ type PlayerType = { inventory: Inventory; }; +export enum PlayerColors { + WHITE = 'White', + BLACK = 'Black', +}; + export class Player implements PlayerType { color: string; xp: number; diff --git a/development/src/rules.ts b/development/src/logic/rules.ts similarity index 97% rename from development/src/rules.ts rename to development/src/logic/rules.ts index 2259bfc9..d0f0fc10 100644 --- a/development/src/rules.ts +++ b/development/src/logic/rules.ts @@ -7,8 +7,8 @@ import { roundCounter, players, } from './logic'; -import { Logger } from './logger'; -import { updateRules } from './game'; +import { Logger } from '../ui/logger'; +import { updateRules } from '../game'; export class Rule { id: number; diff --git a/development/src/logic/trap.ts b/development/src/logic/trap.ts new file mode 100644 index 00000000..41c96581 --- /dev/null +++ b/development/src/logic/trap.ts @@ -0,0 +1,24 @@ +import { Item } from './items'; +import { Player } from './players'; +import { Piece, Position } from './pieces'; +import { items } from './logic'; +import { Logger } from '../ui/logger'; +import { spawnItemOnBoard } from '../ui/boards'; +import { trapResource } from '../ui/resources'; + + +export class Trap extends Item { + constructor(player: Player, position: Position) { + super('trap', trapResource, player, position); + } + + apply(piece: Piece) { + Logger.logGeneral(`${this.player.color} ${piece.name} + placed a ${this.name} on ${piece.position.coordinates}.`); + + this.position = piece.position; + items.push(this); + + spawnItemOnBoard(this); + } +} \ No newline at end of file diff --git a/development/src/board.ts b/development/src/ui/board.ts similarity index 93% rename from development/src/board.ts rename to development/src/ui/board.ts index 147c05be..14cb1258 100644 --- a/development/src/board.ts +++ b/development/src/ui/board.ts @@ -1,10 +1,7 @@ -import { Item } from './items'; -import { pieces } from './logic'; -import { Piece, Square } from './pieces'; - -export const NOTATIONS_LETTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']; -export const NOTATIONS_NUMBERS = ['8', '7', '6', '5', '4', '3', '2', '1']; -export const BOARD_WIDTH = 8; +import { BOARD_WIDTH } from '../logic/constants'; +import { Item } from '../logic/items'; +import { pieces } from '../logic/logic'; +import { Piece, Square } from '../logic/pieces'; interface ChessBoardType { boardElement: HTMLElement; diff --git a/development/src/boards.ts b/development/src/ui/boards.ts similarity index 75% rename from development/src/boards.ts rename to development/src/ui/boards.ts index 03133490..f90c1baa 100644 --- a/development/src/boards.ts +++ b/development/src/ui/boards.ts @@ -1,20 +1,30 @@ -import { BOARD_WIDTH, ChessBoard } from './board'; -import { Item } from './items'; -import { Piece, Square } from './pieces'; +import { ChessBoard } from './board'; +import { + BOARD_WIDTH, + BOTTOM_NOTATION_ID, + DARK_HEAVEN_SQUARE_COLOR, + DARK_HELL_SQUARE_COLOR, + DARK_OVERWORLD_SQUARE_COLOR, + GRAY_SQUARE_COLOR, + HEAVEN_BOARD_BUTTON_ID, + HEAVEN_BOARD_ID, + HELL_BOARD_BUTTON_ID, + HELL_BOARD_ID, + LEFT_NOTATION_ID, + LIGHT_HEAVEN_SQUARE_COLOR, + LIGHT_HELL_SQUARE_COLOR, + LIGHT_OVERWORLD_SQUARE_COLOR, + NOTATIONS_LETTERS, + NOTATIONS_NUMBERS, + OVERWORLD_BOARD_ID, +} from '../logic/constants'; +import { Item } from '../logic/items'; +import { Piece, Square } from '../logic/pieces'; let overworld: ChessBoard; let hell: ChessBoard; let heaven: ChessBoard; -export const OVERWORLD_BOARD_ID = 'board-overworld'; -export const HELL_BOARD_ID = 'board-hell'; -export const HEAVEN_BOARD_ID = 'board-heaven'; -export const BOTTOM_NOTATION_ID = 'bottom-notations'; -export const LEFT_NOTATION_ID = 'left-notations'; - -export const NOTATIONS_LETTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']; -export const NOTATIONS_NUMBERS = ['8', '7', '6', '5', '4', '3', '2', '1']; - export const OVERWORLD_BOARD = document.getElementById( OVERWORLD_BOARD_ID, ) as HTMLElement; @@ -31,30 +41,27 @@ export const LEFT_NOTATION_CONTAINER = document.getElementById( LEFT_NOTATION_ID, ) as HTMLElement; const HELL_BOARD_BUTTON = document.getElementById( - 'board-hell-button', + HELL_BOARD_BUTTON_ID, ) as HTMLElement; const HEAVEN_BOARD_BUTTON = document.getElementById( - 'board-heaven-button', + HEAVEN_BOARD_BUTTON_ID, ) as HTMLElement; -const lightOverworldSquareColor = 'beige-background'; -const darkOverworldSquareColor = 'brown-background'; -const lightHellSquareColor = 'dark-orange-background'; -const darkHellSquareColor = 'dark-red-background'; -const lightHeavenSquareColor = 'water-background'; -const darkHeavenSquareColor = 'blue-background'; - export function initializeBoards() { overworld = new ChessBoard( OVERWORLD_BOARD, - lightOverworldSquareColor, - darkOverworldSquareColor, + LIGHT_OVERWORLD_SQUARE_COLOR, + DARK_OVERWORLD_SQUARE_COLOR, + ); + hell = new ChessBoard( + HELL_BOARD, + LIGHT_HELL_SQUARE_COLOR, + DARK_HELL_SQUARE_COLOR, ); - hell = new ChessBoard(HELL_BOARD, lightHellSquareColor, darkHellSquareColor); heaven = new ChessBoard( HEAVEN_BOARD, - lightHeavenSquareColor, - darkHeavenSquareColor, + LIGHT_HEAVEN_SQUARE_COLOR, + DARK_HEAVEN_SQUARE_COLOR, ); generateNotations(); } @@ -156,9 +163,9 @@ export function highlightSquare(target: HTMLElement, shouldHighlight: boolean) { } if (target.classList.contains('square')) { if (shouldHighlight) { - target.classList.add('light-gray-background'); + target.classList.add(GRAY_SQUARE_COLOR); } else { - target.classList.remove('light-gray-background'); + target.classList.remove(GRAY_SQUARE_COLOR); } } } diff --git a/development/src/events.ts b/development/src/ui/events.ts similarity index 90% rename from development/src/events.ts rename to development/src/ui/events.ts index 89a75ecc..e8d1c59e 100644 --- a/development/src/events.ts +++ b/development/src/ui/events.ts @@ -1,3 +1,4 @@ +import { HEAVEN_BOARD_BUTTON_ID, HELL_BOARD_BUTTON_ID, OVERWORLD_BOARD_BUTTON_ID } from '../logic/constants'; import { HEAVEN_BOARD, HELL_BOARD, OVERWORLD_BOARD } from './boards'; let draggedElement: HTMLElement; @@ -12,9 +13,11 @@ let triggerOnFallOffTheBoard: ( board: string, ) => void; -const OVERWORLD_BOARD_BUTTON = document.getElementById('board-overworld-button'); -const HELL_BOARD_BUTTON = document.getElementById('board-hell-button'); -const HEAVEN_BOARD_BUTTON = document.getElementById('board-heaven-button'); +const OVERWORLD_BOARD_BUTTON = document.getElementById( + OVERWORLD_BOARD_BUTTON_ID, +); +const HELL_BOARD_BUTTON = document.getElementById(HELL_BOARD_BUTTON_ID); +const HEAVEN_BOARD_BUTTON = document.getElementById(HEAVEN_BOARD_BUTTON_ID); let triggerOnHighlight: (target: HTMLElement, shouldHighlight: boolean) => void; diff --git a/development/src/logger.ts b/development/src/ui/logger.ts similarity index 91% rename from development/src/logger.ts rename to development/src/ui/logger.ts index 43767afc..938921fc 100644 --- a/development/src/logger.ts +++ b/development/src/ui/logger.ts @@ -1,5 +1,5 @@ -import { NOTATIONS_LETTERS, NOTATIONS_NUMBERS } from './board'; -import { Piece, Square } from './pieces'; +import { NOTATIONS_LETTERS, NOTATIONS_NUMBERS } from '../logic/constants'; +import { Piece, Square } from '../logic/pieces'; enum LogColor { general = 'log-color-general', diff --git a/development/src/resources.ts b/development/src/ui/resources.ts similarity index 100% rename from development/src/resources.ts rename to development/src/ui/resources.ts diff --git a/jest.config.ts b/jest.config.ts index 9ec1189d..f2b4855e 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -2,8 +2,9 @@ export default { displayName: 'chess-but-better', coverageDirectory: './coverage/chess-but-better', + preset: 'ts-jest', + testEnvironment: 'node', testMatch: [ - '/src/**/__tests__/**/*.[jt]s?(x)', - '/src/**/*(*.)@(spec|test).[jt]s?(x)', + '/development/src/**/*.test.ts', ], }; diff --git a/package-lock.json b/package-lock.json index 82497e99..d37eba89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@typescript-eslint/parser": "^5.60.1", "eslint": "~8.46.0", "eslint-config-prettier": "8.1.0", - "jest": "^29.4.1", + "jest": "^29.7.0", "jest-environment-jsdom": "^29.4.1", "nx": "16.10.0", "nx-cloud": "latest", @@ -5426,6 +5426,7 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "deprecated": "Use your platform's native atob() and btoa() methods instead", "dev": true }, "node_modules/abortcontroller-polyfill": { @@ -5483,18 +5484,6 @@ "node": ">= 10.0.0" } }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -6427,38 +6416,6 @@ "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", "dev": true }, - "node_modules/cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "dependencies": { - "cssom": "~0.3.6" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cssstyle/node_modules/cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - }, - "node_modules/data-urls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", - "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", - "dev": true, - "dependencies": { - "abab": "^2.0.6", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -6652,6 +6609,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "deprecated": "Use your platform's native DOMException instead", "dev": true, "dependencies": { "webidl-conversions": "^7.0.0" @@ -7696,18 +7654,6 @@ "node": "14 || >=16.14" } }, - "node_modules/html-encoding-sniffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", - "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", - "dev": true, - "dependencies": { - "whatwg-encoding": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -7836,33 +7782,6 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dev": true, - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -8544,6 +8463,201 @@ } } }, + "node_modules/jest-environment-jsdom/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-environment-jsdom/node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + }, + "node_modules/jest-environment-jsdom/node_modules/data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-environment-jsdom/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-environment-jsdom/node_modules/jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jest-environment-jsdom/node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dev": true, + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/jest-environment-jsdom/node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/jest-environment-node": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", @@ -8945,51 +9059,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsdom": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", - "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", - "dev": true, - "dependencies": { - "abab": "^2.0.6", - "acorn": "^8.8.1", - "acorn-globals": "^7.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.2", - "decimal.js": "^10.4.2", - "domexception": "^4.0.0", - "escodegen": "^2.0.0", - "form-data": "^4.0.0", - "html-encoding-sniffer": "^3.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.1", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.2", - "parse5": "^7.1.1", - "saxes": "^6.0.0", - "symbol-tree": "^3.2.4", - "tough-cookie": "^4.1.2", - "w3c-xmlserializer": "^4.0.0", - "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^2.0.0", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0", - "ws": "^8.11.0", - "xml-name-validator": "^4.0.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "canvas": "^2.5.0" - }, - "peerDependenciesMeta": { - "canvas": { - "optional": true - } - } - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -11121,18 +11190,6 @@ "node": ">= 4.0.0" } }, - "node_modules/tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", - "dev": true, - "dependencies": { - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/ts-jest": { "version": "29.1.1", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", @@ -11465,18 +11522,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/w3c-xmlserializer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", - "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", - "dev": true, - "dependencies": { - "xml-name-validator": "^4.0.0" - }, - "engines": { - "node": ">=14" - } - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -11510,40 +11555,6 @@ "node": ">=12" } }, - "node_modules/whatwg-encoding": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", - "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", - "dev": true, - "dependencies": { - "iconv-lite": "0.6.3" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/whatwg-mimetype": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", - "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", - "dev": true, - "dependencies": { - "tr46": "^3.0.0", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -11616,15 +11627,6 @@ } } }, - "node_modules/xml-name-validator": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", - "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", - "dev": true, - "engines": { - "node": ">=12" - } - }, "node_modules/xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", diff --git a/package.json b/package.json index 48ab90d1..07898e68 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@typescript-eslint/parser": "^5.60.1", "eslint": "~8.46.0", "eslint-config-prettier": "8.1.0", - "jest": "^29.4.1", + "jest": "^29.7.0", "jest-environment-jsdom": "^29.4.1", "nx": "16.10.0", "nx-cloud": "latest",