Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions src/HMI/webhmi.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,32 @@ var jQueryImport;
// jQuery polyfills - Later
if (typeof jQuery === 'undefined') {

try {
if (typeof module !== 'undefined' && module.exports) {

// appease jenkins if possible
// jest runs tests in a node environment without the wrapping app that "includes" jQuery
jQueryImport = require('jquery');
// we are running in a node js environment

try {

// appease jenkins if possible
// jest runs tests in a node environment without the wrapping app that "includes" jQuery
jQueryImport = require('jquery');

} catch {
throw new Error('Polyfill not done! Get jQuery!');
} catch {
throw new Error('Polyfill not done! Get jQuery!');
}

} else {

// we are not running in a node js environment

// try getting jquery from cypress
if (typeof Cypress === 'undefined') {
throw new Error('Polyfill not done! Get jQuery!');
} else {
jQueryImport = Cypress.$
window.$ = window.jQuery = Cypress.$
}

}

} else {
Expand Down