From 2422e526257d971ba382bb9195e0ee527b918672 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Wed, 31 Oct 2018 14:50:40 +1100 Subject: Add ability to load JSON as modules (#1065) --- tests/020_json_modules.ts | 3 +++ tests/020_json_modules.ts.out | 1 + tests/subdir/config.json | 6 ++++++ 3 files changed, 10 insertions(+) create mode 100644 tests/020_json_modules.ts create mode 100644 tests/020_json_modules.ts.out create mode 100644 tests/subdir/config.json (limited to 'tests') 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] + } +} -- cgit v1.2.3