From 346f7027e2285b3ff1280197045c4db541f4a700 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 28 Mar 2019 20:42:32 +0100 Subject: [PATCH] Add workaround for innerText in Jest --- spec/frontend/test_setup.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js index 006fc60ef57..1edb2450b4c 100644 --- a/spec/frontend/test_setup.js +++ b/spec/frontend/test_setup.js @@ -23,3 +23,12 @@ beforeEach(done => { }); Vue.use(Translate); + +// workaround for JSDOM not supporting innerText +// see https://github.com/jsdom/jsdom/issues/1245 +Object.defineProperty(global.Element.prototype, 'innerText', { + get() { + return this.textContent; + }, + configurable: true, // make it so that it doesn't blow chunks on re-running tests with things like --watch +});