Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the code lens to start the test also for the main function #2356

Closed
HerrNiklasRaab opened this issue Apr 15, 2020 · 1 comment · Fixed by #2359
Closed

Add the code lens to start the test also for the main function #2356

HerrNiklasRaab opened this issue Apr 15, 2020 · 1 comment · Fixed by #2359
Labels
in editor Relates to code editing or language features is enhancement
Milestone

Comments

@HerrNiklasRaab
Copy link

At the moment I see everywhere in our code, that in every file there is a dummy group, just to be able to run all test of that file through those code lenses who appear. Would be awesome if vs code would detect if there are tests inside the main, and if so, show also a code lens at the main method.

import 'package:fazua_domain/fazua_domain.dart';
import 'package:fazua_domain/src/entities/bike.dart';
import 'package:test/test.dart';

import '../test_serialization_util.dart';

// Here I should see "Run | Debug" code lens to start all test in the file.
void main() {
  setUp(() {});

  group('Bike', () {
    test('is bike serializable', () {
      isSerializable(BikeFactory().getBike(), (map) {
        return Bike.fromMap(map);
      });
    });
    test('if bikeName is not set, name should return mac adress', () {
      expect(Bike("mac").name, "mac");
    });

    test('if bikeName is set, name should return bikeName', () {
      expect(Bike("mac").copyWith(name: "Julian's Bike").name, "Julian's Bike");
    });
  });
}
@HerrNiklasRaab HerrNiklasRaab changed the title Add the code lens also for the main function Add the code lens to start the test also for the main function Apr 15, 2020
@DanTup DanTup added this to the v3.10.0 milestone Apr 15, 2020
@DanTup DanTup added in editor Relates to code editing or language features is enhancement labels Apr 15, 2020
DanTup added a commit that referenced this issue Apr 15, 2020
@DanTup
Copy link
Member

DanTup commented Apr 15, 2020

Great idea! I don't think this needs to be specific to tests, it could be handy for Flutter and Dart CLI apps too - especially with the same template support that tests have. This would allow you to quickly run different run configurations:

Screenshot 2020-04-15 at 16 12 38

Screenshot 2020-04-15 at 16 12 44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features is enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants