node.js中模块

    技术2022-07-11  129

    node.js中模块

    Intern is an awesome unit and functional test suite from SitePen.  I've been using this utility extensively over the past year, writing tests to make sure MDN's front-end is in good shape after code merges and pushes.

    Intern是SitePen的出色单元和功能测试套件。 在过去的一年中,我一直在广泛使用此实用程序,编写测试以确保在代码合并和推送后MDN的前端状态良好。

    Sometimes when writing tests I'll want to make use of a node module to accomplish a test task, like making an HTTP request or getting environment information.  It isn't as easy as making the same dependency path you would if you were writing a node module -- you're using the Dojo loader so you'll need to require those modules a bit differently:

    有时在编写测试时,我想利用节点模块来完成测试任务,例如发出HTTP请求或获取环境信息。 这不像编写节点模块那样简单地创建相同的依赖路径-您正在使用Dojo加载器,因此您需要对这些模块的要求有所不同:

    define([ 'intern/dojo/node!http', 'intern/dojo/node!process' ], function(http, process) { // http and process now available from the Node.js environment });

    The dojo/node Dojo module gives your Intern test suite the ability to access native Node.js modules!

    dojo/node Dojo模块使您的Intern测试套件能够访问本机Node.js模块!

    翻译自: https://davidwalsh.name/node-modules-intern

    node.js中模块

    相关资源:jdk-8u281-windows-x64.exe
    Processed: 0.010, SQL: 10