如何从intern.js测试中加载node.js http模块?

如何从intern.js测试中加载node.js http模块?,第1张

如何从intern.js测试中加载node.js http模块

Intern在AMD环境中运行其测试,因此

require
AMD加载程序(
require
而不是Node 加载器)也要在其中运行,因此是您的错误。

要加载Node模块,请使用

intern/dojo/node!
AMD插件并将其包含在模块的依赖项中,例如:

define([    ...,    'intern/dojo/node!http'], function (..., http) {    // Now http contains the exports of Node's http module});

这在《 Intern用户指南》的“ 测试CommonJS模块 ”下进行了记录。



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5477007.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-12
下一篇2022-12-12

发表评论

登录后才能评论

评论列表(0条)

    保存