Я не могу запустить тестовый набор, используя mocha
в Node.js. Это дает мне следующий вывод.
test@1.0.0 test / home / anil / Desktop / subhrajyoti / project / Practice test
npm ERR! Тест не пройден Подробнее см. Выше.
Я объясняю мой код ниже.
test-pages. js:
var expect = require('chai').expect;
var request = require('request');
describe('Status and content', function() {
describe ('Main page', function() {
it('status', function(done){
request('http://localhost:3000/', function(error, response, body) {
expect(response.statusCode).to.equal(200);
done();
});
});
it('content', function(done) {
request('http://localhost:3000/' , function(error, response, body) {
expect(body).to.equal('Index page loaded');
done();
});
});
});
describe ('About page', function() {
it('status', function(done){
request('http://localhost:3000/about', function(error, response, body) {
expect(response.statusCode).to.equal(404);
done();
});
});
});
});
Моя посылка. json файл приведен ниже.
{
"name": "test",
"version": "1.0.0",
"description": "test project",
"main": "app.js",
"scripts": {
"test": "test",
"start": "node app"
},
"author": "",
"license": "ISC",
"dependencies": {
"async": "^3.1.0",
"aws-sdk": "^2.590.0",
"axios": "^0.19.1",
"cors": "^2.8.5",
"deep-diff": "^1.0.2",
"express": "^4.17.1",
"express-fileupload": "^1.1.6",
"formidable": "^1.2.1",
"jimp": "^0.9.3",
"json-diff": "^0.5.4",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"mongodb": "^3.3.5",
"mongoose": "^5.7.12",
"mongoose-double": "0.0.1",
"mongoose-float": "^1.0.4",
"mysql": "^2.17.1",
"node-cron": "^2.0.3",
"node-schedule": "^1.3.2",
"underscore": "^1.9.2",
"validator": "^12.1.0",
"xlsx": "^0.15.4"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^7.1.0",
"nodemon": "^2.0.2"
}
}
Когда я набираю команду npm test
, я получаю эту ошибку. Здесь мне нужно успешно выполнить эти тесты.