Commit 0b87a5d9 authored by Grant's avatar Grant Committed by Grant
Browse files

initial frontend testing

parent eb018d55
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
packages/server/prisma/dev.db
packages/client/public/**/*.css
packages/client/public/**/*.js
packages/client/coverage

# build directory
/build
+47 −13
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ include:
    inputs:
      wiki_token: $CI_PUSH_TOKEN

eslint:
lint:eslint:
  stage: lint
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
@@ -23,38 +23,43 @@ eslint:
    reports:
      codequality: gl-codequality.json

check outdated:
  stage: test
lint:markdown:
  stage: lint
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes:
        - "**/*.md"
  image: node:24-alpine
  allow_failure: true
  before_script:
    - apk update && apk add git
    - corepack enable yarn && corepack prepare --activate
    - yarn workspaces focus --all
  script:
    - npm outdated
    - git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA...HEAD | grep '\.md$' | xargs yarn dlx -p markdownlint-cli markdownlint

lint markdown:
  stage: lint
check outdated:
  stage: test
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes:
        - "**/*.md"
  image: node:24-alpine
  allow_failure: true
  before_script:
    - apk update && apk add git
    - corepack enable yarn && corepack prepare --activate
    - yarn workspaces focus --all
  script:
    - git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA...HEAD | grep '\.md$' | xargs yarn dlx -p markdownlint-cli markdownlint
    - npm outdated

jest server:
test:server:
  stage: test
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes:
        - packages/server/src/**/*
  image: node:24-alpine
  cache:
    key: yarn-packages
    paths:
      - .yarn/cache
      - node_modules
  services:
    - name: postgres:14-alpine
      alias: postgres
@@ -82,6 +87,35 @@ jest server:
        coverage_format: cobertura
        path: packages/server/coverage/cobertura-coverage.xml

test:client:
  stage: test
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes:
        - packages/client/**/*
  image: mcr.microsoft.com/playwright:v1.60.0-jammy
  cache:
    key: yarn-packages
    paths:
      - .yarn/cache
      - node_modules
  before_script:
    - corepack enable yarn && corepack prepare --activate
  script:
    - yarn workspaces focus --all
    - yarn workspace @sc07-canvas/lib build
    - yarn workspace @sc07-canvas/client vitest run \
      --browser.headless \
      --coverage \
      --coverage.reporter=text-summary \
      --coverage.reporter=cobertura
  coverage: /All\sfiles.*?\|\s+[\d\.]+/
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: packages/client/coverage/cobertura-coverage.xml

deploy:
  stage: deploy
  trigger:
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
    "markdownlint-cli": "^0.48.0",
    "nodemon": "^3.1.11",
    "openapi-typescript": "^7.13.0",
    "playwright": "^1.60.0",
    "prettier": "^3.8.1",
    "tailwindcss": "^4.1.18",
    "ts-node": "^10.9.2",
+6 −2
Original line number Diff line number Diff line
@@ -6,7 +6,8 @@
  "scripts": {
    "build": "vite build",
    "dev": "vite serve",
    "preview": "vite preview"
    "preview": "vite preview",
    "test": "vitest"
  },
  "type": "module",
  "license": "MIT",
@@ -44,6 +45,8 @@
    "@tsconfig/vite-react": "^7.0.2",
    "@types/lodash.throttle": "^4.1.9",
    "@types/socket.io-client": "^3.0.0",
    "@vitest/browser-playwright": "^4.1.8",
    "@vitest/coverage-istanbul": "4.1.8",
    "eslint": "^9.39.2",
    "eslint-plugin-import": "^2.32.0",
    "eslint-plugin-react": "^7.37.5",
@@ -51,6 +54,7 @@
    "postcss": "^8.5.6",
    "sass": "^1.97.3",
    "typescript-eslint": "^8.56.0",
    "vite": "^7.3.1"
    "vite": "^7.3.1",
    "vitest": "^4.1.8"
  }
}
+17 −0
Original line number Diff line number Diff line
import { defineConfig } from "vitest/config";
import { playwright } from "@vitest/browser-playwright";
import react from "@vitejs/plugin-react";

export default defineConfig({
  plugins: [react()],
  test: {
    browser: {
      enabled: true,
      provider: playwright(),
      instances: [{ browser: "chromium" }, { browser: "firefox" }],
    },
    coverage: {
      provider: "istanbul",
    },
  },
});
Loading