teambit / envs

Component development environments for the Bit community
https://bit.dev/bit/envs
Other
64 stars 9 forks source link

Tests are not running when building TypeScript component #23

Closed JoshK2 closed 4 years ago

JoshK2 commented 4 years ago

I test the TypeScript compiler on jotils, the build is working well, but when I test a component I get an error that tests files are not exist after building.

STR:

  1. clone jotils project https://github.com/JoshK2/jotils.
  2. run bit import.
  3. import version 3.1.0 bit import bit.envs/compilers/typescript@3.1.0 -c.
  4. run bit test letter-count.

This is the error I get: image

Compiler: bit.envs/compilers/typescript@3.1.0 Tester: bit.envs/testers/mocha@5.0.2

GiladShoham commented 4 years ago

related to https://github.com/teambit/envs/issues/10 (full technical details are there)

GiladShoham commented 4 years ago

@qballer If you want to see if bit's get the correct result props from the compiler, here is the exact point for this: https://github.com/teambit/bit/blob/master/src/consumer/component/consumer-component.ts#L679

qballer commented 4 years ago

The new typescript compiler and react typescript should support this partially now - jotils should work. I've hacked my way to cover most use cases. If I am to make this work for all I think I'm going to need the mapping from the source file in the workspace to the capsule. Otherwise I have no sure way to know which are dist test files. The reason is that when bit creates the vinyl files he does so relative to the workspace root directory as cwd. According to bit add structure they can change location in the capsule.

These are edge cases to say the least. But we will need to support that eventually.

@GiladShoham the problem is in getting the file paths. They are widely different.

qballer commented 4 years ago

fixed in 3.1.3