;
+ }
+ }
+}
diff --git a/test/karma/test-global-script/src/global.ts b/test/karma/test-global-script/src/global.ts
new file mode 100644
index 00000000000..fe805f946c9
--- /dev/null
+++ b/test/karma/test-global-script/src/global.ts
@@ -0,0 +1,10 @@
+declare global {
+ interface Window {
+ __testStart: number;
+ }
+}
+
+export default async function () {
+ window.__testStart = Date.now();
+ return new Promise((resolve) => setTimeout(() => resolve('done!'), 1000));
+}
diff --git a/test/karma/test-global-script/src/test-cmp/test-cmp.tsx b/test/karma/test-global-script/src/test-cmp/test-cmp.tsx
new file mode 100644
index 00000000000..9a4bdd670f4
--- /dev/null
+++ b/test/karma/test-global-script/src/test-cmp/test-cmp.tsx
@@ -0,0 +1,11 @@
+import { Component, h } from '@stencil/core';
+
+@Component({
+ tag: 'test-cmp',
+ scoped: true,
+})
+export class SiblingRoot {
+ render() {
+ return I am rendered after {Date.now() - window.__testStart}
;
+ }
+}
diff --git a/test/karma/test-global-script/stencil.config.ts b/test/karma/test-global-script/stencil.config.ts
new file mode 100644
index 00000000000..cb220a146c3
--- /dev/null
+++ b/test/karma/test-global-script/stencil.config.ts
@@ -0,0 +1,14 @@
+import { Config } from '../../../dist/declarations';
+const { WWW_OUT_DIR } = require('../constants');
+
+export const config: Config = {
+ namespace: 'TestGlobalScript',
+ tsconfig: 'tsconfig.json',
+ outputTargets: [
+ {
+ type: 'www',
+ dir: `../${WWW_OUT_DIR}`,
+ },
+ ],
+ globalScript: 'src/global.ts',
+};
diff --git a/test/karma/test-global-script/tsconfig.json b/test/karma/test-global-script/tsconfig.json
new file mode 100644
index 00000000000..298cfbea2a1
--- /dev/null
+++ b/test/karma/test-global-script/tsconfig.json
@@ -0,0 +1,35 @@
+{
+ "compilerOptions": {
+ "alwaysStrict": true,
+ "allowSyntheticDefaultImports": true,
+ "allowUnreachableCode": true,
+ "declaration": false,
+ "resolveJsonModule": true,
+ "experimentalDecorators": true,
+ "forceConsistentCasingInFileNames": true,
+ "jsx": "react",
+ "jsxFactory": "h",
+ "lib": [
+ "dom",
+ "es2017"
+ ],
+ "module": "esnext",
+ "moduleResolution": "node",
+ "noImplicitAny": false,
+ "noImplicitReturns": false,
+ "noUnusedLocals": false,
+ "noUnusedParameters": false,
+ "pretty": true,
+ "target": "es2017",
+ "useUnknownInCatchVariables": true,
+ "baseUrl": ".",
+ "paths": {
+ "@stencil/core": ["../../../internal"],
+ "@stencil/core/internal": ["../../../internal"],
+ "@stencil/core/testing": ["../../../testing"]
+ }
+ },
+ "include": [
+ "src"
+ ]
+}
diff --git a/test/karma/tsconfig.json b/test/karma/tsconfig.json
index ae28f0ba711..5c35aaa5f27 100644
--- a/test/karma/tsconfig.json
+++ b/test/karma/tsconfig.json
@@ -41,6 +41,7 @@
],
"exclude": [
"test-prerender",
- "test-sibling"
+ "test-sibling",
+ "test-global-script"
]
}