power-assert-js/espower-typescript

how to use with jest

qingfengpai opened this issue · 8 comments

how to use with jest

Sorry, I don't use Jest with this package. Someone could help?

twada commented

Me neither. So labeled as help wanted.

karak commented

@qingfengpai
I'm not a user of power-assert but ts-jest may help you.
Sample: https://github.com/karak/power-assert-ts-jest

twada commented

@karak Thanks a lot!!

@karak
I expect to report

 - Expected
    + Received

    - Object {
    -   "greeting": "Hello",
    - }
    + Object {}

      assert.equal({}, { greeting: "Hello" })
                   |   |
                   |   Object{greeting:"Hello"}
                   Object{}

but actual result

    - Expected
    + Received

    - Object {
    -   "greeting": "Hello",
    - }
    + Object {}

      2 |
      3 | it("hello", () => {
    > 4 |   assert.equal({}, { greeting: "Hello" });
        |          ^
      5 | });
      6 |

Have you hit on any possible causes of the problem?

karak commented

I confirmed the version of pure-js gave the same result, and can only say "power-assert" and/or "jest" may have some problems rather than TypeScript.

ADD:

The following command-lines are against your expects as well.

npx jasmine hello.test.js
npx mocha hello.test.js

Is the usage of power-assert correct? I'm not sure.

@karak
Thank you, sorry for asking too much.
Let me check it out.