简体   繁体   English

Vue.js e2E测试Nightwatch:无论如何都要使用特定的config.test.js进行测试

[英]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.

相关问题 Vue.js e2e w Nightwatch.js如何获取有关WebElements(WebDriver协议)的详细信息? - Vue.js e2e w Nightwatch.js how to get details on WebElements (WebDriver protocol)? 使用Node.js + Firebase进行e2e测试的示例 - Example of e2e test using Node.js + Firebase 使用Nightwatch在无头野生动物园中运行e2e测试 - Running e2e tests in headless safari using nightwatch 这种模式是如何工作的:'test / e2e / ** / * .spec.js'? - How does this pattern work: 'test/e2e/**/*.spec.js'? Node.js e2e 测试具有未等待的异步任务的端点 - Node.js e2e test for endpoint with async task that is not awaited 在 jest 和 nest.js 节点生成 E2e 测试报告 - E2e test report generate in jest and nest.js node 使用量角器运行e2e测试的Angular.js教程 - Angular.js tutorial running e2e test using protractor 测试执行因源自 Hammerhead 的请求管道的问题而随机中止(Testcafe e2e 测试) - Test execution randomly aborted by an issue originated in the request-pipeline of Hammerhead (Testcafe e2e tests) Node.js 文件夹结构:单元测试和 e2e 测试 - Node.js folder structure: unit tests and e2e tests 如何使用 WebDriverIO 在单个测试用例中自动化移动和 Web 应用程序 e2e 测试? - How to automate mobile and web app e2e tests in a single test case using WebDriverIO?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM