alt icon indicating copy to clipboard operation
alt copied to clipboard

Support for x.test.x

Open bugeats opened this issue 7 years ago • 10 comments

I'm surprised to see that this doesn't work:

alt ./crypto-helpers.test.js

I would expect discovery of:

./crypto-helpers.js

... and vise-versa.

bugeats avatar May 30 '18 18:05 bugeats

This has been merged in and included in the v3.1.0 release in our Homebrew tap and on GitHub.

drewdeponte avatar Jan 27 '19 05:01 drewdeponte

Along a similar vein our in-house stlye is to have .unit.test.js (and .integration.test.js) too. I could add this one case, but it's probably a bit specific to our naming scheme only.

Should I open a PR to add support for \.(?:[^.]+\.)?.test.js?

ashb avatar Apr 12 '19 12:04 ashb

Yeah, I was thinking about adding .test.js as well.

drewdeponte avatar Apr 14 '19 03:04 drewdeponte

@bugeats @ashb I dug into the issues in more details. It is a side effect of the test classification regex not being correct and no fallback based on the scoring without test classification happening. So, I spun up a branch called add_fallback. It would be great if you could pull down the branch, build it and test it and let me know if this helps.

drewdeponte avatar Apr 15 '19 07:04 drewdeponte

From commit 771de9e

$ /Users/ash/code/tmp/alt/target/release/alt src/lib/directives/auth/index.unit.test.js; echo
src/lib/jwt/index.unit.test.js

So it now returns something rather than nothing, but not even close to the right value for me - it's picked a totally different directory.

src/lib/directives/auth/index.unit.test.js <-> src/lib/directives/auth/index.js is the pairing I would expect here.

ashb avatar Apr 15 '19 11:04 ashb

@ashb grab the latest add_fallback branch and try it agin. Should be commit 78a82b4 and let me know.

drewdeponte avatar Apr 15 '19 21:04 drewdeponte

@ashb did you ever verify this?

drewdeponte avatar Jan 11 '22 05:01 drewdeponte

@drewdeponte Sorry, no I somehow missed the notification.

Still no dice on commit 78a82b4, and the minimal repro of just those files doesn't exhibit this behaviour, so something else is about this (private, sorry can't share it) is causing the issue.

Non-repro:

$ mkdir -p src/lib/directives/auth/ src/lib/jwt/
$ touch {src/lib/jwt/,src/lib/directives/auth/}index{.unit.test,}.js

ashb avatar Jan 13 '22 14:01 ashb

Ah, add in ./src/lib/directives/index.js and it fails.

Repro steps @drewdeponte:

mkdir -p src/lib/directives/auth/ src/lib/jwt/
touch {src/lib/jwt/,src/lib/directives/auth/}index{.unit.test,}.js
touch ./src/lib/directives/index.js

Which then gives this behaviour:

$ ../target/release/alt src/lib/directives/auth/index.unit.test.js
src/lib/jwt/index.unit.test.js

ashb avatar Jan 13 '22 14:01 ashb

I just released a new major release of this, v4.0.0 which should resolve these issues I believe.

drewdeponte avatar May 08 '23 04:05 drewdeponte