Skip to content

Commit

Permalink
Add vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmyersdev committed Oct 3, 2023
1 parent 97b041b commit aae5064
Show file tree
Hide file tree
Showing 14 changed files with 864 additions and 100 deletions.
145 changes: 135 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,90 @@ env:
NUXT_PUBLIC_FIREBASE_STORAGE_BUCKET: fake
NUXT_PUBLIC_STRIPE_MONTHLY_PRICE:
jobs:
install-dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ env.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --shamefully-hoist
lint:
needs:
- install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout the repository
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
- run: pnpm install --shamefully-hoist
- run: pnpm lint
test-cypress:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ env.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --shamefully-hoist
- name: Run linter
run: pnpm lint
test-e2e:
needs:
- install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout the repository
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
- run: pnpm install --shamefully-hoist
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ env.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --shamefully-hoist
- run: docker-compose up -d
- uses: cypress-io/[email protected]
with:
Expand All @@ -75,3 +140,63 @@ jobs:
with:
name: cypress-videos
path: test/cypress/videos
test-unit:
needs:
- install-dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ env.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --shamefully-hoist
- run: pnpm nuxi prepare
- run: pnpm test:unit
typecheck:
needs:
- install-dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ env.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --shamefully-hoist
- run: pnpm nuxi prepare
- run: pnpm typecheck
9 changes: 0 additions & 9 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference types="cypress" />
/// <reference types="vite/client" />

import { type Instance } from 'ink-mde'
Expand All @@ -9,14 +8,6 @@ import * as appEvents from '#helpers/app'
declare global {
var isNuxt: boolean

namespace Cypress {
interface Chainable {
clearIDB: () => Cypress.Promise,
waitForAppReady: () => Cypress.Promise,
waitForHook: (name: AppEventType) => Cypress.Promise,
}
}

interface Navigator {
userAgentData?: {
platform: string,
Expand Down
2 changes: 2 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default defineNuxtConfig({
'#composables': join(root, './composables'),
'#helpers': join(root, './helpers'),
'#root': join(root, '.'),
'#test': join(root, './test'),
'#test-utils': join(root, './test/utils'),
},
app: {
head: {
Expand Down
27 changes: 22 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
"scripts": {
"build": "nuxt prepare && nuxt typecheck && tsx manifest.ts && nuxt generate",
"clean": "rimraf .output dev-dist dist",
"cypress": "cypress run",
"cypress:dev": "cypress open",
"dev": "nuxt dev --port 8888",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"lint:todo": "eslint-generate-todo --format json .",
"preview": "serve -p 8889 -s ./.output/public",
"test": "run-s cypress",
"typecheck": "nuxt typecheck"
"test": "run-p test:unit test:e2e",
"test:e2e": "cypress run",
"test:unit": "vitest",
"typecheck": "run-s typecheck:app typecheck:cypress",
"typecheck:app": "nuxt typecheck",
"typecheck:cypress": "tsc --project ./test/cypress/tsconfig.json"
},
"dependencies": {
"@headlessui/tailwindcss": "^0.2.0",
Expand Down Expand Up @@ -56,17 +58,19 @@
"@types/node": "^18.16.18",
"@types/remarkable": "^2.0.3",
"@vite-pwa/nuxt": "^0.0.4",
"@vue/test-utils": "^2.4.1",
"@vueuse/core": "^10.2.0",
"@vueuse/head": "^1.1.26",
"@vueuse/nuxt": "^9.13.0",
"@vueuse/rxjs": "^10.2.0",
"autoprefixer": "^10.4.13",
"cypress": "^12.0.2",
"cypress": "^13.3.0",
"cypress-network-idle": "^1.11.2",
"deepmerge-ts": "^4.2.1",
"eslint": "^8.48.0",
"eslint-config-artisan": "^0.2.1",
"eslint-generate-todo": "^0.2.0",
"happy-dom": "^12.6.0",
"micromark": "^3.1.0",
"npm-run-all": "^4.1.5",
"nuxt": "^3.5.3",
Expand All @@ -81,13 +85,26 @@
"vite-plugin-node-polyfills": "^0.14.0",
"vite-plugin-pwa": "^0.14.1",
"vite-svg-loader": "^3.6.0",
"vitest": "^0.34.6",
"vue-tsc": "^1.8.0",
"workbox-build": "^6.5.4",
"workbox-window": "^6.5.4"
},
"imports": {
"#composables/*": {
"default": "./composables/*"
},
"#root/*": {
"default": "./*"
},
"#test/*": {
"default": "./test/*"
},
"#test-utils": {
"default": "./test/utils/index.ts"
},
"#test-utils/*": {
"default": "./test/utils/*"
}
},
"packageManager": "[email protected]",
Expand Down
Loading

0 comments on commit aae5064

Please sign in to comment.