We are using wallaby.js in an Angular 4 project with typescript and there are some parts using jQuery. Wallaby.js is throwing a ReferenceError:
ReferenceError: $ is not defined
Any ideas how to fix this?
Some Sample code:
import { Injectable } from '@angular/core';
declare var $: any;
@Injectable({
providedIn: 'root'
})
export class FroalaService {
constructor() { }
public initFroala(): void {
$.FroalaEditor.DefineIcon('insertnonbreakingspace', {NAME: 'arrows-h'});
$.FroalaEditor.RegisterCommand('insertnonbreakingspace', {
title: 'Non-Breaking Space',
focus: true,
undo: true,
refreshAfterCallback: true,
callback: function () {
this.html.insert('<span style="white-space: nowrap;"> </span>');
}
});
$.FroalaEditor.RegisterShortcut(32, 'insertnonbreakingspace', null, 'Space', false, false);
}
}
The solution for a basic jQuery implemention is to add jQuery to externals in wallaby.js:
...and to add jquery.js to files: