npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

espower-typescript

v10.0.1

Published

power-assert instrumentor for TypeScript

Downloads

24,463

Readme

espower-typescript

power-assert instrumentor for TypeScript

npm version Node.js Version Support TypeScript Version Support build status Dependency Status monthly downloads License

TypeScript versions

espower-typescript v10.x is compatible with TypeScript v2.7+

Usage (zero-config mode)

Install

$ npm install -D espower-typescript power-assert mocha typescript @types/node @types/mocha

Create a test file (intensionally failed)

// test/test.ts
import assert = require('assert');

describe('Array#join', () => {
  it('joins all elements into a string with separator', () => {
    assert(['a', 'b', 'c'].join(':') === 'a:b:c:');
  });
});

Run test

$ ./node_modules/.bin/mocha --require espower-typescript/guess "test/**/*.ts"

Output

  1) Array#join
       joins all elements into a string with separator:

      AssertionError [ERR_ASSERTION]:   # test.ts:6

  assert(['a','b','c'].join(':') === 'a:b:c:')
         |             |         |
         ["a","b","c"] "a:b:c"   false

CAUTION: don't use import assert from 'assert'

Just use old style import assert = require('assert') for assert module. This is limitation.

Configure

If your tests are not in test directory

You can set test directory in your package.json

{
    "name": "your-module",
    "description": "Your module",
    "version": "0.0.1",
    "directories": {
        "test": "spec/"
    },
...
}

Then, run mocha with --require espower-typescript/guess

$ ./node_modules/.bin/mocha --require espower-typescript/guess "spec/**/*.ts"

Note: 'espower-typescript/guess' is inspired by intelli-espower-loader

ts-node and tsconfig.json

espower-typescript uses ts-node internally. It loads your tsconfig.json automatically.

Disable type check (transpile only)

Use TS_NODE_TRANSPILE_ONLY env of ts-node

$ TS_NODE_TRANSPILE_ONLY=1 ./node_modules/.bin/mocha --require espower-typescript/guess "test/**/*.ts"

JSX/React

.tsx files are supported.

allowJs

If allowJs: true in your tsconfig.json, assertions in test/**/*.(js|jsx) are empowered.

License