<bdo id='87ZvD'></bdo><ul id='87ZvD'></ul>

    <legend id='87ZvD'><style id='87ZvD'><dir id='87ZvD'><q id='87ZvD'></q></dir></style></legend>
    <i id='87ZvD'><tr id='87ZvD'><dt id='87ZvD'><q id='87ZvD'><span id='87ZvD'><b id='87ZvD'><form id='87ZvD'><ins id='87ZvD'></ins><ul id='87ZvD'></ul><sub id='87ZvD'></sub></form><legend id='87ZvD'></legend><bdo id='87ZvD'><pre id='87ZvD'><center id='87ZvD'></center></pre></bdo></b><th id='87ZvD'></th></span></q></dt></tr></i><div id='87ZvD'><tfoot id='87ZvD'></tfoot><dl id='87ZvD'><fieldset id='87ZvD'></fieldset></dl></div>
    <tfoot id='87ZvD'></tfoot>

      <small id='87ZvD'></small><noframes id='87ZvD'>

    1. Testcafe 无法识别 React

      时间:2023-09-06

    2. <legend id='yWuqQ'><style id='yWuqQ'><dir id='yWuqQ'><q id='yWuqQ'></q></dir></style></legend>
          <i id='yWuqQ'><tr id='yWuqQ'><dt id='yWuqQ'><q id='yWuqQ'><span id='yWuqQ'><b id='yWuqQ'><form id='yWuqQ'><ins id='yWuqQ'></ins><ul id='yWuqQ'></ul><sub id='yWuqQ'></sub></form><legend id='yWuqQ'></legend><bdo id='yWuqQ'><pre id='yWuqQ'><center id='yWuqQ'></center></pre></bdo></b><th id='yWuqQ'></th></span></q></dt></tr></i><div id='yWuqQ'><tfoot id='yWuqQ'></tfoot><dl id='yWuqQ'><fieldset id='yWuqQ'></fieldset></dl></div>

          <small id='yWuqQ'></small><noframes id='yWuqQ'>

            <tbody id='yWuqQ'></tbody>

                <bdo id='yWuqQ'></bdo><ul id='yWuqQ'></ul>
                <tfoot id='yWuqQ'></tfoot>
                本文介绍了Testcafe 无法识别 React的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试运行我的第一个 testcafe 测试,但它被证明是艰巨的.

                I'm trying to run my first testcafe test but it's proving arduous.

                testcafe -e chrome client/routes/Lookup/components/testcafe/lookup-test.js

                testcafe -e chrome client/routes/Lookup/components/testcafe/lookup-test.js

                SyntaxError: client/routes/Lookup/components/Lookup.js: Unexpected token (60:8)
                  58 |     if (error.status && error.status !== 404) {
                  59 |       return (
                > 60 |         <NetworkIssues code={error.status} />
                     |         ^
                  61 |       );
                  62 |     }
                  63 |
                at Object.<anonymous> (client/routes/Lookup/components/testcafe/lookup-test.js:1:1)
                

                lookup-test.js

                lookup-test.js

                import Lookup from '../Lookup';
                import React from 'react';
                import { waitForReact } from 'testcafe-react-selectors';
                
                
                fixture('Lookup Component').page('http://localhost:3000/web/lookup').beforeEach(async () => {
                  await waitForReact();
                });
                
                test('foo', async (x) => {
                  await x
                    .typeText('customerName', '07450118811')
                    .expect('customerName.value').contains('07450118811');
                });
                

                我的代码没有任何错误.它编译和工作正常,并通过了我所有的笑话和酶单元测试.但是我在网上找不到任何指导.如您所见,忽略错误标志无济于事.

                My code doesn't have any errors. It compiles and works fine and passes all my jest and enzyme unit testing. But I can't find any guidance online for this. As you can see the ignore errors flag is used to no avail.

                干杯.

                推荐答案

                当您启动 TestCafe 时,您的所有测试代码都会在执行前作为第一步进行转译.执行的是这个转译过程的结果,而不是您的原始源代码,即使您的代码是纯 JavaScript.

                When you start TestCafe, all your test code is transpiled as a first step before execution. What is executed is the result of this transpilation process and not your original source code, even if your code is pure JavaScript.

                导入的文件client/routes/Lookup/components/Lookup.js是一个JSX文件,由于是在TestCafe代码中导入的,所以在开始测试执行前会先将il转译成javascript.

                The imported file client/routes/Lookup/components/Lookup.js is a JSX file, and since it is imported in the TestCafe code, il will be first transpiled to javascript before starting test execution.

                TestCafe 转译过程(在撰写本文时 - 将来可能会更改)未配置为处理 JSX 文件.

                The TestCafe transpilation process (at the time of writing - it may change in the future) is not configured to handle JSX files.

                因此,不能导入TestCafe无法转译成纯JS的文件.

                Therefore, you cannot import files that cannot be transpiled into pure JS by TestCafe.

                这篇关于Testcafe 无法识别 React的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何在预请求脚本中更改 Postman 环境? 下一篇:TestCafe 有没有办法验证 Chrome 网络调用?

                相关文章

                最新文章

                1. <tfoot id='WawE3'></tfoot>
                    <bdo id='WawE3'></bdo><ul id='WawE3'></ul>

                2. <i id='WawE3'><tr id='WawE3'><dt id='WawE3'><q id='WawE3'><span id='WawE3'><b id='WawE3'><form id='WawE3'><ins id='WawE3'></ins><ul id='WawE3'></ul><sub id='WawE3'></sub></form><legend id='WawE3'></legend><bdo id='WawE3'><pre id='WawE3'><center id='WawE3'></center></pre></bdo></b><th id='WawE3'></th></span></q></dt></tr></i><div id='WawE3'><tfoot id='WawE3'></tfoot><dl id='WawE3'><fieldset id='WawE3'></fieldset></dl></div>
                  1. <small id='WawE3'></small><noframes id='WawE3'>

                    <legend id='WawE3'><style id='WawE3'><dir id='WawE3'><q id='WawE3'></q></dir></style></legend>