diff --git a/src/compile/render-dom/index.ts b/src/compile/render-dom/index.ts index f2e47532c9..518f0e4208 100644 --- a/src/compile/render-dom/index.ts +++ b/src/compile/render-dom/index.ts @@ -279,7 +279,7 @@ export default function dom( const user_code = component.javascript || ( component.ast.js.length === 0 && filtered_props.length > 0 - ? `let { ${filtered_props.map(x => x.name === x.as ? x.as : `${x.as}: ${x.name}`).join(', ')} } = $$props;` + ? `let { ${filtered_props.map(x => x.name).join(', ')} } = $$props;` : null ); diff --git a/src/utils/globalWhitelist.ts b/src/utils/globalWhitelist.ts index 78cbf0d9df..1c115c372b 100644 --- a/src/utils/globalWhitelist.ts +++ b/src/utils/globalWhitelist.ts @@ -19,6 +19,7 @@ export default new Set([ 'Object', 'parseFloat', 'parseInt', + 'process', 'Promise', 'RegExp', 'Set', diff --git a/test/runtime/index.js b/test/runtime/index.js index a230e8f571..88e2d0fe84 100644 --- a/test/runtime/index.js +++ b/test/runtime/index.js @@ -126,7 +126,9 @@ describe("runtime", () => { global.window = window; - // Put the constructor on window for testing + if (config.before_test) config.before_test(); + + // Put things we need on window for testing window.SvelteComponent = SvelteComponent; const target = window.document.querySelector("main"); @@ -208,6 +210,8 @@ describe("runtime", () => { } flush(); + + if (config.after_test) config.after_test(); }); }); } diff --git a/test/runtime/samples/globals-accessible-directly-process/_config.js b/test/runtime/samples/globals-accessible-directly-process/_config.js new file mode 100644 index 0000000000..99f1025f5c --- /dev/null +++ b/test/runtime/samples/globals-accessible-directly-process/_config.js @@ -0,0 +1,11 @@ +export default { + html: '