简体   繁体   English

TestCafe /多个存储库项目

[英]TestCafe / Multiple repository project

I have my TestCafe page models grouped together in different project repositories. 我将TestCafe页面模型组合在不同的项目存储库中。

When I try to use these page model repositories/packages in the main project that has the tests, I get various different errors. 当我尝试在具有测试的主项目中使用这些页面模型存储库/包时,我会遇到各种不同的错误。 The latest error I get when I try to run a test that makes use of a page model in a different package is this: 我尝试运行在不同包中使用页面模型的测试时得到的最新错误是:

Cannot implicitly resolve the test run in the context of which the test controller action should be executed. Use test function's 't' argument instead.

My page model repository uses babel and has the following in the babelrc file: 我的页面模型库使用babel并在babelrc文件中包含以下内容:

{
    "presets": [
        [
            "@babel/preset-env", {
                "targets": {
                    "node": true
                },
                "modules": "commonjs",
                "forceAllTransforms": true,
                "debug": true
            }
        ]
    ]
}

If I don't use babel on the page model repositories, I get issues related to unknown import tokens. 如果我不在页面模型库中使用babel,我会遇到与未知导入令牌相关的问题。

(function (exports, require, module, __filename, __dirname) { import ...
SyntaxError: Unexpected token import

Can someone give me advice on how to get a multiple repository TestCafe project working? 有人可以给我关于如何让多个存储库TestCafe项目工作的建议吗?

I fear this is not possible, because all test code and all imports must be transpiled by TestCafe before executing tests. 我担心这是不可能的,因为在执行测试之前,所有测试代码和所有导入都必须由TestCafe进行转换。 Because of this, TestCafe will also ignore any babelrc you might setup. 因此,TestCafe也会忽略您可能设置的任何babelrc All TestCafe code and all page models should be in the same repository. 所有TestCafe代码和所有页面模型都应位于同一个存储库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM