Skip to content

WASM minification breaks mockito named argument matchers #171702

@stuartmorgan-g

Description

@stuartmorgan-g

The flutter/flutter -> flutter/packages roller is currently blocked, on the following failure in wasm tests (the non-wasm versions work fine).

══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following minified:Class197 was thrown running a test:
Invalid argument(s): An ArgumentMatcher was declared as named
promptIfUnauthorized, but was not passed as an argument named
promptIfUnauthorized.

BAD:  when(obj.fn(anyNamed: "a")))
GOOD: when(obj.fn(a: anyNamed: "a")))

When the exception was thrown, this was the stack:
at module0.Error._throwWithCurrentStackTrace (http://localhost:7357/main.dart.wasm:wasm-function[704]:0x111584)
    at module0._InvocationForMatchedArguments._reconstituteNamedArgs closure at file:///Users/stuartmorgan/.pub-cache/hosted/pub.dev/mockito-5.4.6/lib/src/mock.dart:441:30 (http://localhost:7357/main.dart.wasm:wasm-function[19628]:0x25e247)
    at module0.closure wrapper at file:///Users/stuartmorgan/.pub-cache/hosted/pub.dev/mockito-5.4.6/lib/src/mock.dart:441:30 trampoline (http://localhost:7357/main.dart.wasm:wasm-function[19635]:0x25e39b)
    at module0._DefaultMap&_HashFieldBase&MapMixin&_HashBase&_OperatorEqualsAndHashCode&_LinkedHashMapMixin.forEach (http://localhost:7357/main.dart.wasm:wasm-function[1314]:0x11c1ec)
    at module0._InvocationForMatchedArguments._reconstituteNamedArgs (http://localhost:7357/main.dart.wasm:wasm-function[19609]:0x25de37)
    at module0.new _InvocationForMatchedArguments (http://localhost:7357/main.dart.wasm:wasm-function[19608]:0x25dd1d)
    at module0._useMatchedInvocationIfSet (http://localhost:7357/main.dart.wasm:wasm-function[19563]:0x25d0a2)
    at module0.Mock.noSuchMethod (http://localhost:7357/main.dart.wasm:wasm-function[19558]:0x25ce28)

The test description was:
  calls requestScopes on GIS client
═════════════════════════════════════════════════════════════════

end of failure 1


Failure in method: passes expected values to requestScopes
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following minified:Class197 was thrown running a test:
Invalid argument(s): An ArgumentMatcher was declared as named
promptIfUnauthorized, but was not passed as an argument named
promptIfUnauthorized.

BAD:  when(obj.fn(anyNamed: "a")))
GOOD: when(obj.fn(a: anyNamed: "a")))

When the exception was thrown, this was the stack:
at module0.Error._throwWithCurrentStackTrace (http://localhost:7357/main.dart.wasm:wasm-function[704]:0x111584)
    at module0._InvocationForMatchedArguments._reconstituteNamedArgs closure at file:///Users/stuartmorgan/.pub-cache/hosted/pub.dev/mockito-5.4.6/lib/src/mock.dart:441:30 (http://localhost:7357/main.dart.wasm:wasm-function[19628]:0x25e247)
    at module0.closure wrapper at file:///Users/stuartmorgan/.pub-cache/hosted/pub.dev/mockito-5.4.6/lib/src/mock.dart:441:30 trampoline (http://localhost:7357/main.dart.wasm:wasm-function[19635]:0x25e39b)
    at module0._DefaultMap&_HashFieldBase&MapMixin&_HashBase&_OperatorEqualsAndHashCode&_LinkedHashMapMixin.forEach (http://localhost:7357/main.dart.wasm:wasm-function[1314]:0x11c1ec)
    at module0._InvocationForMatchedArguments._reconstituteNamedArgs (http://localhost:7357/main.dart.wasm:wasm-function[19609]:0x25de37)
    at module0.new _InvocationForMatchedArguments (http://localhost:7357/main.dart.wasm:wasm-function[19608]:0x25dd1d)
    at module0._useMatchedInvocationIfSet (http://localhost:7357/main.dart.wasm:wasm-function[19563]:0x25d0a2)
    at module0.Mock.noSuchMethod (http://localhost:7357/main.dart.wasm:wasm-function[19558]:0x25ce28)

The test description was:
  passes expected values to requestScopes
═════════════════════════════════════════════════════════════════

I can reproduce locally, and verified that it starts with #171211

I tried adding --no-minify-wasm, but that gives me:

Could not find an option named "--no-minify".

and immediately fails, so it looks like flutter drive doesn't have that wired up.

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressione: wasmIssues related to the wasm build of Flutter Web.packageflutter/packages repository. See also p: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions