I want test a function using Karma: This is the structure of my code:
WebContent
|
|___js
| |
| |__sourceCode.js
|
|___test-resources
|
|__myTest.js
This is the full content of sourceCode.js :
ui5bp.sourceCode={
doubleSum:function (a, b) {
return (a + b) * 2;
}
}
/*
function doubleSum(a, b) {
return (a + b) * 2;
}*/
and this an extract of my karma config file:
...
files: [
'WebContent/test-resources/sourceCode.js',
//'WebContent/test-resources/myTest.js'
],
...
Ok. Now I want run Karma, at the moment without test (in the config file I have commented the test) but I have a problem:
ui5bp is not defined
instead if I modify sourceCode
writing directly the function, I don't have problems!
I have organized my code using objects grouping functions and I would like test these funcions by init tests.
Aucun commentaire:
Enregistrer un commentaire