【发布时间】:2022-10-22 06:26:45
【问题描述】:
我正在尝试将 Wallaby 与 dotenv-flow 包结合使用。我目前有我的 wallaby.js 配置文件设置,如下所示:
require("dotenv-flow").config()
module.exports = function (wallaby) {
return {
files: [
'api/*',
'controllers/*',
'config/*',
'firebase/*',
'helpers/*',
'models/*',
'services/*',
'smtp/*',
'sockets/*'
],
tests: [
"test/**/*.test.mjs"
],
testFramework: "mocha",
env: {
type: "node",
params: {
env: "NODE_ENV=test"
}
}
};
};
我尝试了其他几种编写文件的方法,包括 esm 模块格式。但是,我的测试运行并且我的续集代码抱怨它没有传递环境变量以用于连接到开发数据库。
【问题讨论】:
标签: javascript testing environment-variables dotenv wallaby