Skip to content
Snippets Groups Projects
Commit db4bb060 authored by MARTIN Pierre-Alexandre's avatar MARTIN Pierre-Alexandre
Browse files

Amélioration de la pipeline

parent 4b5e21a1
No related branches found
No related tags found
1 merge request!2Amélioration de la pipeline
# source: https://stackoverflow.com/questions/55359804/gitlab-ci-npm-doesnt-like-the-cached-node-modules
image: node:22
stages:
- build
- test
cache:
- &global_cache_node_mods
key:
files:
- package-lock.json
paths:
- node_modules/
policy: pull # prevent subsequent jobs from modifying cache
variables:
NUXT_ENV: production
install:
stage: .pre # always first, no matter if it is listed in stages
cache:
- <<: *global_cache_node_mods
when: on_success
policy: pull-push
- key: ${CI_JOB_NAME}
paths:
- .npm/
when: on_success
policy: pull-push
script:
- npm ci --cache .npm --prefer-offline
build:
stage: build
script:
......@@ -13,4 +38,27 @@ build:
- npm run build
artifacts:
paths:
- .nuxt/
- .output/
test:
stage: test
needs:
- job: build
artifacts: true # grabs built files
script:
- npm run test
artifacts:
when: always
paths:
- .nuxt/tests/vitest-junit-report.xml
reports:
junit: .nuxt/tests/vitest-junit-report.xml
lint:
stage: test
needs:
- job: build
artifacts: true
script:
- npm run lint
......@@ -60,7 +60,11 @@ export default defineNuxtConfig({
]
},
modules: ['@nuxt/ui', '@nuxt/eslint'],
modules: [
'@nuxt/eslint',
'@nuxt/test-utils/module',
'@nuxt/ui'
],
icon: {
serverBundle: {
......
This diff is collapsed.
......@@ -6,11 +6,12 @@
"build": "node_modules/.bin/nuxt build",
"dev": "node_modules/.bin/nuxt dev",
"generate": "node_modules/.bin/nuxt generate",
"lint": "eslint .",
"lint": "node_modules/.bin/eslint .",
"postinstall": "node_modules/.bin/nuxt prepare",
"preview": "node_modules/.bin/nuxt preview",
"prod": " node .output/server/index.mjs",
"start": "node_modules/.bin/nuxt start"
"start": "node_modules/.bin/nuxt start",
"test": "node_modules/.bin/vitest run --passWithNoTests"
},
"dependencies": {
"@iconify-json/material-symbols": "^1.2.12",
......@@ -23,6 +24,10 @@
"vue-router": "latest"
},
"devDependencies": {
"typescript": "^5.7.3"
"@nuxt/test-utils": "^3.15.4",
"@vue/test-utils": "^2.4.6",
"happy-dom": "^16.7.1",
"typescript": "^5.7.3",
"vitest": "^3.0.3"
}
}
import {test} from 'vitest'
test('my test', () => {
// ... test with Nuxt environment!
})
\ No newline at end of file
import {defineVitestConfig} from '@nuxt/test-utils/config'
export default defineVitestConfig({
test: {
environment: 'nuxt',
reporters: ['junit', 'verbose'],
outputFile: {
junit: './.nuxt/tests/vitest-junit-report.xml'
}
}
})
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment