spec icon indicating copy to clipboard operation
spec copied to clipboard

[Question] Does this support passing individual test files/directories?

Open lyio opened this issue 2 years ago • 9 comments

I tried running my tests by simply calling spec in the root folder and it only picked up tests in a packages/test folder and ignored the ones in the main test folder.

When I pass individual test files as I would with flutter_test as in flutter test test/path/to_test.dart, Spec does not find the tests and runs nothing.

Is using melos in this case required or is there an option I have not yet found?

lyio avatar Jul 06 '22 13:07 lyio

Hello!

Could you better describe your folder architecture? I'm not sure I understand how your project looks like

rrousselGit avatar Jul 06 '22 13:07 rrousselGit

@rrousselGit we have a standard Flutter app folder layout.

- android/
- ios/
- lib/
- packages/
- test/
  - some_test.dart
  - folder1/
    - folder1_test.dart
  - folder2/
    - folder2_test.dart 
- pubspec.yaml

The packages folder

packages/
	- api_client/
	  - lib/
	  - test/
	    - first_test.dart
	    - second_test.dart
	  - pubspec.yaml 

The spec_cli only picks up the tests in the packages folder.

lyio avatar Jul 07 '22 07:07 lyio

I don't think melos supports both having a root pubspec and a packages folder simultaneously

But I'm sure it could be adapted to do so cc @Salakar

rrousselGit avatar Jul 07 '22 07:07 rrousselGit

We're not using melos, though.

lyio avatar Jul 07 '22 07:07 lyio

Spec does for you.

rrousselGit avatar Jul 07 '22 07:07 rrousselGit

Ah, ok

lyio avatar Jul 07 '22 07:07 lyio

I don't think melos supports both having a root pubspec and a packages folder simultaneously

But I'm sure it could be adapted to do so cc @Salakar

It does support this, even Melos repo itself is setup like this 🤔

Salakar avatar Jul 07 '22 11:07 Salakar

As the default format - aka without a melos.yaml?

rrousselGit avatar Jul 07 '22 11:07 rrousselGit

As the default format - aka without a melos.yaml?

Ah no it does not, easy change though by adding another glob here: https://github.com/invertase/melos/blob/main/packages/melos/lib/src/workspace_configs.dart#L516-L522

Salakar avatar Jul 07 '22 11:07 Salakar