write test script for cypress

to properly kill the process
This commit is contained in:
MapleLeaf
2022-01-10 23:03:29 -06:00
parent b0e937f896
commit d3f6c8af4d
4 changed files with 32 additions and 9 deletions

View File

@@ -4,7 +4,7 @@
"scripts": {
"prepare": "remix setup node",
"dev": "concurrently 'typedoc --watch' 'remix dev'",
"test": "pnpm build && pnpm start & wait-on http-get://localhost:3000 && cypress run && exit 0",
"test": "esmo ./scripts/test.ts",
"test-dev": "pnpm dev & wait-on http-get://localhost:3000 && cypress open",
"build": "typedoc && remix build",
"start": "remix-serve build",
@@ -37,6 +37,8 @@
"@types/tailwindcss": "^3.0.2",
"concurrently": "^7.0.0",
"cypress": "^9.2.1",
"esno": "^0.13.0",
"execa": "^6.0.0",
"rehype-prism-plus": "^1.3.0",
"typedoc": "^0.22.10",
"typescript": "^4.5.4",

View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

View File

@@ -0,0 +1,9 @@
import cypress from "cypress"
import { execa } from "execa"
import waitOn from "wait-on"
await execa("pnpm", ["build"], { stdio: "inherit" })
const app = execa("pnpm", ["start"], { stdio: "inherit" })
await waitOn({ resources: ["http-get://localhost:3000"] })
await cypress.run()
app.kill()