ghiscoding / Aurelia-Bootstrap-Plugins

Aurelia-Bootstrap-Plugins are Custom Elements to bridge with a set of 3rd party Bootstrap addons
https://ghiscoding.github.io/Aurelia-Bootstrap-Plugins
MIT License
45 stars 23 forks source link

Unhandled errors during au test #30

Closed MonikaDjordjevic closed 6 years ago

MonikaDjordjevic commented 6 years ago

Hi I have an issue with au tests after configuring this plugin.

While running tests console shows error with such lines:

Error: Mismatched anonymous define() module: function () { 'use strict';

var hookCallback;

function hooks () { return hookCallback.apply(null, arguments); }

// This is done to register the method called with moment() // without creating circular dependencies. function setHookCallback (callback) { hookCallback = callback; }

function isArray(input) { return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; }

function isObject(input) { // IE8 will treat undefined and null as object if it wasn't for // input != null return input != null && Object.prototype.toString.call(input) === '[object Object]'; }

function isObjectEmpty(obj) { var k; for (k in obj) { // even if its not own property I'd still call it non-empty return false; } return true; }

function isUndefined(input) { return input === void 0; }

function isNumber(input) { return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; }

function isDate(input) { return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; }

function map(arr, fn) { var res = [], i; for (i = 0; i < arr.length; ++i) { res.push(fn(arr[i], i)); } return res; }

function hasOwnProp(a, b) { return Object.prototype.hasOwnProperty.call(a, b); }

function extend(a, b) { for (var i in b) { if (hasOwnProp(b, i)) { a[i] = b[i]; } }

  if (hasOwnProp(b, 'toString')) {
      a.toString = b.toString;
  }

  if (hasOwnProp(b, 'valueOf')) {
      a.valueOf = b.valueOf;
  }

  return a;

}

function createUTC (input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); }

function defaultParsingFlags() { // We need to deep clone this object. return { empty : false, unusedTokens : [], unusedInput : [], overflow : -2, charsLeftOver : 0, nullInput : false, invalidMonth : null, invalidFormat : false, userInvalidated : false, iso : false, parsedDateParts : [], meridiem : null, rfc2822 : false, weekdayMismatch : false }; }

My aurelia.json configuration:

"moment", { "name": "eonasdan-bootstrap-datetimepicker", "path": "../node_modules/eonasdan-bootstrap-datetimepicker/build", "main": "js/bootstrap-datetimepicker.min", "resources": [ "css/bootstrap-datetimepicker.min.css" ] }, { "name": "aurelia-bootstrap-datetimepicker", "path": "../node_modules/aurelia-bootstrap-datetimepicker/dist/amd", "main": "index", "resources": [ "*/.{css,html}" ] }

I have no idea what might cause this issue or how solve them. If you have any solutions or ideas please share.

ghiscoding commented 6 years ago

Unfortunately I did not have time to add any test in this library since this is all done in my spare time. So I'm sorry to that I can't really help you on the subject.

However, I don't have any define() function in my code, so I'm not too sure that this error really comes from my library. Do you have an App working with the Bootstrap Plugin? Do you have other tests working?

Error: Mismatched anonymous define() module: function () { 'use strict';

MonikaDjordjevic commented 6 years ago

I managed to sort out problem.

It appears that its problem of moment.js because it does not add ID string while defining its module with require.js. So the solution was to modify the Moment.js library or to move moment include from aurelia.json and add it in index.html with Githubissues.

  • Githubissues is a development platform for aggregating issues.