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

Couldn't able to generate mocks for Main Router #786

Open
GayathriDeviSrinivasan opened this issue Dec 9, 2024 · 0 comments
Open

Couldn't able to generate mocks for Main Router #786

GayathriDeviSrinivasan opened this issue Dec 9, 2024 · 0 comments

Comments

@GayathriDeviSrinivasan
Copy link

@AutoRouterConfig(
  replaceInRouteName: 'Page,Route,Screen',
)


``````dart
class MainRouter extends RootStackRouter {

}

class TestRouter extends Mock implements MainRouter, RootStackRouter {}

MockSpec<TestRouter>(as: Symbol('MockTestRouter'), onMissingStub: OnMissingStub.returnDefault),

Error:

 [SEVERE] mockito:mockBuilder on test/test_utils/test_mocks.dart:

Bad state: No element
dart:core                                               List.first
package:source_gen/src/constants/revive.dart 104:21     reviveInstance
package:source_gen/src/constants/reader.dart 278:25     _DartObjectConstant.revive
package:mockito/src/builder.dart 407:34                 _TypeVisitor._addTypesFromConstant
package:mockito/src/builder.dart 303:7                  _TypeVisitor.visitParameterElement
package:analyzer/src/dart/element/element.dart 6109:15  ParameterElementImpl.accept
package:analyzer/src/dart/element/element.dart 2565:13  ElementImpl.visitChildren
package:analyzer/dart/element/visitor.dart 333:13       RecursiveElementVisitor.visitMethodElement
package:mockito/src/builder.dart 290:11                 _TypeVisitor.visitMethodElement
package:analyzer/src/dart/element/element.dart 5320:54  MethodElementImpl.accept
package:analyzer/src/dart/element/element.dart 2565:13  ElementImpl.visitChildren
package:analyzer/dart/element/visitor.dart 237:13       RecursiveElementVisitor.visitClassElement
package:mockito/src/builder.dart 272:11                 _TypeVisitor.visitClassElement
package:analyzer/src/dart/element/element.dart 515:20   ClassElementImpl.accept
package:mockito/src/builder.dart 179:20                 MockBuilder._resolveAssetUris.addTypesFrom
package:mockito/src/builder.dart 187:9                  MockBuilder._resolveAssetUris.addTypesFrom
package:mockito/src/builder.dart 187:9                  MockBuilder._resolveAssetUris.addTypesFrom
package:mockito/src/builder.dart 192:7                  MockBuilder._resolveAssetUris
package:mockito/src/builder.dart 91:29                  MockBuilder.build

[INFO] Build:Running build completed, took 14.9s

[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 299ms

[SEVERE] Build:
Failed after 15.3s

How to resolve, any workarounds for this?

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

1 participant