Skip to content

Commit

Permalink
Merge pull request material-svelte#9 from IanVS/window-global
Browse files Browse the repository at this point in the history
Assign to window.global, not just global
  • Loading branch information
betaboon authored Jun 30, 2021
2 parents 9e5c034 + 9cd5d80 commit 67a32f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions examples/react/web-test-runner.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ module.exports = {
testRunnerHtml: testFramework => `
<html>
<head>
<script>
// Note: globals expected by @testing-library/react
global = window;
process = { env: {} };
</script>
<script type="module">
// Note: globals expected by @testing-library/react
window.global = window;
window.process = { env: {} };
// Note: adapted from https://github.com/vitejs/vite/issues/1984#issuecomment-778289660
// Note: without this you'll run into https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201
window.__vite_plugin_react_preamble_installed__ = true;
Expand Down
6 changes: 3 additions & 3 deletions examples/svelte/web-test-runner.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = {
testRunnerHtml: testFramework => `
<html>
<head>
<script>
<script type="module">
// Note: globals expected by @testing-library/svelte
global = window;
process = { env: {} };
window.global = window;
window.process = { env: {} };
</script>
<script type="module" src="${testFramework}"></script>
</head>
Expand Down
6 changes: 3 additions & 3 deletions examples/vue/web-test-runner.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = {
testRunnerHtml: testFramework => `
<html>
<head>
<script>
<script type="module">
// Note: globals expected by @testing-library/vue
global = window;
process = { env: {} };
window.global = window;
window.process = { env: {} };
</script>
<script type="module" src="${testFramework}"></script>
</head>
Expand Down

0 comments on commit 67a32f1

Please sign in to comment.