Four layers, from fastest to most realistic.
Where to run this. Commands on this page that start with
npm,nodeordocker buildrun inside a clone of this repository:git clone https://github.com/grand-stack/grandstack-web, thencd grandstack-web(Node 22 or later; runnpm cionce). Commands that need the running stack use thegrandstackrepository's compose files: see the quickstart.
npm run typecheck (also run by npm run build) runs tsc --noEmit. Because every GraphQL document is typed from the schema, using a field that is not in the query fails here.
npm run codegen reads the live schema from GRAPHQL_URL (default http://localhost:4000/graphql) and validates every graphql() document against it. An unknown field, a wrong argument type or a duplicate operation name fails the run and writes nothing. Run it after any server schema change, then commit src/graphql/generated/.
npm test (vitest) covers the pure logic: URL parsing and where/sort building for movies and people (src/lib/*.test.ts), form validation and mutation inputs including the relationship diff (src/forms/model.test.ts), and the poster generator. They need no server or browser.
npm run e2e drives real Chrome against the running stack and checks 78 behaviours, including create, edit and delete with the stored film counts. Setup, variables and caveats are in e2e/README.md. In short: run it against a freshly seeded database, because it expects the sample data.
.github/workflows/ci.yml runs install, typecheck, unit tests and a build, then builds the Docker image. Codegen and the browser checks need a running server and are not in CI yet.
codegenfails withCannot query field "x" on type "Y": the server schema does not have the field; check the server is running the version you expect.- A query works in GraphiQL but codegen reports
Variable "$x" of type "T" used in position expecting type "T!": the variable must be declared non-null where it is used in a non-null position. - e2e fails on counts: the database is not the freshly seeded sample.