【文件属性】:
文件名称:nodeunit-express:在节点单元测试 express 应用程序时使用的 Mock Request 对象
文件大小:5KB
文件格式:ZIP
更新时间:2021-07-02 20:49:13
JavaScript
nodeunit-express
nodeunit-express 是一个实用函数,可以轻松为 Node.JS 应用程序编写测试。 它基于项目,我无法正常工作。
如何使用:
首先,使用 npm 安装:
npm install nodeunit-express
然后像这样在你的测试文件中要求它:
var request = require ( 'nodeunit-express' ) ;
假设您想测试这个简单的 express 应用程序以确保它返回正确的状态、正文和标题:
var express = require ( 'express' )
var app = module . exports = express ( ) ;
app . get ( '/' , function ( req , res ) {
res . send ( "ok" , { 'Conten
【文件预览】:
nodeunit-express-master
----index.js(2KB)
----package.json(616B)
----readme.md(3KB)
----tester.js(2KB)
----tests()
--------tester.js(787B)
----.gitignore(197B)