could not be able to run test for web3.js
All issues which aren't created with this template will get immediately closed. "ganache-cli": "^6.0.3", "mocha": "^4.0.1", "solc": "^0.4.19", "web3": "^1.0.0-beta.26"
code at my Inbox.test.js:-
const assert = require('assert'); const ganache = require('ganache-cli'); const Web3 = require('web3'); const web3 = new Web3(ganache.provider());
// beforeEach(() => { // web3.eth.getAccounts().then(fetchedAccounts => { // // console.log(fetchedAccounts); // // }); // // }); // // describe('Inbox',() => { // it('deploys a contract',() => {}); // // // });
class Car{ stop() { return 'stopped'; } drive() {
return 'drive';
}
}
describe('car',()=>{
it('can drive',()=>{
const car = new Car();
assert.equal(car.stop(),'stopped');
});
});
when i run the test through the command npm run test i get the error like this:-
C:\Users\S.Jaikrish\Desktop\ethereum\inbox\node_modules\ganache-cli\build\lib.node.js:63898
var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&"function"==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_W
TypeError: core.addProviders is not a function
at Object.mocha
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\S.Jaikrish\AppData\Roaming\npm-cache_logs\2019-02-01T10_01_58_108Z-debug.log
please help!!
please use template to submit issues. Closing due to no template used.
same problem