Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests don't work or are broken #974

Open
GalacticHypernova opened this issue Oct 10, 2024 · 0 comments
Open

tests don't work or are broken #974

GalacticHypernova opened this issue Oct 10, 2024 · 0 comments

Comments

@GalacticHypernova
Copy link
Contributor

GalacticHypernova commented Oct 10, 2024

Environment


  • Operating System: Linux
  • Node Version: v20.15.1
  • Nuxt Version: 3.13.2
  • CLI Version: 3.14.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: - <-- This isn't accurate, I have changed things, unsure if nuxi is just unable to pick it up
  • Runtime Modules: - <-- This isn't accurate, I have modules, unsure if nuxi is just unable to pick it up
  • Build Modules: -

Reproduction

I am unable to provide a reproduction for 2 main reasons:

  1. This is part of a production app, and I am willing to share it happening in real time privately
  2. It's inconsistent, as on Windows it fails completely and on Ubuntu it fails to run the e2e tests, so I can't even confirm it locally with a different configuration (I can provide the error it provides on Windows which causes it to abort even the initial test screen)

I can, however, provide the overall configuration and a sample of the tests:
nuxt.config.ts modules:

modules: ["@nuxt/content","@nuxt/ui", "@pinia/nuxt", "@nuxt/image", '@nuxt/test-utils/module', "@nuxtjs/i18n", "@nuxtjs/seo",
		"@nuxtjs/turnstile", "nuxt-security", "@nuxt/scripts", "@nuxt/fonts"],

vitest.config.mts:

import { defineVitestConfig } from '@nuxt/test-utils/config'
export default defineVitestConfig({
	test:{
		environment:'nuxt',
		hookTimeout:50000
	}
})

Sample of test/e2e/e2e.nuxt.test.ts:

import { expect, describe, it } from "vitest"
import {setup, $fetch, fetch, createPage} from "@nuxt/test-utils/e2e"
describe("app", async () => {
	await setup({
		server:true,
		runner: 'vitest',
		build:true,
		setupTimeout:300000
	}
	)
       describe("images", async () => {
		it("should return correct data for existent images", async () => {
			const {body, status, headers} = await fetch('/images/image.webp')
			expect(status).toBe(200)
			expect(headers.get("Content-Type")).toBe("image/webp")
		})
		it("should return 404 for non-existent images", async () => {
			const {body, status} = await fetch('/images/nonExistent.jpg')
			expect(status).toBe(404)
		})
	})
})

Describe the bug

The cucumber test runner appears to execute the tests despite runner option of the setup of e2e to 'vitest' (or trying to use the default). Maybe because of this and maybe because of a different, unseen cause, it simply breaks all e2e tests with the error I provided in the Logs section.

I believe this is part of a bigger issue which I have not unearthed yet that could also explain the respective failures on both environments

Additional context

Attempting to upgrade/reinstall the project's deps does not appear to help.
Unit tests are not affected by it, it affects only those that depend on the setup from the e2e section.

Logs

TypeError: The "chunk" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
 ❯ _build node_modules/nitropack/dist/nitro.mjs:2658:22
 ❯ node_modules/nuxt/dist/index.mjs:3630:5
 ❯ build node_modules/nuxt/dist/index.mjs:5778:3
 ❯ buildFixture node_modules/@nuxt/test-utils/dist/shared/test-utils.CaqvQLs_.mjs:121:3
    119|   const { After, AfterAll, Before, BeforeAll } = await import('@cucumber/cucumber');
    120|   BeforeAll({ timeout: hooks.ctx.options.setupTimeout }, hooks.setup);
    121|   Before(hooks.beforeEach);
       |   ^
    122|   After(hooks.afterEach);
    123|   AfterAll(hooks.afterAll);
 ❯ setup2 node_modules/@nuxt/test-utils/dist/shared/test-utils.CaqvQLs_.mjs:183:7
@GalacticHypernova GalacticHypernova changed the title cucumber runner interferes with vitest tests and breaks tests tests don't work or are broken Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant