[英]Vue.js e2E tests Nightwatch : anyway to run the test with a specific config.test.js
I am currently running my e2e test w Nightwatch.. In production, the app mutation.js file setup some constants from a config file 我目前正在运行Nightwatch的e2e测试。.在生产中,应用程序mutation.js文件会从配置文件中设置一些常量
import { WORKING_TIME, RESTING_TIME, KITTEN_TIME } from '../config'
I wonder if there is anyway to setup these constants from other config files depending upon the processing environment ( production, development, test ) 我想知道是否有根据处理环境(生产,开发,测试)从其他配置文件设置这些常量的方法
<if production>
import { WORKING_TIME, RESTING_TIME, KITTEN_TIME } from '../config'
<if development>
import { WORKING_TIME, RESTING_TIME, KITTEN_TIME } from '../config.dev'
<if test>
import { WORKING_TIME, RESTING_TIME, KITTEN_TIME } from '../config.test'
No way to import modules using if / else ... 无法使用if / else导入模块...
As the data I need to import according to the NODE_ENV are constant variables, I resolved to set them up directly into the imported file : 由于我需要根据NODE_ENV导入的数据是常量变量,因此我决定将它们直接设置到导入的文件中:
config.js config.js
let coeff = process.env.NODE_ENV === 'testing' ? 0.1 : 1
export const WORKING_TIME = coeff * 60
export const RESTING_TIME = coeff * 60
export const KITTEN_TIME = 5 // each kitten is visible for 5 secs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.