diff --git a/packages/config/jest.cjs b/packages/config/jest.cjs index a905f0c42b..43ea363093 100644 --- a/packages/config/jest.cjs +++ b/packages/config/jest.cjs @@ -19,5 +19,6 @@ module.exports.makePackageConfig = (dirname) => { name: packageBaseName, color: packageBaseName === "jspsych" ? "white" : "cyanBright", }, + setupFilesAfterEnv: ["../config/jest.setup.js"], }; }; diff --git a/packages/config/jest.setup.js b/packages/config/jest.setup.js new file mode 100644 index 0000000000..4c6b91b318 --- /dev/null +++ b/packages/config/jest.setup.js @@ -0,0 +1,3 @@ +global.afterEach(() => { + document.body.innerHTML = ''; +}); \ No newline at end of file