11.09.2015 Views

Typescript Deep Dive by Basarat Ali Syed

Typescript Deep Dive by Basarat Ali Syed

Typescript Deep Dive by Basarat Ali Syed

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

TypeScript <strong>Deep</strong> <strong>Dive</strong><br />

Compiler Tests<br />

These ensure that compiling a file :<br />

generates errors as expected<br />

generated JS as expected<br />

types are identified as expected<br />

symbols are identified as expected<br />

These expectations are validated using the baselines infrastructure.<br />

Creating a Compiler Test<br />

Test can be created <strong>by</strong> adding a new file yourtest.ts to tests/cases/compiler . As soon as you do so and run the tests you<br />

should get baseline failure. Accept these baselines (to get them to show up in git), and tweak them to be what you expect<br />

them to be ... now get the tests to pass.<br />

Run all of these in isolation using jake runtests tests=compiler , or just your new file using jake runtests<br />

tests=compiler/yourtest<br />

I will even often do jake runtests tests=compiler/yourtest || jake baseline-accept[soft] and get the diff in git .<br />

Contributing<br />

104

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!