k-paxian / dart-package-publisher

Action to Publish Dart / Flutter Package To https://pub.dev When you need to publish a package, just bump the version in pubspec.yaml
MIT License
66 stars 10 forks source link

Add config to skip build_runner tests #1

Closed pavanpodila closed 4 years ago

pavanpodila commented 4 years ago

Thanks for this package! It is going to save lot of time for me 👍. I have a request to add a config variable to skip the build_runner tests and instead only do pub run test. The specific piece of code that needs change is below:

run_unit_tests() {
    if [ "$INPUT_SKIPTESTS" = "true" ]; then
      echo "Skip unit tests set to true, skip unit testing."
    else
      if [ "$HAS_BUILD_RUNNER" != "" ] && [ "$HAS_BUILD_TEST" != "" ]; then
        echo "build_runner: $HAS_BUILD_RUNNER"
        echo "build_test: $HAS_BUILD_TEST"
        pub run build_runner test
      else
        if [ "$HAS_TEST" != "" ]; then
          pub run test
        else
          echo "No unit test related dependencies detected, skip unit testing."
        fi      
      fi      
    fi
}

...specifically if [ "$HAS_BUILD_RUNNER" != "" ] && [ "$HAS_BUILD_TEST" != "" ];. You are checking if the build_runner and build_test packages are present and deciding to run the pub run build_runner test.

Can we have an option where we only do build_runner test if explicitly specified. Say with a config input like checkBuildRunner ? Only if this input is set should you execute the build_runner test, else do the pub run test?

Let me know if this sounds reasonable.

k-paxian commented 4 years ago

It's done in master now. Added input suppressBuildRunner (Optional) Suppress using build_runner for unit tests run default: false because of the majority of packages those days are relying on code generation during the unit testing phase, But now you could suppress it 👍

pavanpodila commented 4 years ago

Awesome...already using it :-)