Ho usato jasmine 1.2.0 e ha funzionato perfettamente. Ora sto usando lo stesso codice tutto lo stesso come era, l'unica differenza è che mi sono trasferito a jasmine 2.0.1 e ora non funziona ... tutti i test falliscono e l'errore che ottengo è: "Uncaught TypeError: Impossibile leggere la proprietà 'env' di undefined ".Unchaught TypeError: Impossibile leggere la proprietà 'env' di undefined
Ecco il file SpecRunner.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jasmine Spec Runner</title>
<link rel="stylesheet" href="../app/bower_components/bootstrap/dist/css/bootstrap.css"/>
<link rel="stylesheet" href="../app/bower_components/font-awsome/css/font-awesome.css"/>
<link rel="stylesheet" href="../app/bower_components/datetimepicker/jquery.datetimepicker.css"/>
<link rel="stylesheet" href="../app/css/style.css"/>
<link rel="stylesheet" href="../app/bower_components/bootstrap-multiselect/dist/css/bootstrap-multiselect.css"/>
<link rel="stylesheet" href="../app/bower_components/bootstrap-select/dist/css/bootstrap-select.css"/>
<script type="text/javascript" src="../app/bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="../app/bower_components/underscore/underscore.js"></script>
<script type="text/javascript" src="../app/bower_components/backbone/backbone.js"></script>
<script type="text/javascript" src="../app/bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="../app/bower_components/moment/moment.js"></script>
<script type="text/javascript" src="../app/bower_components/handlebars/handlebars.js"></script>
<script type="text/javascript" src="../app/bower_components/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="../app/bower_components/backbone-tastypie/backbone_tastypie/static/js/backbone-tastypie.js"></script>
<script type="text/javascript" src="../app/bower_components/bootstrap-multiselect/dist/js/bootstrap-multiselect.js"></script>
<script type="text/javascript" src="../app/bower_components/bootstrap-select/dist/js/bootstrap-select.js"></script>
<script type="text/javascript" src="../app/bower_components/backbone.localstorage/backbone.localStorage.js"></script>
<link rel="shortcut icon" type="image/png" href="jasmine-2.0.1/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="jasmine-2.0.1/jasmine.css">
<script type="text/javascript" src="jasmine-2.0.1/jasmine.js"></script>
<script type="text/javascript" src="jasmine-2.0.1/jasmine-html.js"></script>
<script type="text/javascript" src="jasmine-2.0.1/boot.js"></script>
<script type="text/javascript" src="sinon.js"></script>
.
.
.
<!-- include spec files here... -->
.
.
.
<script type="text/javascript">
(function() {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
var htmlReporter = new jasmine.HtmlReporter();
var oldResult = htmlReporter.reportRunnerResults;
jasmineEnv.addReporter(htmlReporter);
/* this is just for our automated tests */
window.jasmine_phantom_reporter = new jasmine.ConsoleReporter;
jasmineEnv.addReporter(jasmine_phantom_reporter);
/* */
jasmineEnv.specFilter = function (spec) {
return htmlReporter.specFilter(spec);
};
var currentWindowOnload = window.onload;
window.onload = function() {
if (currentWindowOnload) {
currentWindowOnload();
}
execJasmine();
};
function execJasmine() {
jasmineEnv.execute();
}
})();
</script>
</head>
<body>
</body>
</html>
Qualcuno può dirmi che cosa è sbagliato ??? Tnxs :) ...
È necessario aggiungere il codice di un test di base per il quale non riesce e solo le dipendenze necessarie per il test fallire e non tutte senza la versione –