第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在Chai中進(jìn)行單元測(cè)試時(shí)無(wú)法讀取未定義的屬性“應(yīng)用”

在Chai中進(jìn)行單元測(cè)試時(shí)無(wú)法讀取未定義的屬性“應(yīng)用”

試圖測(cè)試一個(gè)簡(jiǎn)單的快速休息,我得到 Uncaught TypeError: Cannot read property 'apply' of undefined  at Immediate.<anonymous> (node_modules/express/lib/router/index.js:635:15)不知道我在做什么錯(cuò)。我引用了類(lèi)似的線(xiàn)程,但它不是特定于單元測(cè)試的無(wú)法讀取未定義的屬性“ apply”引用這個(gè)https://codehandbook.org/unit-test-express-route/router.spec.jsimport chai from 'chai';import chaiHttp from 'chai-http';import router from '../routes/';chai.use(chaiHttp);chai.should();const expect = chai.expect();describe('index page should render, hello world', () => {    it('should render hello world 200', (done) => {             chai.request(router).get('/').end( (err, res) => {               expect(200, "ok").            expect(res.text).to.equal('Hello World');            done();        })        })})index.jsimport express from 'express';const router = express.Router();router.get('/', (req, res) => {    return res.status(200).json({        message: "Hello World"    })})export default router;.babelrc{    "presets": ["@babel/preset-env"]  }package.json{  "name": "elinodereactapp",  "version": "1.0.0",  "description": "",  "scripts": {    "start": "nodemon --exec babel-node ./app.js",    "test": "mocha --require @babel/register tests/*.js --exit",    "build": "babel src --out-dir ./dist --source-maps",    "serve": "node ./app.js"  },  "author": "",  "license": "ISC",  "dependencies": {    "assert": "^1.4.1",    "body-parser": "^1.18.3",    "chai-http": "^4.2.1",    "cookie-parser": "^1.4.4",    "cors": "^2.8.5",    "dotenv": "^7.0.0",    "express": "^4.16.4",    "morgan": "^1.9.1",    "node-mocks-http": "^1.7.3"  },  "devDependencies": {    "@babel/cli": "^7.4.3",    "@babel/core": "^7.4.3",    "@babel/node": "^7.2.2",    "@babel/preset-env": "^7.4.3",    "@babel/register": "^7.4.0",    "babel-cli": "^6.26.0",    "babel-core": "^7.0.0-bridge.0",    "babel-loader": "^8.0.5",    "babel-preset-env": "^1.7.0",    "chai": "^4.2.0",    "mocha": "^6.1.1",    "nodemon": "^1.18.10"  }}
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 218 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)