Skip to content

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

@HerrNiklasRaab

Description

@HerrNiklasRaab

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");
    });
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions