Skip to content

Inconsistent test results between prb test and pub run test on Chrome #1724

@cedx

Description

@cedx
  • Dart SDK Version: 2.0.0 (Fri Aug 3 10:53:23 2018 +0200) on "windows_x64"
  • build_runner: 0.10.0, build_test: 0.10.3, build_web_compilers: 0.4.1, test: 1.3.0
  • OS: Windows 10 (64-bit)
  • Test browser: Chrome
  • Any other packages or constraints: json_annotation: 1.0.0, json_serializable: 1.0.1.

I don't know if it's the right repo to post this issue, but it's when using build_test that the issue raises.
The problem appeared when testing the lcov package (version 4.3.0, see https://github.com/cedx/lcov.dart).

If I build the package manually using pub run build_runner build, and then launch the tests using pub run test, everything is OK:

$ pub run build_runner build # OK
$ pub run test --platform=vm # All tests passed!
$ pub run test --platform=chrome # All tests passed!

If I use pub run build_runner test for testing, the issue raises:

$ pub build_runner test -- --platform=vm # All tests passed!
$ pub build_runner test -- --platform=chrome # Error!!!

With the following error:

Running tests...

00:03 +8 -1: test\function_test.dart: FunctionCoverage .toString() should return a format like "FNF:<found>\n,FNH:<hit>" [E]
  Expected: 'FN:127,main\n'
              'FNDA:3,main\n'
              'FNF:3\n'
              'FNH:19'
    Actual: 'FNDA:3,main\n'
              'FNDA:3,main\n'
              'FNF:3\n'
              'FNH:19'
     Which: is different.
            Expected: FN:127,main\ ...
              Actual: FNDA:3,main\ ...
                        ^
             Differ at offset 2

  package:test             expect
  function_test.dart 53:9  test$.test.dart.fn

The FunctionCoverage#toString() method calls the FunctionData#toString({bool asDefinition = false}) method two times : the first time with asDefinition = true, the second time with asDefinition = false.
Cf. https://github.com/cedx/lcov.dart/blob/master/lib/src/function.dart#L36

It seems that when the project is compiled by build_test/build_web_comilers, the optional named parameter asDefinition is ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions