Skip to content

Commit

Permalink
Silence the error generated by jsdom xhr when loading assets/lang/en-…
Browse files Browse the repository at this point in the history
…US.lang when a path to language files is not set
  • Loading branch information
lucasnetau committed Oct 17, 2023
1 parent 8ac99d1 commit 9806407
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/setup-jest.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@


import $ from 'jquery'
global.$ = $
global.jQuery = $

const langFiles = require('formbuilder-languages')
global.FB_EN_US = langFiles['en-US']
global.FB_EN_US = langFiles['en-US']

/** Hack to silence errors from default request to assets/lang/en-US.lang **/
const originalConsoleError = console.error
const jsDomCssError = 'Error: AggregateError'
console.error = (...params) => {
if (!params.find(p => p.toString().includes(jsDomCssError))) {
originalConsoleError(...params)
}
}

0 comments on commit 9806407

Please sign in to comment.