Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assert-typescript-errors

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assert-typescript-errors

Assert that TypeScript finds an error in your test files.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

assert-typescript-errors

Automatically verify that certain test files fail to pass TypeScript type checks.

This package checks the output from TypeScript's compiler (with the --pretty flag expected to be false) and ensures that it matches with the line numbers you specify.

Usage

As a module

import { exec } from 'child_process';
import { assertTypeScriptErrors } from 'assert-typescript-errors';

/**
 * Specify the lines that should have errors in your test files.
 */
const assertions = {
    'test/type-test.ts': [
        29, // Individual line numbers can be used
        '57-58', // Ranges of line numbers can also be specified. Equivalent to 57, 58.
    ],
    'test/type-test-two.ts': [31, 39, '45-51'],
};

exec('tsc --pretty false', (err, stdout) => {
    assertTypeScriptErrors(stdout, assertions).catch(console.error);
});

From the command line

echo '{ "type-test.ts": [29, "56-60"] }' > assertions.json
tsc --pretty false | assert-ts-errors assertions.json

FAQs

Package last updated on 20 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc