Skip to content

Commit

Permalink
test(typescript): Add test for optional chaining (#207)
Browse files Browse the repository at this point in the history
* test(typescript): Add test for optional chaining

* Skip failing test for now

Co-authored-by: Tiger Oakes <[email protected]>
  • Loading branch information
bennypowers and NotWoods authored Feb 13, 2020
1 parent 4207609 commit a72d189
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/typescript/test/fixtures/optional-chaining/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
interface OC {
a: number;
b?: {
c?: number;
};
}
const o = { a: 1 } as OC;
export default o.b?.c ?? 'NOT FOUND';
10 changes: 10 additions & 0 deletions packages/typescript/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down

0 comments on commit a72d189

Please sign in to comment.