trouble with angularjs owa app tests after generating skeleton

(Chris Callan) #1

I installed the generator from @openmrs/generator-openmrs-owa and things seem to be “OK”, can build and get a compiled zip. However, any attempts at running the e2e tests results in multiple errors (see link)

I can still deploy the owa but not having tests working right off the bat doesn’t fill me with a lot of confidence. Am I doing something incorrect, missing dependencies, mis-config, etc…? I’m a bit new to OpenMRS so am not real sure that I’ve got all my ducks in a row there, but since I hadn’t made any changes to to the scaffolded project I had assumed that they’d work.

Repro steps:

  1. Make a directory for your project and navigate into it
  2. Install generator project “yo @openmrs/generator-openmrs-owa”
  3. execute the command “npm run test”

Actual Result:

Expected Result: Tests should execute right out of the box

EDIT: additional troubleshooting has tracked the specific location of ngSanitize errors down (highlighted text is the ‘a’ function that is referenced in the error):

function (A, e) {
!function (A, e) {
“use strict”;
function t() {
function t(A, e) {
var t,
n = {},
r = A.split(",");
for (t = 0; t < r.length; t++)
n[e ? a(r[t]) : r[t]] = !0; // this is where the “a is not a function” is pointing to
return n

seems to be the minified/uglified version that I’m looking at so not sure how this translates to actual ngSanitize. Have I done something wrong with ngSanitize here that is causing this to explode? Full code for the OWA can be found here ( It’s really nothing AngularJS beyond what the generator setup.

(Chris Callan) #2

Was able to resolve my issue by removing the “^” from the versions of AngularJS. Apparently what AngularJS feels is “compatible” (v1.7.5) with version 1.5.5 simply is not compatible. Largely due to the ngSanitize changes that were introduced in v1.6.4. Thankfully I was able to locate the ngSanitize code, and locate the non-minified area of code that looked to minify to the “a(r[t])” was in fact “lowercase(items[i])”. This gave me something to go on since ngSanitize seems to be a headache for many other folks in this set of versions too.

Hopefully this can serve as a pointer for other folks that try to simply build the openmrs-owa-generator and see errors right off the bat. I’ll see about adding a PR to the generator code base if time allows.

(Daniel Kayiwa) #3

Thank you so much @chriscallan for sharing the solution and the willingness to help others with a pull request which we anxiously look forward to! :smile: