Commit Graph

5 Commits

Author SHA1 Message Date
Katerina Skroumpelou
4b2e9a206c fix(docs): scope js-libs-update vitest run and make tests self-contained (#46737)
The `Update JS Client Libraries Docs` workflow's "Refresh
reference-content snapshot" step fails because `npx vitest run --update
scripts/build-reference-content.test.ts` is treated as a filter, not a
restriction, under Vitest 4, so all docs tests
run. `CodeSample.test.ts` then fails with ENOENT on
`apps/docs/examples/_internal/fixtures/*` because the workflow bypasses
the `pretest` npm hook that runs `codegen:examples`.
  
This is a regression of #44943 (commit 28ef62cf31), reintroduced by
#46163 when the snapshot step was renamed and rewritten back to the
file-path form.
  
Fixes:
- Workflow: use `--dir scripts` so only the snapshot test runs.
- Tests: add a vitest globalSetup that mirrors `codegen:examples`, so
`npx vitest`, `pnpm test:local`, and IDE single-test runs no longer
depend on the `pretest` lifecycle hook being triggered first.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated test infrastructure configuration and initialization process
for improved test suite management.
* Refined test execution workflow to efficiently manage test discovery
and execution across project directories.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-08 15:33:20 +03:00
Charis
425d9ca592 chore: prevent extraneous tsconfig errors in tests (#38718)
Tests get spammed with unnecessary tsconfig errors because the Vitest
config tries to use tsconfig files from the examples directory.
Excluding those from tsConfigPaths for cleaner test output.
2025-09-16 13:22:00 -04:00
Charis
aba0095bd7 feat(content api): add error endpoint (#35941)
* feat(content api): add error endpoint

Add an endpoint to return the details of a Supabase error, given the
error code and service.

Schema additions:

```graphql
type RootQueryType {
  "...previous root queries"

  """Get the details of an error code returned from a Supabase service"""
  error(code: String!, service: Service!): Error
}

"""An error returned by a Supabase service"""
type Error {
  """
  The unique code identifying the error. The code is stable, and can be used for string matching during error handling.
  """
  code: String!

  """The Supabase service that returns this error."""
  service: Service!

  """The HTTP status code returned with this error."""
  httpStatusCode: Int

  """
  A human-readable message describing the error. The message is not stable, and should not be used for string matching during error handling. Use the code instead.
  """
  message: String
}

enum Service {
  AUTH
  REALTIME
  STORAGE
}
```

* test(content api): add tests for top-level query `error`
2025-05-29 15:39:47 -04:00
Charis
699f708b0c fix: make examples available for isr (#32610)
The examples folder needs to be explicitly included in the Vercel Serverless bundle. Because it's at the root of the monorepo rather than being within the `app/docs` folder, we copy it over pre-build (and pre-dev).

Test the examples/prompts fix by re-enabling revalidations on graphql pages. Added a temp version of the fetch function so we can gradually reenable and monitor Vercel error rates over time.
2025-01-14 18:38:21 -05:00
Charis
7c20407302 refactor(docs): type spec parsing + testing setup (#27931)
This produces more complete type information (unions, following type alias refererences that aren't successfully dereferenced at an earlier stage, etc.), in a format that is much easier to query from UI components. Also adds a snapshot test for easier future iteration.

I had a lot of trouble configuring Jest for the snapshot tests (something to do with imports and compile targets), and there are zero other tests in this directory right now, so I just tore out the test setup and replaced it with Vitest. Much faster!
2024-07-17 10:48:26 -04:00