Closed aitos closed 5 years ago
Did you already try to run this without the resourceroots
/ themeroots
configuration?
If you are using the extacted zip from http://openui5.org/download.html it should find the libraries and themes without any further configuration.
resourceroots: {
'sap.m': 'build/tmp/bootRun/unpackedOpenuiRuntimeDependencies/resources/sap/m',
//'my.namespace': '/base/src/my/namespace'
},
themeroots: {
'sap_bluecrystal': 'build/tmp/bootRun/unpackedOpenuiRuntimeDependencies/resources/sap/m/themes/sap_bluecrystal'
}
I could not reproduce the issue mentioned by you locally using the openui5-runtime-1.32.5.zip (after removing the configuration above).
Closing this for now. Please feel free to add comments if the issue is still relevant.
I got the same issue just now. It happens because karma-openui5 appends a cachebuster string to the sap-ui-core.js script tag and the regex used in the lookup does not expect that:
mMatch = sSrc.match(/(.*\/)sap-ui-core\.js$/i)
actual script tag karma generates:
<script type="text/javascript" src="/base/node_modules/@openui5/sap.ui.core/src/sap-ui-core.js?c130a88260d05608009c66b87e5a6c57c4f9fab0" crossorigin="anonymous"></script>
I'm not really shure why this does not happen in our other projects. Will investigate and keep you updated.
Update: Other project is running karma 1.7, the one throwing the error is using 2.0
Update2: Okay, the real difference is one project is loading the sap-ui-core.js
from cdn (works fine) and one from local (adds sha1 hash to url, fails).
My assumption would also be that this is not related to karma, but to our bootstrap check which tries to identify the script which boots UI5.
Usually this is done with an ID sap-ui-bootstrap
, but karma doesn't allow adding those to the inserted script tags. Also the folder isn't called resources
but src
, which would also be an indication.
Even when our detection would work, you would still have trouble loading the other libraries from their npm packages, as by default the loader will try to load it relative to the sap.ui.core
package.
To solve this, and to ease the use of the npm packages, we introduced a file system abstraction which is able to bring several npm packages (and potentially other sources) together for a local server and during build steps.
All this is part of our new UI5 Tooling. You might have a look into our Quick start: OpenUI5 Sample App which uses Karma with the ui5 serve
command.
Thanks for the hint to the sample app. Nice to see the ui5 tooling in action. I'd see if I can rework our build scripts to use that. Seems to be the correct choice for new projects.
Thanks!
Hi @matz3,
in my optinion this is a bug. It is valid to load the sap-ui-core.js
file directly from the node_modules
directory. Karma appends the ?abcdef01234567
string for cache busting.
Of course, this doesn't happen if you load UI5 from a different server like ui5 serve
but for small tests it might be overkill to start a server just to execute some small tests.
I'm using this in the openui5-redux-model and can't execute the tests because of that. If I modify the regex the tests run fine.
@cevou fair enough. This needs to be addressed in the https://github.com/SAP/openui5 project. Feel free to file a pull-request.
I just had the same problem and noticed that this only happens with "self-contained" builds if i build the normal build dose not have this script check
EDIT : So running ui5 build self-contained --all --include-task=*
fixed the problem for me
Hi I am using karma 0.13.15.
Attempting to load openUI5 and I get the following error: Uncaught Error: sap-ui-core.js: could not identify script tag! at C:/resources/sap-ui-core.js:25
I only see the script tags that load openUI5 when going into the Karma debug runner.
Here is my config file; what am I doing wrong? ( I have stripped out my code and tests, while trying to narrow down the problem. The result is the same with my code and test files included.)
// Karma configuration // Generated on Fri Nov 06 2015 16:48:28 GMT-0500 (Eastern Standard Time)
module.exports = function(config) { config.set({
})
}