diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 00000000..d4869ef9 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,26 @@ +name: Node.js CI + +on: + push: + branches: ['main'] + pull_request: + branches: ['main'] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm install + - run: npm test 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 @@