From a72d1891a6de7ce6fa1d00eeed743998fa8db905 Mon Sep 17 00:00:00 2001 From: Benny Powers Date: Fri, 14 Feb 2020 00:12:58 +0200 Subject: [PATCH] test(typescript): Add test for optional chaining (#207) * test(typescript): Add test for optional chaining * Skip failing test for now Co-authored-by: Tiger Oakes --- .../typescript/test/fixtures/optional-chaining/main.ts | 8 ++++++++ packages/typescript/test/test.js | 10 ++++++++++ 2 files changed, 18 insertions(+) create mode 100644 packages/typescript/test/fixtures/optional-chaining/main.ts diff --git a/packages/typescript/test/fixtures/optional-chaining/main.ts b/packages/typescript/test/fixtures/optional-chaining/main.ts new file mode 100644 index 000000000..76efdb2f3 --- /dev/null +++ b/packages/typescript/test/fixtures/optional-chaining/main.ts @@ -0,0 +1,8 @@ +interface OC { + a: number; + b?: { + c?: number; + }; +} +const o = { a: 1 } as OC; +export default o.b?.c ?? 'NOT FOUND'; diff --git a/packages/typescript/test/test.js b/packages/typescript/test/test.js index 3cc168ecc..2deed03bf 100644 --- a/packages/typescript/test/test.js +++ b/packages/typescript/test/test.js @@ -525,6 +525,16 @@ test('supports CommonJS imports when the output format is CommonJS', async (t) = t.is(output, 'exported from commonjs'); }); +test.skip('supports optional chaining', async (t) => { + const bundle = await rollup({ + input: 'fixtures/optional-chaining/main.ts', + plugins: [typescript({ module: 'esnext', target: 'esnext' })], + onwarn + }); + const output = await evaluateBundle(bundle); + t.is(output, 'NOT FOUND'); +}); + function fakeTypescript(custom) { return Object.assign( {