-
Notifications
You must be signed in to change notification settings - Fork 214
Static types testing
We have some tests for static types per se, which don't get run in agoric-sdk-unit-testing.
For example,
- https://github.com/Agoric/agoric-sdk/blob/master/packages/zoe/test/types.test-d.ts
- https://github.com/Agoric/agoric-sdk/blob/master/packages/ERTP/test/types.test-d.ts
- https://github.com/Agoric/agoric-sdk/blob/master/packages/vat-data/src/index.test-d.ts
At one point we had collocated the tests with the unit tests using test.skip('types')
but it made "skip" noise in output and the .js syntax prevented us from using some helpful features of https://github.com/SamVerschueren/tsd.
So these tests use the .ts
syntax to allow for specifying expected types, like so:
https://github.com/Agoric/agoric-sdk/blob/f3bb7952ee1a7f6832ecbddf3aa4b26545723f4c/packages/vat-data/src/index.test-d.ts#L70-L73
These files are read only by the tsc
checker run by yarn lint:types
. Note that these aren't .d.ts
files which are TypeScript declarations. The .test-d.ts
is a convention of TSD but you can think of them as any other .ts
file. It's never run because it's not in src
and it doesn't match the pattern Ava looks for in tests
. It's parsed only by tsc
. When the package gets built the tsc
config will transpile it, but to a similarly ignored test file.
This wiki is for developing agoric-sdk. For help using Agoric SDK, see https://docs.agoric.com/ and https://agoric-sdk.pages.dev/