From 54f42fdabe36d8b1233b1737e601b23c70bfd28f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 18 Oct 2024 22:20:57 +0100 Subject: [PATCH] chore: add basic test configuration --- .github/workflows/autofix.yml | 36 ++++++++++++++++++ .github/workflows/ci.yml | 69 +++++++++++++++++++++++++++++++++++ .gitignore | 4 ++ app/app.vue | 8 ++++ nuxt.config.ts | 9 +++++ package.json | 13 ++++++- renovate.json | 7 ++++ test/browser/index.test.ts | 11 ++++++ test/nuxt/index.test.ts | 14 +++++++ test/unit/index.test.ts | 7 ++++ vitest.config.ts | 12 ++++++ vitest.nuxt.config.ts | 8 ++++ 12 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/autofix.yml create mode 100644 .github/workflows/ci.yml create mode 100644 renovate.json create mode 100644 test/browser/index.test.ts create mode 100644 test/nuxt/index.test.ts create mode 100644 test/unit/index.test.ts create mode 100644 vitest.config.ts create mode 100644 vitest.nuxt.config.ts diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 0000000..f3119dc --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,36 @@ +# needed to securely identify the workflow +name: autofix.ci + +on: + pull_request: + branches: + - main + +permissions: + contents: read + +jobs: + code: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install + + - name: ๐Ÿ”  Fix lint errors + run: pnpm lint --fix + + - name: ๐Ÿงช Update unit test snapshots + run: pnpm test:unit -u + + - name: ๐Ÿƒ Update component test snapshots + run: pnpm test:runtime -u + + - uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..12f9cfe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: ci + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install + + - name: ๐Ÿ”  Lint project + run: pnpm lint + + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install + + - name: ๐Ÿ’ช Type check + run: pnpm test:types + + - name: ๐Ÿงช Unit test + run: pnpm test:unit + + - name: ๐Ÿƒ Component tests + run: pnpm test:runtime + + e2e: + runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.48.0-focal + + steps: + - uses: actions/checkout@v4 + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install + + - name: ๐Ÿงช Test project (e2e) + run: pnpm test:e2e diff --git a/.gitignore b/.gitignore index 4a7f73a..2defe53 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ dist # Node dependencies node_modules +.pnpm-store # Logs logs @@ -22,3 +23,6 @@ logs .env .env.* !.env.example + +# Testing +test-results diff --git a/app/app.vue b/app/app.vue index 2b1be09..6ceb990 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,3 +1,11 @@ + +