diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..f828d7e8 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,31 @@ +name: test stan-playground + +on: + pull_request: + branches: ['main'] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: 'tests' + cancel-in-progress: true + +jobs: + frontend-tests: + name: yarn tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + cache-dependency-path: gui/yarn.lock + - name: Install dependencies + run: cd gui; yarn + - name: Test + run: cd gui; yarn test diff --git a/gui/index.html b/gui/index.html index d385fad5..9394db40 100644 --- a/gui/index.html +++ b/gui/index.html @@ -6,7 +6,6 @@ -
diff --git a/gui/package.json b/gui/package.json index 2357b7cb..30e82fb5 100644 --- a/gui/package.json +++ b/gui/package.json @@ -36,6 +36,8 @@ "tinystan": "^0.0.2" }, "devDependencies": { + "@testing-library/dom": "^10.1.0", + "@testing-library/react": "^16.0.0", "@types/node": "^20.12.11", "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", @@ -45,10 +47,12 @@ "@typescript-eslint/parser": "^6.0.0", "@vitejs/plugin-react": "^4.0.3", "@vitest/coverage-v8": "^1.6.0", + "@vitest/web-worker": "^1.6.0", "eslint": "^8.45.0", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", + "jsdom": "^24.1.0", "typescript": "^5.0.2", "vite": "^5.2.12", "vitest": "^1.6.0" diff --git a/gui/src/app/FileEditor/StanCompileResultWindow.tsx b/gui/src/app/FileEditor/StanCompileResultWindow.tsx index 1a6e8d41..4386de8a 100644 --- a/gui/src/app/FileEditor/StanCompileResultWindow.tsx +++ b/gui/src/app/FileEditor/StanCompileResultWindow.tsx @@ -1,60 +1,33 @@ import { Done } from "@mui/icons-material"; -import { FunctionComponent, useEffect, useState } from "react"; -import runStanc from "./runStanc"; +import { FunctionComponent } from "react"; +import { StancErrors } from "../Stanc/Types"; type Props = { width: number height: number - mainStanText: string | undefined - onValidityChanged?: (valid: boolean) => void + stancErrors: StancErrors, } -type CompiledModel = { - errors?: string[] - warnings?: string[] - result: string -} - -const StanCompileResultWindow: FunctionComponent{error}
{error}
{warning}
{warning}