espower-babel icon indicating copy to clipboard operation
espower-babel copied to clipboard

Unexpected behavior for __tests__ directory

Open Flaise opened this issue 10 years ago • 1 comments

Test project: https://github.com/Flaise/power-assert-test

Environment:

  • Ubuntu 14.04.3 LTS
  • node 4.1.1
  • npm 3.3.5
  • mocha 2.3.3
  • power-assert 1.1.0
  • espower-babel 3.3.0

Output:

$ npm run test-works

> [email protected] test-works .../power-assert-test
> ./node_modules/mocha/bin/mocha --compilers js:espower-babel/guess



  assert
    1) should not give the same output as a regular assertion


  0 passing (30ms)
  1 failing

  1) assert should not give the same output as a regular assertion:

      AssertionError:   # test/test.js:8

  assert(a.value === b.value)
         | |     |   | |     
         | |     |   | 4     
         | |     |   Object{value:4}
         | 3     false       
         Object{value:3}     

  [number] b.value
  => 4
  [number] a.value
  => 3

      + expected - actual

      -false
      +true

      at decoratedAssert (node_modules/empower/lib/decorate.js:42:30)
      at powerAssert (node_modules/empower/index.js:58:32)
      at Context.<anonymous> (test/test.js:8:9)

That's what your readme files say is supposed to happen.

$ npm run test-broken

> [email protected] test-broken .../power-assert-test
> ./node_modules/mocha/bin/mocha --compilers js:espower-babel/guess __tests__



  assert
    1) should not give the same output as a regular assertion


  0 passing (15ms)
  1 failing

  1) assert should not give the same output as a regular assertion:

      AssertionError: false == true
      + expected - actual

      -false
      +true

      at decoratedAssert (node_modules/empower/lib/decorate.js:44:25)
      at powerAssert (node_modules/empower/index.js:58:32)
      at Context.<anonymous> (__tests__/test.js:8:9)

This isn't as advertised. I don't see why it wouldn't give the same output as the other test configuration.

Flaise avatar Oct 04 '15 18:10 Flaise

Hi @Flaise , thank you for reporting.

test-broken run does not produce power-assert output because __tests__ dir is not recognized as test dir by default. To configure test dir, please see If your tests are not in test dir section of README.

twada avatar Oct 05 '15 01:10 twada