withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.8k stars 2.49k forks source link

Some tests are broken on main branch #11441

Closed haivuw closed 4 months ago

haivuw commented 4 months ago

Astro Info

This is about running tests on main branch.
latest commit 75d118bf7f06f11df05b2337bf615e83c3681d0e

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

These 2 tests are failing on main branch:

https://github.com/withastro/astro/blob/e22be22e5729e60220726e92b52d2833c937fd1c/packages/integrations/vercel/test/serverless-prerender.test.js#L21

✖ outDir is tree-shaken if not needed (1.72359ms)
  TypeError [Error]: Cannot read properties of undefined (reading 'replace')
      at Object.readFile (file:///home/hl/ws/forks/astro/packages/astro/test/test-utils.js:217:22)
      at TestContext.<anonymous> (file:///home/hl/ws/forks/astro/packages/integrations/vercel/test/serverless-prerender.test.js:25:34)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Test.run (node:internal/test_runner/test:574:9)
      at async Suite.processPendingSubtests (node:internal/test_runner/test:318:7)

This one only fails on my WSL (Ubuntu 22.04) setup: https://github.com/withastro/astro/blob/062623438b5dfd66682a967edc7b7c91bd29e888/packages/astro/test/ssr-error-pages.test.js#L137

✖ renders 404 page when a route does not match the request (1.939176ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  + actual - expected

  + ''
  - 'Something went horribly wrong!'
      at TestContext.<anonymous> (file:///home/hl/ws/forks/astro/packages/astro/test/ssr-error-pages.test.js:160:11)
      at async Test.run (node:internal/test_runner/test:574:9)
      at async Promise.all (index 0)
      at async Suite.run (node:internal/test_runner/test:810:7)
      at async Suite.processPendingSubtests (node:internal/test_runner/test:318:7) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: '',
    expected: 'Something went horribly wrong!',
    operator: 'strictEqual'
  }

What's the expected result?

pnpm build && pnpm test should pass.

Link to Minimal Reproducible Example

pnpm build && pnpm test on main

Participation

Princesseuh commented 4 months ago

Everything seems to work for me in local (Node v22.0.0) and on CI. Might've been a fluke or specific to your setup. As long as it works in CI, we're generally okay with things!