From 9960b1d22b474d87d03855e2aefd8c552ce02e58 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Mon, 27 Aug 2018 19:32:12 -0700 Subject: [PATCH] Add duplicate import test --- tests/014_duplicate_import.ts | 9 +++++++++ tests/014_duplicate_import.ts.out | 1 + tests/subdir/auto_print_hello.ts | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 tests/014_duplicate_import.ts create mode 100644 tests/014_duplicate_import.ts.out create mode 100644 tests/subdir/auto_print_hello.ts diff --git a/tests/014_duplicate_import.ts b/tests/014_duplicate_import.ts new file mode 100644 index 0000000000..88f9345269 --- /dev/null +++ b/tests/014_duplicate_import.ts @@ -0,0 +1,9 @@ +// with all the imports of the same module, the module should only be +// instantiated once +import "./subdir/auto_print_hello.ts"; + +import "./subdir/auto_print_hello.ts"; + +(async () => { + await import("./subdir/auto_print_hello.ts"); +})(); diff --git a/tests/014_duplicate_import.ts.out b/tests/014_duplicate_import.ts.out new file mode 100644 index 0000000000..4effa19f4f --- /dev/null +++ b/tests/014_duplicate_import.ts.out @@ -0,0 +1 @@ +hello! diff --git a/tests/subdir/auto_print_hello.ts b/tests/subdir/auto_print_hello.ts new file mode 100644 index 0000000000..a00040281b --- /dev/null +++ b/tests/subdir/auto_print_hello.ts @@ -0,0 +1,2 @@ +console.log("hello!"); +export = {};