dojo / interfaces

🚀 Dojo 2 - common interfaces and types.
http://dojo.io
Other
1 stars 14 forks source link

CI and Testing for dojo/interfaces #2

Closed kitsonk closed 8 years ago

kitsonk commented 8 years ago

Bug / Enhancement

Because this is a declaration only package, how we test it (and what we need for CI) is quite a bit different.

We should look at how TypeScript tests itself and see if there is anything we could adapt to this repo. Essentially they have TypeScript generate special diagnostic files for code, which provide all the types expected at different code points and then compare that to expected fixtures.

kitsonk commented 8 years ago

Ok, I have adapted the TypeWriter that TypeScript uses to output types from a TypeScript file for their testing purposes and have configured it in a way that allows comparison against a fixture.

I think it needs further iteration though so that we have an assertion library, that given a map of types, it can be queried in an informative way, instead of just dumping "this came out of tsc last time, does it equal what came out this time".

kitsonk commented 8 years ago

There is further improvements that could be made, but what is there in #6 is sufficient for now.

The TypeWriter provides a flat set of types, which means that there is no way to "descend" into a type and validate its structure, as well as if you have a variable name duplicated across different types, the assertion library only finds the first one. For now, the unit tests are only validating that the top level types expected in the definition module exist and are of the expected type.

Also, the TypeWriter does include line numbers, so in theory, there could be a way of producing a line coverage analysis of what lines were actually checked for their types.