Closed JoshK2 closed 5 years ago
I believe this is the second confusion I see about this in the recent two weeks. We should update the help to clarify this.
The flags --test
, --exclude
do not support wildcards. They only support DSL ({PARENT}
and {FILE_NAME}
annotations).
Assuming you have the following file structure:
src/foo.js
src/bar.js
tests/foo.spec.js
tests/bar.spec.js
when you run bit add src -t tests/*
, the CLI parses the wildcard and passes the following to Bit:
bit add src tests/foo.spec.js -t tests/bar.spec.js
.
The is a limitation of the CLI. You can't pass multiple values for the argument AND multiple values to a flag (--test
in this case).
In this case, because the tests/*
is interpreted to multiple values: [ tests/foo.spec.js
, tests/bar.spec.js
], it uses only one value for the --test
flag, and the rest for the main argument of bit add
.
To pass multiple values to --test
, you have to add them inside a quote so then they'll be considered as one value, then, Bit knows to split them and add them.
@itaymendel , we need to think about how to reflect that in the help. the current help says
all flags support glob patterns and {PARENT} {FILE_NAME} annotations
which is incorrect. The flags don't support wildcards.
@davidfirst So they do support glob patterns / wildcards it just to be inside quotes. correct?
@GiladShoham , yes, that's is correct.
I didn't remember implementing it, but I checked the code and found out that we run glob
after resolving the DSL. That glob
call resolves the wildcard. So, adding it into quotes works.
It's important to add it to the help.
Add this to help done on https://github.com/teambit/bit/pull/1646, merged.
I want to run bit on this project https://github.com/petyosi/react-virtuoso and when I added the component with tests, the test files in .bitmap is not correct.
This is what I get:
Steps to Reproduce the Problem
Specifications