Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aikoven/typings-tester
https://github.com/aikoven/typings-tester
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/aikoven/typings-tester
- Owner: aikoven
- Created: 2016-11-19T04:02:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T03:52:54.000Z (over 3 years ago)
- Last Synced: 2024-10-30T20:47:53.586Z (2 months ago)
- Language: TypeScript
- Size: 85.9 KB
- Stars: 46
- Watchers: 6
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Typings Tester [![npm version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
A library aimed to aid testing of TypeScript definitions.
Checks TypeScript files for syntactic, expected and unexpected semantic (type) errors.**Note:** _There's an [official tool](https://github.com/Microsoft/dtslint#write-tests) that provides similar functionality and might be a better choice._
## Installation
$ npm install -D typings-tester
Any version of TypeScript must be installed separately.## CLI Usage
$ typings-tester --config path/to/tsconfig.json **/*.ts
$ typings-tester --dir path/to/directory
## API Usage```ts
import test from "tape";
import {check, checkDirectory} from "typings-tester";test('typings', assert => {
assert.doesNotThrow(() => check(['test.ts'], 'tsconfig.json'));
assert.doesNotThrow(() => checkDirectory('src'));
});
```## Flags
* `typings:expect-error`: expect next line or block to contain semantic error. `typings-tester` will fail if no error is produced.```ts
// typings:expect-error
function shouldFail(a: number): string {
return a;
}
```## What's next
* Testing against multiple versions of TypeScript
* Inferred type assertions[npm-image]: https://badge.fury.io/js/typings-tester.svg
[npm-url]: https://badge.fury.io/js/typings-tester
[travis-image]: https://travis-ci.org/aikoven/typings-tester.svg?branch=master
[travis-url]: https://travis-ci.org/aikoven/typings-tester