unassert-js / unassert

Encourages programming with assertions by providing tools to compile them away.
MIT License
192 stars 13 forks source link

feat: Support removal of async assertion such as `assert.rejects` #36

Closed twada closed 2 years ago

twada commented 2 years ago

input:

import assert from 'node:assert/strict';
import { validate } from './somewhere.mjs';

async function add (a, b) {
  await assert.rejects(validate(a));
  await assert.doesNotReject(validate(b));
  return a + b;
}

output:


import { validate } from './somewhere.mjs';

async function add(a, b) {
  return a + b;
}