test
This commit is contained in:
@@ -7,6 +7,7 @@ RUN npm install -g pnpm
|
|||||||
COPY package.json pnpm-lock.yaml* ./
|
COPY package.json pnpm-lock.yaml* ./
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN pnpm install --frozen-lockfile
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN pnpm test
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
# Stage production
|
# Stage production
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -7,7 +7,8 @@
|
|||||||
"dev": "nuxt dev",
|
"dev": "nuxt dev",
|
||||||
"generate": "nuxt generate",
|
"generate": "nuxt generate",
|
||||||
"preview": "nuxt preview",
|
"preview": "nuxt preview",
|
||||||
"postinstall": "nuxt prepare"
|
"postinstall": "nuxt prepare",
|
||||||
|
"test": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/eslint": "1.9.0",
|
"@nuxt/eslint": "1.9.0",
|
||||||
@@ -22,5 +23,11 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"pnpm": ">=10 <11"
|
"pnpm": ">=10 <11"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"
|
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748",
|
||||||
|
"devDependencies": {
|
||||||
|
"@pinia/testing": "^1.0.2",
|
||||||
|
"@vue/test-utils": "^2.4.6",
|
||||||
|
"jsdom": "^27.0.0",
|
||||||
|
"vitest": "^3.2.4"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
671
pnpm-lock.yaml
generated
671
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
16
tests/page.spec.ts
Normal file
16
tests/page.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import { mount } from '@vue/test-utils'
|
||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
|
||||||
|
const pagesDir = path.resolve(__dirname, '../pages')
|
||||||
|
const pages = fs.readdirSync(pagesDir).filter(f => f.endsWith('.vue'))
|
||||||
|
|
||||||
|
describe('Sanity check: pages mount correctly', () => {
|
||||||
|
for (const page of pages) {
|
||||||
|
it(`should mount ${page} without unresolved components`, async () => {
|
||||||
|
const Page = (await import(path.join(pagesDir, page))).default
|
||||||
|
expect(() => mount(Page)).not.toThrow()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
15
tests/stores.spec.ts
Normal file
15
tests/stores.spec.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { setActivePinia, createPinia } from 'pinia'
|
||||||
|
import { describe, it, expect, beforeEach } from 'vitest'
|
||||||
|
import { useTestStore } from '~/stores/testStore'
|
||||||
|
|
||||||
|
describe('TestStore sanity', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
setActivePinia(createPinia())
|
||||||
|
})
|
||||||
|
|
||||||
|
it('adds data correctly', async () => {
|
||||||
|
const store = useTestStore()
|
||||||
|
await store.addData()
|
||||||
|
expect(store.getDatas).toContain('fdgfg')
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user