Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with power-assert #17

Open
miohtama opened this issue Mar 5, 2020 · 1 comment
Open

Using with power-assert #17

miohtama opened this issue Mar 5, 2020 · 1 comment

Comments

@miohtama
Copy link

miohtama commented Mar 5, 2020

I would like to use power-assert for testing, but it conflicts with truffle-typings definitions.

  1. You need to require assert in your module and the module asserts get rewritten

  2. assert is already declared by truffle-typings as const and cannot be overwritten as import

Any good ideas how to work around this?

TSError: ⨯ Unable to compile TypeScript:
test/Token.spec.ts:4:7 - error TS2451: Cannot redeclare block-scoped variable 'assert'.

4 const assert = require("assert"); // Power assert https://github.com/power-assert-js/espower-typescript
        ~~~~~~

  node_modules/truffle-typings/index.d.ts:10:15
    10 declare const assert: Chai.AssertStatic;
                     ~~~~~~
    'assert' was also declared here.
@miohtama
Copy link
Author

miohtama commented Mar 5, 2020

I made a controversial workaround here:

miohtama@c8a74cb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant