From 4f57ca0daf2471338efe4fafa0f0a25373bfcef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 30 Oct 2020 12:19:49 +0100 Subject: fix: panic in bundler (#8168) This commit fixes panic in bundler which was caused by not setting thread-local slots. --- cli/tests/integration_tests.rs | 5 +++++ cli/tests/ts_decorators_bundle.out | 3 +++ cli/tests/ts_decorators_bundle.ts | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 cli/tests/ts_decorators_bundle.out create mode 100644 cli/tests/ts_decorators_bundle.ts (limited to 'cli/tests') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 895c64098..979a2ffad 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2637,6 +2637,11 @@ itest!(ts_decorators { output: "ts_decorators.ts.out", }); +itest!(ts_decorators_bundle { + args: "bundle ts_decorators_bundle.ts", + output: "ts_decorators_bundle.out", +}); + itest!(ts_type_only_import { args: "run --reload ts_type_only_import.ts", output: "ts_type_only_import.ts.out", diff --git a/cli/tests/ts_decorators_bundle.out b/cli/tests/ts_decorators_bundle.out new file mode 100644 index 000000000..3a152aecc --- /dev/null +++ b/cli/tests/ts_decorators_bundle.out @@ -0,0 +1,3 @@ +[WILDCARD] +new SomeClass().test(); +[WILDCARD] \ No newline at end of file diff --git a/cli/tests/ts_decorators_bundle.ts b/cli/tests/ts_decorators_bundle.ts new file mode 100644 index 000000000..a8e2e952b --- /dev/null +++ b/cli/tests/ts_decorators_bundle.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ + +function Decorator() { + return function ( + target: Record, + propertyKey: string, + descriptor: TypedPropertyDescriptor, + ) { + const originalFn: Function = descriptor.value as Function; + descriptor.value = async function (...args: any[]) { + return await originalFn.apply(this, args); + }; + return descriptor; + }; +} + +class SomeClass { + @Decorator() + async test(): Promise {} +} + +new SomeClass().test(); -- cgit v1.2.3