summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2018-10-31 14:50:40 +1100
committerRyan Dahl <ry@tinyclouds.org>2018-10-30 20:50:40 -0700
commit2422e526257d971ba382bb9195e0ee527b918672 (patch)
tree0c328ab748c070d0b165f859fabf105d0b2829e9 /tests
parent0fbee30f050bc27b9a687c2580c89cb9dc5d7fec (diff)
Add ability to load JSON as modules (#1065)
Diffstat (limited to 'tests')
-rw-r--r--tests/020_json_modules.ts3
-rw-r--r--tests/020_json_modules.ts.out1
-rw-r--r--tests/subdir/config.json6
3 files changed, 10 insertions, 0 deletions
diff --git a/tests/020_json_modules.ts b/tests/020_json_modules.ts
new file mode 100644
index 000000000..89963751c
--- /dev/null
+++ b/tests/020_json_modules.ts
@@ -0,0 +1,3 @@
+import * as config from "./subdir/config.json";
+
+console.log(JSON.stringify(config));
diff --git a/tests/020_json_modules.ts.out b/tests/020_json_modules.ts.out
new file mode 100644
index 000000000..5d1623e6b
--- /dev/null
+++ b/tests/020_json_modules.ts.out
@@ -0,0 +1 @@
+{"foo":{"bar":true,"baz":["qat",1]}}
diff --git a/tests/subdir/config.json b/tests/subdir/config.json
new file mode 100644
index 000000000..01c3b5e79
--- /dev/null
+++ b/tests/subdir/config.json
@@ -0,0 +1,6 @@
+{
+ "foo": {
+ "bar": true,
+ "baz": ["qat", 1]
+ }
+}