Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests(e2e+unit), workflow update with eslint, 1inch & vs hodl apr fix etc. #205

Merged
merged 22 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
PUBLIC_GRAPH_API_KEY=GRAPH_API_KEY
PUBLIC_GOOGLE_ANALYTICS_KEY=GOOGLE_ANALYTICS_KEY
PUBLIC_GRAPH_API_KEY=
PUBLIC_GOOGLE_ANALYTICS_KEY=

PUBLIC_SEED_PHRASE=
PUBLIC_METAMSK_PASSWORD=
PUBLIC_PRIVATE_KEY=
24 changes: 24 additions & 0 deletions .github/workflows/1_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ESLint Check

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
lint:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: |
yarn add eslint eslint-plugin-astro @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-prettier astro-eslint-parser --dev
- name: Run ESLint
run: |
export NODE_OPTIONS=--max-old-space-size=8192
yarn lint
20 changes: 20 additions & 0 deletions .github/workflows/2_unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Unit Tests(Vitest)
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: yarn install
- name: Run vitest
run: yarn test:unit
28 changes: 28 additions & 0 deletions .github/workflows/3_e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: End-to-End Tests(Playwright)
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: yarn install
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
run: yarn test:e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
20 changes: 20 additions & 0 deletions .github/workflows/4_codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Codecov

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
27 changes: 0 additions & 27 deletions .github/workflows/playwright.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ pnpm-debug.log*
/playwright-report/
/blob-report/
/playwright/.cache/

# synpress cache
.cache-synpress
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from "astro/config";

import react from "@astrojs/react";
import vercel from "@astrojs/vercel/serverless";
import tailwind from "@astrojs/tailwind";
Expand Down
78 changes: 78 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import typescriptParser from "@typescript-eslint/parser";
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
import prettierPlugin from "eslint-plugin-prettier";
import eslintPluginAstro from "eslint-plugin-astro";
import astroParser from "astro-eslint-parser";
import reactPlugin from "eslint-plugin-react";

export default [
{
ignores: [
"node_modules/**",
"dist/**",
"playwright-report/**",
"public/**",
"test-results/**",
"tests/**",
".cache-synpress/**",
],
},
// {
// files: ["**/*.astro"],
// languageOptions: {
// parser: astroParser,
// parserOptions: {
// extraFileExtensions: [".astro"],
// project: "./tsconfig.json",
// },
// },
// plugins: {
// astro: eslintPluginAstro,
// prettier: prettierPlugin,
// },
// rules: {
// ...eslintPluginAstro.configs.recommended.rules,
// "prettier/prettier": "error",
// },
// },
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: "./tsconfig.json",
},
},
plugins: {
"@typescript-eslint": typescriptPlugin,
react: reactPlugin,
},
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/explicit-module-boundary-types": "warn",
"@typescript-eslint/no-explicit-any": "warn",
// "@typescript-eslint/ban-ts-comment": "warn",
"react/no-unescaped-entities": "off",
"react/jsx-no-undef": "error",
"react/jsx-fragments": ["error", "syntax"],

// "@typescript-eslint/consistent-type-imports": "error",
// "@typescript-eslint/naming-convention": [
// "error",
// {
// selector: "variable",
// format: ["camelCase", "UPPER_CASE"],
// },
// {
// selector: "typeLike",
// format: ["PascalCase"],
// },
// ],
},
},
];
33 changes: 26 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
{
"name": "stability-ui",
"type": "module",
"version": "0.9.1-alpha",
"version": "0.9.3-alpha",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"lint": "eslint .",
"test:unit": "vitest",
"test:e2e": "playwright test"
},
"dependencies": {
"@astrojs/partytown": "^2.1.0",
"@astrojs/react": "^3.0.3",
"@astrojs/tailwind": "^5.0.2",
"@astrojs/vercel": "^5.1.0",
"@nanostores/react": "^0.7.1",
"@stabilitydao/stability": "=0.9.1",
"@safe-global/safe-apps-sdk": "^9.1.0",
"@safe-global/safe-apps-web3modal": "^23.0.0",
"@stabilitydao/stability": "^0.10.0",
"@tanstack/query-sync-storage-persister": "^5.22.2",
"@tanstack/react-query": "^5.22.2",
"@tanstack/react-query-persist-client": "^5.22.2",
Expand All @@ -26,20 +31,34 @@
"add": "^2.0.6",
"astro": "^3.4.3",
"axios": "^1.6.2",
"eslint-plugin-astro": "^1.2.3",
"http-proxy-middleware": "^2.0.6",
"nanostores": "^0.9.3",
"proxy-middleware": "^0.15.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"recharts": "^2.10.4",
"recharts": "^2.13.0-alpha.4",
"tailwindcss": "^3.3.5",
"vercel": "^32.5.0",
"viem": "^2.13.1",
"wagmi": "^2.5.7"
"wagmi": "^2.5.7",
"web3modal": "^1.9.12"
},
"devDependencies": {
"@playwright/test": "^1.45.1",
"@currents/playwright": "1.4.5",
"@playwright/test": "1.44.1",
"@types/node": "^20.14.10",
"jest": "^29.7.0"
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@vitest/ui": "^2.0.2",
"astro-eslint-parser": "^1.0.2",
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"prettier": "^3.3.3",
"typescript": "^5.5.3",
"vitest": "^2.0.2"
}
}
3 changes: 2 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { defineConfig, devices } from "@playwright/test";
*/

export default defineConfig({
testDir: "./tests",
testDir: "./tests/e2e",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand All @@ -30,6 +30,7 @@ export default defineConfig({

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
// headless: true,
},

/* Configure projects for major browsers */
Expand Down
Loading
Loading