mockito icon indicating copy to clipboard operation
mockito copied to clipboard

I configured build.yaml as this repo, but it's not working as I expected

Open HeronKyaw opened this issue 2 years ago • 1 comments

I created a build.yaml as this but it's not creating a mock directory. I have tried many ways but none of them is working. is it because I need some configuration or plugins? Everything else is working fine. Here's my code:

targets:
  $default:
    builders:
      mockito|mockBuilder:
        generate_for:
          - test/**.dart
        options:
          build_extensions:
            '^test/{{}}.dart' : 'test/mocks/{{}}.mocks.dart'

builders:
  mockBuilder:
    import: "package:mockito/src/builder.dart"
    builder_factories: ["buildMocks"]
    build_extensions: {".dart": [".mocks.dart"]}
    build_to: source
    auto_apply: dependents
    defaults:
      generate_for: ['test/**']

here's my pubspec.yaml -

dev_dependencies:
    mockito: 5.4.2
    build_runner: ^2.4.6

Before generating -

└── test
    └── example_bloc_test.dart

After generating -

└── test
    ├── example_bloc_test.dart
    └── example_bloc_test.mocks.dart

What it is supposed to be -

└── test
    ├── example_bloc_test.dart
    └── mock
        └── example_bloc_test.mocks.dart

Thanks.

HeronKyaw avatar Sep 12 '23 10:09 HeronKyaw

Facing the same issue. Trying with the build.yaml provided in the docs.

And having the same folder and file structure as the example given by @HeronKyaw.

KevalPrajapati avatar Nov 08 '23 15:11 KevalPrajapati