From 08fce6f0231c1282b7da20e565fcd4c8483451f1 Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Sat, 8 Jul 2023 14:54:02 -0700 Subject: [PATCH] feat: Add vitest --- package.json | 6 +- src/lib/components/util/RelativeDate.svelte | 3 +- tests/relativedate.test.ts | 32 + vite.config.ts | 3 +- vitest.config.ts | 11 + yarn.lock | 828 +++++++++++++++++--- 6 files changed, 748 insertions(+), 135 deletions(-) create mode 100644 tests/relativedate.test.ts create mode 100644 vitest.config.ts diff --git a/package.json b/package.json index b47014f9..2bfb3c42 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "vite dev", "build": "vite build", + "test": "vitest", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" @@ -14,9 +15,9 @@ "@sveltejs/kit": "^1.5.0", "@types/nprogress": "^0.2.0", "autoprefixer": "^10.4.14", + "jsdom": "^22.1.0", "nprogress": "^0.2.0", "postcss": "^8.4.24", - "rollup-plugin-visualizer": "^5.9.2", "svelte": "^3.54.0", "svelte-check": "^3.0.1", "svelte-hero-icons": "^5.0.0", @@ -24,7 +25,8 @@ "tailwindcss": "^3.3.2", "tslib": "^2.4.1", "typescript": "^5.0.0", - "vite": "^4.3.0" + "vite": "^4.3.0", + "vitest": "^0.33.0" }, "dependencies": { "lemmy-js-client": "^0.18.0-rc.2" diff --git a/src/lib/components/util/RelativeDate.svelte b/src/lib/components/util/RelativeDate.svelte index d5a5e4ec..03627064 100644 --- a/src/lib/components/util/RelativeDate.svelte +++ b/src/lib/components/util/RelativeDate.svelte @@ -1,8 +1,9 @@