diff --git a/package.json b/package.json index 1956b2814..5fa997dae 100644 --- a/package.json +++ b/package.json @@ -92,9 +92,6 @@ "typescript": "^3.7.3" }, "jest": { - "testEnvironment": "node", - "setupFilesAfterEnv": [ - "/spec/setupTests.js" - ] + "testEnvironment": "node" } } diff --git a/spec/setupTests.js b/spec/browserify/setupTests.js similarity index 100% rename from spec/setupTests.js rename to spec/browserify/setupTests.js diff --git a/spec/browserify/sync-browserify.spec.js b/spec/browserify/sync-browserify.spec.js index d11a8f69d..91d430c0b 100644 --- a/spec/browserify/sync-browserify.spec.js +++ b/spec/browserify/sync-browserify.spec.js @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +// load XmlHttpRequest mock +import "./setupTests"; import "../../dist/browser-matrix"; // uses browser-matrix instead of the src import {MockStorageApi} from "../MockStorageApi"; import {WebStorageSessionStore} from "../../src/store/session/webstorage"; @@ -65,6 +67,11 @@ describe("Browserify Test", function() { await httpBackend.stop(); }); + afterAll(() => { + // clean up XMLHttpRequest mock + global.XMLHttpRequest = undefined; + }); + it("Sync", async function() { const event = utils.mkMembership({ room: ROOM_ID,