test: fix relative path

This commit is contained in:
YunYouJun
2024-01-27 03:45:50 +08:00
parent e741f5d5a0
commit f59c34499a
5 changed files with 13 additions and 7 deletions

View File

@@ -3,11 +3,11 @@ import pkg from '~/package.json'
const commitSha = (import.meta.env.VITE_COMMIT_REF || '').slice(0, 7)
const now = import.meta.env.VITE_APP_BUILD_TIME
const buildDate = (new Date(Number.parseInt(now) * 1000)).toLocaleDateString()
const buildDate = (new Date(Number.parseInt(now))).toLocaleDateString()
</script>
<template>
<div v-if="commitSha && buildDate" mb-2 text-sm>
<div mb-2 text-sm>
<span>
当前版本 v{{ pkg.version }}{{ buildDate }}:
</span>

View File

@@ -1,8 +1,8 @@
import { acceptHMRUpdate, defineStore } from 'pinia'
import { useStorage } from '@vueuse/core'
import { ref } from 'vue'
import { defaultSettings } from '~/utils/settings'
import { namespace } from '~/constants'
import { defaultSettings } from '../../utils/settings'
import { namespace } from '../../constants'
export const useAppStore = defineStore('app', () => {
const deferredPrompt = ref<Event | any>()

View File

@@ -7,8 +7,7 @@ Object.assign(process.env, {
})
// add build time to env
import.meta.env.VITE_APP_BUILD_TIME = new Date().toISOString()
import.meta.env.VITE_APP_BUILD_TIME = new Date().getTime().toString()
export default defineNuxtConfig({
ssr: false,

View File

@@ -4,7 +4,7 @@
"private": true,
"packageManager": "pnpm@8.14.3",
"engines": {
"node": ">=14"
"node": ">=16"
},
"scripts": {
"build": "npm run convert && nuxt build",

View File

@@ -1,6 +1,13 @@
import path from 'node:path'
import { defineVitestConfig } from '@nuxt/test-utils/config'
export default defineVitestConfig({
resolve: {
alias: {
'~/': path.resolve(__dirname, './'),
},
},
test: {
include: ['test/**/*.test.ts'],
environment: 'nuxt',