From 54473e5c3f051cabded6f6fd0795f9b0a274512d Mon Sep 17 00:00:00 2001 From: KC Ng Date: Tue, 10 Dec 2024 23:26:45 +0900 Subject: [PATCH 1/3] fix: adding coverage/ exclusion from tsconfig and vitest config --- tsconfig.json | 3 +++ vitest.config.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/tsconfig.json b/tsconfig.json index 3550bc20..b70867a7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,9 @@ "src/**/*", "public/card-actions.js" ], + "exclude": [ + "coverage/", + ], "extends": [ "astro/tsconfigs/strictest" ] diff --git a/vitest.config.ts b/vitest.config.ts index 87ecc5a8..500af3b1 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -20,6 +20,7 @@ export default getViteConfig( '.vscode/**', '.github/**', 'public/**', + 'coverage/', '**/node_modules/**', '**/*.astro', '**/script.js', From 52bb638344d0cc38d67b811e11dcf6486e247639 Mon Sep 17 00:00:00 2001 From: KC Ng Date: Fri, 13 Dec 2024 23:12:33 +0900 Subject: [PATCH 2/3] feat: (WIP) testing logger --- astro.config.mjs | 10 +++++++--- src/pages/api/json-files.js | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 1212d26c..fccba155 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,5 +1,9 @@ -import { defineConfig } from 'astro/config'; +import { defineConfig } from "astro/config" + +import inoxToolsRuntimeLogger from "@inox-tools/runtime-logger" export default defineConfig({ - site: 'https://astro-devpedia.pages.dev/', -}); + site: "https://astro-devpedia.pages.dev/", + // Reference - https://inox-tools.fryuni.dev/runtime-logger + integrations: [inoxToolsRuntimeLogger()] +}) diff --git a/src/pages/api/json-files.js b/src/pages/api/json-files.js index cfee275d..7eacfbb6 100644 --- a/src/pages/api/json-files.js +++ b/src/pages/api/json-files.js @@ -1,3 +1,5 @@ +import { logger } from "@it-astro:logger" + export async function GET() { try { // Dynamically import fs and path @@ -17,6 +19,9 @@ export async function GET() { }) const responseBody = JSON.stringify(titles) + // Testing logger + // Todo: configure log file location + logger.info("test") return new Response(responseBody, { headers: { "Content-Type": "application/json" From d0eb8610b2b7ce1babe46525ded025c3d3426c3f Mon Sep 17 00:00:00 2001 From: KC Ng Date: Wed, 8 Jan 2025 00:00:03 +0900 Subject: [PATCH 3/3] fix: remove logging due to modules cannot be found --- src/pages/api/json-files.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/pages/api/json-files.js b/src/pages/api/json-files.js index 7eacfbb6..cfee275d 100644 --- a/src/pages/api/json-files.js +++ b/src/pages/api/json-files.js @@ -1,5 +1,3 @@ -import { logger } from "@it-astro:logger" - export async function GET() { try { // Dynamically import fs and path @@ -19,9 +17,6 @@ export async function GET() { }) const responseBody = JSON.stringify(titles) - // Testing logger - // Todo: configure log file location - logger.info("test") return new Response(responseBody, { headers: { "Content-Type": "application/json"