declaration-syntax-tester

0.1.2 • Public • Published

Install

npm install declaration-syntax-tester --save-dev

Using with tape

const test = require('tape');
const {accept, reject} = require('declaration-syntax-tester')();
 
test('sample...', t => {
  // Write test case for accepted syntax of declaration files
  t.error(accept(`
    import sample from '../sample';
    const x:number = sample.getNumber();
  `), 'should getNumber() return number.');
 
  // Write test case for rejected syntax of declaration files
  t.error(reject(`
    import sample from '../sample';
    const x:string = sample.getNumber();
  `), 'should return value of getNumber() can not assign to string.');
})

A sample project

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    1
  • 0.1.1
    1

Package Sidebar

Install

npm i declaration-syntax-tester

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • ssen