diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-06-09 15:08:20 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-06-09 09:08:20 -0400 |
commit | a115340288d974f141cceb16faac71914402c445 (patch) | |
tree | 80353d2579e6d6dc9febd449f1f779ffa62c8397 /tests | |
parent | 8ec5276d30dac59ced0ca7e35e07e20644ee2188 (diff) |
feat: Import maps (#2360)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/033_import_map.out | 7 | ||||
-rw-r--r-- | tests/033_import_map.test | 2 | ||||
-rw-r--r-- | tests/importmaps/import_map.json | 14 | ||||
-rw-r--r-- | tests/importmaps/lodash/lodash.ts | 1 | ||||
-rw-r--r-- | tests/importmaps/lodash/other_file.ts | 1 | ||||
-rw-r--r-- | tests/importmaps/moment/moment.ts | 1 | ||||
-rw-r--r-- | tests/importmaps/moment/other_file.ts | 1 | ||||
-rw-r--r-- | tests/importmaps/scope/scoped.ts | 2 | ||||
-rw-r--r-- | tests/importmaps/scoped_moment.ts | 1 | ||||
-rw-r--r-- | tests/importmaps/test.ts | 6 | ||||
-rw-r--r-- | tests/importmaps/vue.ts | 1 |
11 files changed, 37 insertions, 0 deletions
diff --git a/tests/033_import_map.out b/tests/033_import_map.out new file mode 100644 index 000000000..e9b9160e9 --- /dev/null +++ b/tests/033_import_map.out @@ -0,0 +1,7 @@ +Hello from remapped moment! +Hello from remapped moment dir! +Hello from remapped lodash! +Hello from remapped lodash dir! +Hello from remapped Vue! +Hello from scoped moment! +Hello from scoped! diff --git a/tests/033_import_map.test b/tests/033_import_map.test new file mode 100644 index 000000000..1633c1807 --- /dev/null +++ b/tests/033_import_map.test @@ -0,0 +1,2 @@ +args: run --reload --importmap=tests/importmaps/import_map.json tests/importmaps/test.ts +output: tests/033_import_map.out diff --git a/tests/importmaps/import_map.json b/tests/importmaps/import_map.json new file mode 100644 index 000000000..601874aab --- /dev/null +++ b/tests/importmaps/import_map.json @@ -0,0 +1,14 @@ +{ + "imports": { + "moment": "./moment/moment.ts", + "moment/": "./moment/", + "lodash": "./lodash/lodash.ts", + "lodash/": "./lodash/", + "https://www.unpkg.com/vue/dist/vue.runtime.esm.js": "./vue.ts" + }, + "scopes": { + "scope/": { + "moment": "./scoped_moment.ts" + } + } +} diff --git a/tests/importmaps/lodash/lodash.ts b/tests/importmaps/lodash/lodash.ts new file mode 100644 index 000000000..2ec04ed3c --- /dev/null +++ b/tests/importmaps/lodash/lodash.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash!"); diff --git a/tests/importmaps/lodash/other_file.ts b/tests/importmaps/lodash/other_file.ts new file mode 100644 index 000000000..714adae3f --- /dev/null +++ b/tests/importmaps/lodash/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped lodash dir!"); diff --git a/tests/importmaps/moment/moment.ts b/tests/importmaps/moment/moment.ts new file mode 100644 index 000000000..2b54a431e --- /dev/null +++ b/tests/importmaps/moment/moment.ts @@ -0,0 +1 @@ +console.log("Hello from remapped moment!"); diff --git a/tests/importmaps/moment/other_file.ts b/tests/importmaps/moment/other_file.ts new file mode 100644 index 000000000..24f3a0226 --- /dev/null +++ b/tests/importmaps/moment/other_file.ts @@ -0,0 +1 @@ +console.log("Hello from remapped moment dir!"); diff --git a/tests/importmaps/scope/scoped.ts b/tests/importmaps/scope/scoped.ts new file mode 100644 index 000000000..9a0b5d8e3 --- /dev/null +++ b/tests/importmaps/scope/scoped.ts @@ -0,0 +1,2 @@ +import "moment"; +console.log("Hello from scoped!"); diff --git a/tests/importmaps/scoped_moment.ts b/tests/importmaps/scoped_moment.ts new file mode 100644 index 000000000..9f67f88d4 --- /dev/null +++ b/tests/importmaps/scoped_moment.ts @@ -0,0 +1 @@ +console.log("Hello from scoped moment!"); diff --git a/tests/importmaps/test.ts b/tests/importmaps/test.ts new file mode 100644 index 000000000..9b09e9953 --- /dev/null +++ b/tests/importmaps/test.ts @@ -0,0 +1,6 @@ +import "moment"; +import "moment/other_file.ts"; +import "lodash"; +import "lodash/other_file.ts"; +import "https://www.unpkg.com/vue/dist/vue.runtime.esm.js"; +import "./scope/scoped.ts"; diff --git a/tests/importmaps/vue.ts b/tests/importmaps/vue.ts new file mode 100644 index 000000000..76dbe1917 --- /dev/null +++ b/tests/importmaps/vue.ts @@ -0,0 +1 @@ +console.log("Hello from remapped Vue!"); |