itpropro / nuxt-oidc-auth

OIDC (OpenID connect) focused auth module for Nuxt
https://nuxt.com/modules/nuxt-oidc-auth
MIT License
69 stars 13 forks source link

Cannot use dev mode with Playwright #26

Open DallasHoff opened 5 months ago

DallasHoff commented 5 months ago

Dev mode currently requires:

  1. devMode.enabled is true in the module config
  2. NODE_ENV is set to development

When running tests with Playwright, Playwright will always override NODE_ENV and set it to production. This makes it impossible to use auth dev mode when running Playwright tests.

I understand that requiring NODE_ENV=production to enable dev mode is an extra set of guard rails, but can we consider changing the dev mode requirements in some way to not require a certain NODE_ENV value?

itpropro commented 5 months ago

I am pretty sure there is a way to set the NODE_ENV variable to development or do you have dependencies on other modules/settings having it set to production?

DallasHoff commented 5 months ago

I couldn't find anything about disabling that behavior in Playwright. Googling "site:playwright.dev 'NODE_ENV'" returns no results. The behavior is only mentioned when you run tests with NODE_ENV not set to production. It prints a warning to the console and overrides it to "production" automatically.

Maybe Playwright should allow us to disable that behavior, but I can also see other people running into problems with dev mode requiring NODE_ENV=development for different reasons.