Cordova插件:不支持子目录

时间:2018-08-04 17:31:34

标签: node.js unit-testing cordova cordova-plugins phonegap-plugins

如果我尝试运行任何插件的单元测试(例如cordova-plugin-geolocation),则必须在我的项目中添加插件的tests子目录。在添加远程项目的tests子目录时,出现 support for subdirectories is deprecated and will be removed in Cordova@7 错误。

我要用来添加测试的命令是

cordova plugin add http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation#:/tests

如果fetch不支持添加子目录,那么有人如何在其项目中添加插件的单元测试?

错误和堆栈跟踪如下所示:

(node:57857) UnhandledPromiseRejectionWarning: CordovaError: --fetch does not support subdirectories

    at Object.fetchPlugin [as fetch] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:71:37)

    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/plugin/add.js:98:40

    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)

    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30

    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:749:13)

    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:810:14

    at flush (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:108:17)

    at process._tickCallback (internal/process/next_tick.js:61:11)

    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)

    at startup (internal/bootstrap/node.js:266:19)

(node:57857) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:57857) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

添加–-nofetch标志也不能解决问题。克隆项目并使用测试目录的位置添加到项目中是我唯一的选择吗?

我正在使用 cordova版本8

0 个答案:

没有答案