I'm converting a project from Angular + Node.js server --> Sapper. In relation to e2e tests, there is something I can't understand; can I run Sapper with NODE_ENV
env variable set to test? When I run export NODE_ENV=test && sapper dev
the variable is always dev
. How can I fix this?
My current work-around is to build the application, and then start it with node __sapper__/build
, but this is not very nice when developing e2e tests.
Sapper is an open-source project, so we can check how
NODE_ENV
is set: https://github.com/sveltejs/sapper.When running
sapper dev
, the environmental variableNODE_ENV
is set in/src/api/dev.ts
where it's hard-coded to
development
.The variable can be set to other values (including
testing
) inso I surmise you would need
sapper prod
(or something similar, check it) to use thisNODE_ENV
.You should also check it that doesn't beat the purpose of what you're trying to achieve, perhaps sticking to
sapper dev
is preferable to running in non-dev mode.