diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 117ea61e..cb652dcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,8 +28,12 @@ jobs: run: cd frontend && yarn lint - name: Type check run: cd frontend && yarn type-check - - name: Run tests - run: cd frontend && yarn test + - name: Run tests and coverage + run: cd frontend && yarn test && yarn test:coverage + - name: ✅ Upload coverage to Codecov + uses: codecov/codecov-action@v3.1.0 + with: + flags: frontend backend-test: name: 🧪 backend-ci runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index fffbef66..4c0246b2 100644 --- a/.gitignore +++ b/.gitignore @@ -126,7 +126,10 @@ cdk.out .aws-sam/ *.js +!vite.config.js !config.js !lib/inline-lambda/index.js *.d.ts # !frontend/src/radis.d.ts +frontend/coverage +frontend/html \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..2f77c611 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,23 @@ +coverage: + status: + project: off + patch: off + +flag_management: + individual_flags: + - name: frontend + paths: + - frontend/ + statuses: + - type: project + target: 80% + carryforward: true + # - name: backend + # paths: + # - server/ + # statuses: + # - type: project + # target: 80% +github_checks: + annotations: true + \ No newline at end of file diff --git a/frontend/__tests__/src/App.test.tsx b/frontend/__tests__/src/App.test.tsx new file mode 100644 index 00000000..1cf1ed33 --- /dev/null +++ b/frontend/__tests__/src/App.test.tsx @@ -0,0 +1,6 @@ +import { render } from "@testing-library/react"; +import React from "react"; +import App from "../../src/App"; +test("renders the page", () => { + render(); +}); diff --git a/frontend/src/__test__/unit_test/PathLength.test.tsx b/frontend/__tests__/src/components/fields/PathLength.test.tsx similarity index 92% rename from frontend/src/__test__/unit_test/PathLength.test.tsx rename to frontend/__tests__/src/components/fields/PathLength.test.tsx index f8702940..6e3e9b65 100644 --- a/frontend/src/__test__/unit_test/PathLength.test.tsx +++ b/frontend/__tests__/src/components/fields/PathLength.test.tsx @@ -1,8 +1,7 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ -/* eslint-disable react/react-in-jsx-scope */ import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import user from "@testing-library/user-event"; -import App from "../../App"; +import React from "react"; +import App from "../../../../src/App"; describe("testing pathLength field ", () => { test("testing pathLength field render with defaultValue and perfectly visible", () => { render(); diff --git a/frontend/src/__test__/unit_test/Pressure.test.tsx b/frontend/__tests__/src/components/fields/Pressure.test.tsx similarity index 92% rename from frontend/src/__test__/unit_test/Pressure.test.tsx rename to frontend/__tests__/src/components/fields/Pressure.test.tsx index d0ff2ba5..d82bcafe 100644 --- a/frontend/src/__test__/unit_test/Pressure.test.tsx +++ b/frontend/__tests__/src/components/fields/Pressure.test.tsx @@ -1,8 +1,7 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ -/* eslint-disable react/react-in-jsx-scope */ import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import user from "@testing-library/user-event"; -import App from "../../App"; +import React from "react"; +import App from "../../../../src/App"; describe("testing pressure field ", () => { test("testing pressure field render with defaultValue and perfectly visible", () => { render(); diff --git a/frontend/src/__test__/unit_test/Tgas.test.tsx b/frontend/__tests__/src/components/fields/Tgas.test.tsx similarity index 92% rename from frontend/src/__test__/unit_test/Tgas.test.tsx rename to frontend/__tests__/src/components/fields/Tgas.test.tsx index 2698a350..bc762f8d 100644 --- a/frontend/src/__test__/unit_test/Tgas.test.tsx +++ b/frontend/__tests__/src/components/fields/Tgas.test.tsx @@ -1,8 +1,7 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ -/* eslint-disable react/react-in-jsx-scope */ import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import user from "@testing-library/user-event"; -import App from "../../App"; +import React from "react"; +import App from "../../../../src/App"; describe("testing tgas field ", () => { test("testing tgas field render with defaultValue and perfectly visible", () => { render(); diff --git a/frontend/src/__test__/unit_test/Trot.test.tsx b/frontend/__tests__/src/components/fields/Trot.test.tsx similarity index 91% rename from frontend/src/__test__/unit_test/Trot.test.tsx rename to frontend/__tests__/src/components/fields/Trot.test.tsx index 131252e0..44806fbb 100644 --- a/frontend/src/__test__/unit_test/Trot.test.tsx +++ b/frontend/__tests__/src/components/fields/Trot.test.tsx @@ -1,8 +1,7 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ -/* eslint-disable react/react-in-jsx-scope */ import { fireEvent, render, screen } from "@testing-library/react"; import user from "@testing-library/user-event"; -import App from "../../App"; +import React from "react"; +import App from "../../../../src/App"; describe("testing trot field ", () => { test("testing trot rendered but not visible if non-equilibrium-switch* is not checked", () => { render(); diff --git a/frontend/src/__test__/unit_test/Tvib.test.tsx b/frontend/__tests__/src/components/fields/Tvib.test.tsx similarity index 91% rename from frontend/src/__test__/unit_test/Tvib.test.tsx rename to frontend/__tests__/src/components/fields/Tvib.test.tsx index 62fa2a7b..f1928807 100644 --- a/frontend/src/__test__/unit_test/Tvib.test.tsx +++ b/frontend/__tests__/src/components/fields/Tvib.test.tsx @@ -1,8 +1,7 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ -/* eslint-disable react/react-in-jsx-scope */ import { fireEvent, render, screen } from "@testing-library/react"; import user from "@testing-library/user-event"; -import App from "../../App"; +import React from "react"; +import App from "../../../../src/App"; describe("testing tvib field ", () => { test("testing tvib rendered but not visible if non-equilibrium-switch* is not checked", () => { render(); diff --git a/frontend/public/index.html b/frontend/index.html similarity index 88% rename from frontend/public/index.html rename to frontend/index.html index 05cf942f..825000b9 100644 --- a/frontend/public/index.html +++ b/frontend/index.html @@ -2,19 +2,19 @@ - + - + - +