adonisjs / core

AdonisJS is a TypeScript-first web framework for building web apps and API servers. It comes with support for testing, modern tooling, an ecosystem of official packages, and more.
https://adonisjs.com
MIT License
16.96k stars 638 forks source link

Port number set in env.test is ignored #4794

Open nadlgit opened 13 hours ago

nadlgit commented 13 hours ago

Package version

6.14.1

Describe the bug

I have same issue as described in this Discord feed: https://discord.com/channels/423256550564691970/1293218007253909504.

When using a separate env file for tests (env.test or env.test.local), the PORT variable is ignored and instead the value for default env file is used. For example, if we set 3333 in .env and 3334 in .env.test, 3333 is still used during test runs.

It seems to me that PORT is the only one ignored and other variables are correctly set.

The workaround proposed in above Discord feed works: setting conditionally process.env.NODE_ENV to 'test' inside bin/console.ts. But I think it's a bit awkward.

Reproduction repo

No response

thetutlage commented 13 hours ago

Yup, I can reproduce the issue.