This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

preact-cli-power-assert

1.0.2 • Public • Published

preact-cli-power-assert

Plugin for ⚛️ preact-cli to use power-assert assertions.

npm David license

Getting Started

Install it with npm:

npm i -D preact-cli-power-assert

or with yarn:

yarn add preact-cli-power-assert --dev

This will also install:

And include in your project by creating or adding to preact.config.js.

export default function customWebpackConfiguration(config, env, helpers) {
  // Will run only in test environment via process.env.NODE_ENV check
  require('preact-cli-power-assert')(config, env);
}

Example

Write your assertions as usual, assert API is converted to power-assert by Babel.

import assert from 'assert';
 
function add (a, b) {
    assert(!isNaN(a));
    assert.equal(typeof b, 'number');
    assert.ok(!isNaN(b));
    return a + b;
}

Related

See also preact-cli-unassert.

Thanks

Many thanks to Jason Miller for creating ⚛️ Preact, much of the related ecosystem and lots of useful stuff.

Heavily inspired by preact-cli-lodash from Sara Vieira.

License

MIT

Package Sidebar

Install

npm i preact-cli-power-assert

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • marcodeltongo