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

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

Closed
cedx opened this issue Aug 7, 2018 · 4 comments
Closed

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

cedx opened this issue Aug 7, 2018 · 4 comments

Comments

@cedx
Copy link
Contributor

cedx commented Aug 7, 2018

  • 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.

@jakemac53
Copy link
Contributor

jakemac53 commented Aug 7, 2018

One difference here is the dev compiler versus dart2js, can you try with

pub run build_runner test --release -- -p chrome

and see if that passes?

@cedx
Copy link
Contributor Author

cedx commented Aug 7, 2018

Well seen! Now, all tests are OK. Thanks @jakemac53.
I guess I should file an issue into the SDK repo...

@cedx cedx closed this as completed Aug 7, 2018
@jakemac53
Copy link
Contributor

Ya, I would file something on the sdk about the difference :)

@matanlurey
Copy link
Contributor

I believe this is/was a bug in DDC's toString(): dart-lang/sdk#33876

It might not have made it into 2.0, but I imagine it will be in a subsequent release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants