TypeError [ERR_INVALID_ARG_TYPE]:“from”参数必须是字符串类型
Posted
技术标签:
【中文标题】TypeError [ERR_INVALID_ARG_TYPE]:“from”参数必须是字符串类型【英文标题】:TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string 【发布时间】:2021-12-24 09:05:33 【问题描述】:我正在尝试运行黄瓜测试,但是出现以下错误
TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined
at new NodeError (internal/errors.js:322:7)
at validateString (internal/validators.js:124:11)
at Object.relative (path.js:1167:5)
at Object.getDefinitionLineAndUri (/Users/karencardoz/Documents/Workspace/TestCafe/node_modules/cucumber/node_modules/@cucumber/cucumber/lib/support_code_library_builder/build_helpers.js:24:34)
at /Users/karencardoz/Documents/Workspace/TestCafe/node_modules/cucumber/node_modules/@cucumber/cucumber/lib/support_code_library_builder/index.js:80:51
at Object.<anonymous> (/Users/karencardoz/Documents/Workspace/TestCafe/features/support/hooks.js:45:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/Users/karencardoz/Documents/Workspace/TestCafe/features/support/errorHandling.js:2:15)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
Karens-MacBook-Pro:TestCafe karencardoz$
我的 package.json 文件如下所示:
"name": "testcafe",
"version": "1.0.0",
"main": "index.js",
"scripts":
"test": "testcafe"
,
"author": "",
"license": "ISC",
"dependencies":
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"cucumber": "^7.1.0",
"gradle": "^1.2.4",
"testcafe": "^1.16.1",
"testcafe-angular-selectors": "^0.4.1"
,
"description": "",
"devDependencies":
"@cucumber/cucumber": "^8.0.0-rc.1"
步骤def中的导入格式
const assert = require('assert');
const Given, When, Then = require('@cucumber/cucumber');
【问题讨论】:
【参考方案1】:目前,TestCafe 没有与 Cucumber 的官方集成。在 TestCafe 的 GitHub 存储库中跟踪 this 问题以了解其进度。
【讨论】:
以上是关于TypeError [ERR_INVALID_ARG_TYPE]:“from”参数必须是字符串类型的主要内容,如果未能解决你的问题,请参考以下文章
反应本机获取多标记[未处理的承诺拒绝:TypeError:TypeError:未定义不是对象(评估'this.state.markers.map
Django TypeError - TypeError: issubclass() arg 1 必须是一个类
pyspark:TypeError:'float'对象不可迭代
Python 3.8 TypeError: can't concat str to bytes - TypeError: a bytes-like object is required, not 's