Sto usando karma + jasmine + jquery + jasmine-jquery Ho diversi test di unità js pure e ora è il momento di passare a scrivere alcuni test dipendenti da HTML. Ho provato jasmine-jquery e le sue loadFixtures, ma non importa quello che provo, sto ancora ricevendo errori senza alcun messaggio utile.jasmine-jquery non carica nessun apparecchio
ho creato progetto semplice per testare le cose in modo isolato, qui è la mia messa a punto:
.
├── karma.conf.js
├── package.json
├── spec
│ └── javascripts
│ └── fixtures
│ └── simple.test.html
└── src
└── test
└── js
└── simple.test.js
package.json
{
"dependencies": {
"karma": "0.12.31",
"jasmine": "2.1.1",
"karma-jasmine": "0.3.5",
"jasmine-jquery": "2.0.6",
"karma-jasmine-jquery": "0.1.1",
"karma-teamcity-reporter": "0.1.2"
},
"devDependencies": {
"karma-chrome-launcher": "~0.1.7",
"karma-firefox-launcher": "~0.1.4"
}
}
spec/javascript/fixtures/simple.test.html
<body>
Test
</body>
src/test/js/simple.test.js
describe('simple', function() {
beforeEach(function() {
loadFixtures('simple.test.html');
});
it('test', function() {
expect(true).toBeTruthy();
});
});
sto ottenendo questo errore
Chrome 27.0.1453 (Linux) simple test FAILED
Error: Fixture could not be loaded: spec/javascripts/fixtures/simple.test.html (status: error, message: undefined)
at Object.<anonymous> (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:133:17)
at fire (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jqueryForJasmineJqueryPlugin.js:3094:30)
at Object.self.add (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jqueryForJasmineJqueryPlugin.js:3140:7)
at jasmine.Fixtures.loadFixtureIntoCache_ (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:132:10)
at jasmine.Fixtures.getFixtureHtml_ (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:115:12)
at jasmine.Fixtures.read (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:77:28)
at jasmine.Fixtures.load (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:65:37)
at jasmine.Fixtures.proxyCallTo_ (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:161:29)
at window.loadFixtures (/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:765:27)
Firefox 24.0.0 (Linux) simple test FAILED
Error: Fixture could not be loaded: spec/javascripts/fixtures/simple.test.html (status: error, message: undefined) in /tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js (line 133)
jasmine.Fixtures.prototype.loadFixtureIntoCache_/request<@/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:133
jQuery.Callbacks/[email protected]/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jqueryForJasmineJqueryPlugin.js:3094
jQuery.Callbacks/[email protected]/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jqueryForJasmineJqueryPlugin.js:3140
[email protected]/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:132
[email protected]/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:115
[email protected]/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:77
[email protected]/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:65
[email protected]/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:161
[email protected]/tmp/zkurv/node_modules/karma-jasmine-jquery/lib/jasmine-jquery.js:765
@/tmp/zkurv/src/test/js/simple.test.js:3
Qualsiasi aiuto?
avevi ragione. Grazie –