I am trying to write a simple unit test for a simple class where I get The following error, before I even get to use my class and write some tests!:
Uncaught TypeError: Cannot read property 'setup' of undefined
Running this line:
require(['mocha'], function(mocha){
mocha.setup('bdd');
});
My basic html page:
<html>
<head>
<link rel="stylesheet" href="node_modules/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script data-main="SpecRunner" src="./require.js"></script>
</body>
</html>
SpecRunner.js:
require.config({
baseUrl: "./",
paths: {
mocha: 'node_modules/mocha/mocha'
}
});
require(['mocha'], function(mocha){
mocha.setup('bdd');
//mocha.run();
});
I installed mocha using npm (and there is mocha.js inside node_modules/mocha/).
What is wrong with my setup?
Aucun commentaire:
Enregistrer un commentaire