Add frontend testing, add frontend test to pipeline

This commit is contained in:
Sam Therapy 2023-03-09 15:05:48 +01:00
parent 5ee838e405
commit 5cc50e8138
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
3 changed files with 21 additions and 8 deletions

View file

@ -5,10 +5,11 @@ name: pomme-pipeline
steps:
- name: lint-frontend
image: guergeiro/pnpm
image: node:18-alpine
commands:
- cd frontend && npm i
- cd .. && make frontend
- corepack enable
- corepack prepare pnpm@latest --activate
- pnpm -F frontend install
- make lint-frontend
- name: lint-backend
image: golangci/golangci-lint
@ -18,17 +19,23 @@ steps:
image: golang:1.20
commands:
- go mod tidy && go mod vendor
depends_on:
depends_on:
- 'lint-backend'
- 'lint-frontend'
volumes:
- name: 'cache'
- path: '/go'
- name: 'test'
- name: test-frontend
image: node:18-alpine
commands:
- pnpm -F frontend test:unit
depends_on:
- 'cache'
- name: test-backend
image: golang:1.20
commands:
- cp config.sample.yaml ./internal/api/config.yaml
- 'make test-backend'
- make test-backend
depends_on:
- 'cache'
volumes:

View file

@ -30,7 +30,7 @@ format-backend:
gofmt -w -s .
swagger:
swag init -d cmd/pomme/,internal/
swag init -d cmd/pomme/,internal/
.PHONY: lint lint-frontend lint-backend
lint: lint-frontend lint-backend
@ -41,5 +41,11 @@ lint-frontend:
lint-backend:
golangci-lint run --timeout=5m --out-format colored-line-number:stdout
.PHONY: test test-frontend test-backend
test: test-frontend test-backend
test-frontend:
pnpm -F frontend "test:unit"
test-backend:
go test -v -cover ./internal/api

View file

@ -9,7 +9,7 @@
"test": "playwright test",
"check": "svelte-kit sync && svelte-check",
"check:watch": "svelte-kit sync && svelte-check --watch",
"test:unit": "vitest",
"test:unit": "vitest run",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},