Skip to content

Conversation

@jsantell
Copy link

@jsantell jsantell commented Jul 31, 2025

Optionally, and in CI, use a test static server instead of a live 'example.com' page, reducing dependency on external services and intermittent failures.

via #166 (comment):

The linux CI failures are similar to what I see locally on this branch (and main): intermittent timeouts in tests that use http://example.com -- sometimes even curl http://example.com hangs
If it's of interest, I could add a simple web server to run alongside the tests (either here, or in a new PR), rough idea:

  • Some simple web server at ./tests/fixtures/server.ts that serves some simple HTML on localhost:8000 (could copy example.com, not sure how dependent tests are on content yet)
  • Update tests to use const serverUrl = Deno.env.get("TEST_SERVER_URL") || "http://example.com"
  • In CI, run the dev server and invoke CI via TEST_SERVER_URL=http://localhost:8000 deno task test

Changes:

  • Introduce ./tests/utils/helpers.ts with serverUrl and serverHost exports, using env TEST_SERVER_URL if defined, falling back to http://example.com
  • Introduce ./tests/utils/devserver.ts, which is a simple Deno static server serving identical content to http://example.com
    • Some tests previously used https://example.com -- does devserver.ts need to support SSL?
  • Use test server in CI
  • Update coverage tests, bumping line number from the inclusion of the helper with serverUrl

Locally, tests now consistently pass for me (around 1s each), where previously they could hang, timing out after 60s

@jsantell
Copy link
Author

Updated using github actions env for cross platform setting of env var 🤞

@jsantell
Copy link
Author

jsantell commented Jul 31, 2025

Ah snapshot tests were working previously for me, fixing those up (it was deno fmt!)

…ive 'example.com' page, reducing dependency on external services and intermittent failures.
@jsantell
Copy link
Author

Ah snapshot tests were working previously for me, fixing those up (it was deno fmt!)

Updated using the same HTML formatting as currently checked by the snapshot tests, looking good now

@jsantell
Copy link
Author

jsantell commented Aug 1, 2025

I'll look into the Windows failures, but no immediate ideas come to mind (and no local Window machines)

@lino-levan
Copy link
Owner

lino-levan commented Aug 1, 2025

Seems like potentially another snapshot issue? Strange for sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants