bit.envs icon indicating copy to clipboard operation
bit.envs copied to clipboard

tagging and testing should fail, not hang, when tests are wrong

Open AlexJeffcott opened this issue 6 years ago • 3 comments

Expected Behavior

the component tagging fails / tests fail to run with an error

Actual Behavior

it hangs with no error

Steps to Reproduce the Problem

1 cd project_directory 2 bit init 3 bit login 4 mkdir src 5 touch try.js 6 in try.js export default (a, b)=>a+b 7 mkdir __tests__ 8 touch try.test.js 9 in try.test.js (the try function is not called in the expect method thus creating a test that doesn't work)

import try from "../try";
it('test try', () => expect((1, 2)).toEqual(3));

10 bit add src -t 'src/__tests__/*' 11 bit import bit.envs/compilers/babel -c 12 bit import bit.envs/testers/jest -t 13a bit tag --all 1.0.0 13b bit test

Specifications

  • Bit version: 14.1.1
  • Node version: 12.1.0
  • npm / yarn version: 6.9.0
  • Platform: Ubuntu Bionic Beaver
  • Bit compiler (include version): bit.envs/compilers/[email protected]
  • Bit tester (include version): bit.envs/testers/[email protected]

AlexJeffcott avatar May 30 '19 14:05 AlexJeffcott

I was able to reproduce the issue. Just a note, for some reason I got an error during the build, so in step # 9, remove the first line, you don't need it to reproduce the issue.

As far as I can see, this is an issue with the Jest tester. I started debugging it and it seems like it gets stuck here: return exec(cmd).then. It doesn't continue to the 'then', nor to the 'catch'.

The bug was originally posted in bit-bin, I transferred it to this repo so you guys hopefully can help.

davidfirst avatar May 31 '19 17:05 davidfirst

We should probably take a look on the compiler implementation and see if we have a hook to get an error or something and send it back to bit

GiladShoham avatar Jun 03 '19 12:06 GiladShoham

This issue seems to be related to the child-process-promise package this env is using. See this issue (wasn't fixed since 2016): https://github.com/patrick-steele-idem/child-process-promise/issues/26. It'd be best to switch to execa instead.

davidfirst avatar Oct 14 '19 17:10 davidfirst