首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何配置cypress-sql-server以在不同生产和开发环境中使用

如何配置cypress-sql-server以在不同生产和开发环境中使用
EN

Stack Overflow用户
提问于 2021-07-07 08:49:13
回答 2查看 172关注 0票数 1

我正在使用cypress-sql-server插件,它将根据production.json和development.json的不同环境进行配置

代码语言:javascript
复制
{
"env": {
"userName":"sa",
"password": "",
"server": "localhost",
"port": "1433",
"options": {
"database": "TestDatabase",
"encrypt": true,
"rowCollectionOnRequestCompletion" : true
}
}
}

the index.js file in the plugins

const path = require("path");
const fs = require("fs-extra");
const sqlServer = require('cypress-sql-server');

function getConfigurationByFile(file) {
const pathToConfigFile = path.resolve("cypress/config", ${file}.json)
console.error('the server path',pathToConfigFile)
return fs.readJson(pathToConfigFile);
}

module.exports = async (on, config) => {
tasks = sqlServer.loadDBPlugin(config);
on('task', tasks);
const file = config.env.fileConfig
return getConfigurationByFile(file)
}

当我运行测试用例时,我得到如下失败消息

cy.task('sqlServer:execute')失败,出现以下错误:

服务器无效:未定义“

我用机器名替换了本地主机,但是同样的错误。我认为sqlServer.loadDBPlugin(config)没有得到正确的数据。伙计们,你们知道吗?

请帮帮忙。谢谢。

EN

回答 2

Stack Overflow用户

发布于 2021-08-09 12:34:56

我也遇到了同样的问题,直接用繁琐的服务器替换了cypress-sql-server。使用这些:https://github.com/cypress-io/cypress/issues/6621

注:安装修复版本:

"coffeescript":"^2.5.1",

“繁琐”:"^ 8.3.0"

票数 2
EN

Stack Overflow用户

发布于 2021-07-08 19:04:36

您是否在cypress.json或其他配置文件中指定了这一点?

配置您的cypress.json (或配置目录中的特定于环境的文件)应以以下格式指定DB redentials

"db":{ "userName":"","password":"",“服务器”:"","options":{“数据库”:"","encrypt":true,"rowCollectionOnRequestCompletion“:true }}

来源:https://www.npmjs.com/package/cypress-sql-server

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68278807

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档