{"id":38963241,"url":"https://github.com/daniel-shuy/scripted-scalatest-sbt-plugin","last_synced_at":"2026-01-17T16:26:42.127Z","repository":{"id":19438149,"uuid":"85647754","full_name":"daniel-shuy/scripted-scalatest-sbt-plugin","owner":"daniel-shuy","description":"A SBT plugin to use ScalaTest with scripted-plugin to test your SBT plugins","archived":false,"fork":false,"pushed_at":"2025-12-23T20:42:23.000Z","size":110,"stargazers_count":13,"open_issues_count":4,"forks_count":5,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-12-25T10:49:38.640Z","etag":null,"topics":["sbt","sbt-plugin","sbt-test","scalatest","scripted","scripted-plugin"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daniel-shuy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-03-21T02:03:41.000Z","updated_at":"2025-04-02T18:52:38.000Z","dependencies_parsed_at":"2023-01-11T20:27:52.793Z","dependency_job_id":"1714a974-e3db-4a78-bbde-1d39e890170c","html_url":"https://github.com/daniel-shuy/scripted-scalatest-sbt-plugin","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/daniel-shuy/scripted-scalatest-sbt-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-shuy%2Fscripted-scalatest-sbt-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-shuy%2Fscripted-scalatest-sbt-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-shuy%2Fscripted-scalatest-sbt-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-shuy%2Fscripted-scalatest-sbt-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daniel-shuy","download_url":"https://codeload.github.com/daniel-shuy/scripted-scalatest-sbt-plugin/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-shuy%2Fscripted-scalatest-sbt-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sbt","sbt-plugin","sbt-test","scalatest","scripted","scripted-plugin"],"created_at":"2026-01-17T16:26:42.039Z","updated_at":"2026-01-17T16:26:42.113Z","avatar_url":"https://github.com/daniel-shuy.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scripted-scalatest-sbt-plugin\n\n[ ![Download](https://api.bintray.com/packages/daniel-shuy/sbt-plugins/sbt-scripted-scalatest/images/download.svg) ](https://bintray.com/daniel-shuy/sbt-plugins/sbt-scripted-scalatest/_latestVersion)\n\n| Branch  | Travis CI                                                                                                                                                              | CodeFactor                                                                                                                                                                                                                   | Codacy                                                                                                                                                                                                                                                                                                       | Better Code Hub                                                                                                                                |\n| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| Master  | [![Build Status](https://travis-ci.org/daniel-shuy/scripted-scalatest-sbt-plugin.svg?branch=master)](https://travis-ci.org/daniel-shuy/scripted-scalatest-sbt-plugin)  | [![CodeFactor](https://www.codefactor.io/repository/github/daniel-shuy/scripted-scalatest-sbt-plugin/badge/master)](https://www.codefactor.io/repository/github/daniel-shuy/scripted-scalatest-sbt-plugin/overview/master)   | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/244276b4573e4ae899443fa79c34822b?branch=master)](https://www.codacy.com/app/daniel-shuy/scripted-scalatest-sbt-plugin?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=daniel-shuy/scripted-scalatest-sbt-plugin\u0026utm_campaign=Badge_Grade)  | [![BCH compliance](https://bettercodehub.com/edge/badge/daniel-shuy/scripted-scalatest-sbt-plugin?branch=master)](https://bettercodehub.com/)  |\n| Develop | [![Build Status](https://travis-ci.org/daniel-shuy/scripted-scalatest-sbt-plugin.svg?branch=develop)](https://travis-ci.org/daniel-shuy/scripted-scalatest-sbt-plugin) | [![CodeFactor](https://www.codefactor.io/repository/github/daniel-shuy/scripted-scalatest-sbt-plugin/badge/develop)](https://www.codefactor.io/repository/github/daniel-shuy/scripted-scalatest-sbt-plugin/overview/develop) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/244276b4573e4ae899443fa79c34822b?branch=develop)](https://www.codacy.com/app/daniel-shuy/scripted-scalatest-sbt-plugin?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=daniel-shuy/scripted-scalatest-sbt-plugin\u0026utm_campaign=Badge_Grade) | [![BCH compliance](https://bettercodehub.com/edge/badge/daniel-shuy/scripted-scalatest-sbt-plugin?branch=develop)](https://bettercodehub.com/) |\n\n| Plugin Version | SBT Version   | ScalaTest Version |\n| -------------- | ------------- | ----------------- |\n| 1.x.x          | 0.13.x, 1.x.x | 3.0.x             |\n| 2.x.x          | 0.13.x, 1.x.x | 3.1.x+            |\n\nA SBT plugin to use [ScalaTest](http://www.scalatest.org/) with scripted-plugin to test your SBT plugins\n\nTraditionally, to test a SBT plugin, you had to create subprojects in `/sbt-test`, then in the subprojects, create SBT tasks to perform the testing, then specify the tasks to execute in a `test` file (see \u003chttp://www.scala-sbt.org/0.13/docs/Testing-sbt-plugins.html\u003e).\n\nThis is fine when performing simple tests, but for complicated tests (see \u003chttp://www.scala-sbt.org/0.13/docs/Testing-sbt-plugins.html#step+6%3A+custom+assertion\u003e), this can get messy really quickly:\n\n-   It sucks to not be able to write tests in a BDD style (except by using comments, which feels clunky).\n-   Manually writing code to print the test results to the console for each subproject is a pain.\n\nThis plugin leverages ScalaTest's powerful assertion system (to automatically print useful messages on assertion failure) and its expressive DSLs.\n\nThis plugin allows you to use any of ScalaTest's test [Suites](http://www.scalatest.org/user_guide/selecting_a_style), including [AsyncTestSuites](http://www.scalatest.org/user_guide/async_testing).\n\n## Notes\n\n-   Do not use ScalaTest's [ParallelTestExecution](http://doc.scalatest.org/3.0.0/index.html#org.scalatest.ParallelTestExecution) mixin with this plugin. `ScriptedScalaTestSuiteMixin` runs `sbt clean` before each test, which may cause weird side effects when run in parallel.\n-   When executing SBT tasks in tests, use `Project.runTask(\u003ctask\u003e, state.value)` instead of `\u003ctask\u003e.value`. Calling `\u003ctask\u003e.value` declares it as a dependency, which executes before the tests, not when the line is called.\n-   When implementing [BeforeAndAfterEach](http://doc.scalatest.org/3.0.0/index.html#org.scalatest.BeforeAndAfterEach)'s `beforeEach`, make sure to invoke `super.beforeEach` afterwards:\n\n```scala\noverride protected def beforeEach(): Unit = {\n  // ...\n  super.beforeEach() // To be stackable, must call super.beforeEach\n}\n```\n\n-   This SBT plugin is now tested using itself!\n\n## Usage\n\n### Step 1: Include the scripted-plugin in your build\n\nAdd the following to your main project's `project/scripted.sbt` (create file it if doesn't exist):\n\n#### SBT 0.13 (\u003chttp://www.scala-sbt.org/0.13/docs/Testing-sbt-plugins.html#step+2%3A+scripted-plugin\u003e)\n\n```scala\nlibraryDependencies += { \"org.scala-sbt\" % \"scripted-plugin\" % sbtVersion.value }\n```\n\n#### SBT 1.0.x-1.1.x\n\n```scala\nlibraryDependencies += { \"org.scala-sbt\" %% \"scripted-plugin\" % sbtVersion.value }\n```\n\nNote the %% operator.\n\n#### SBT 1.2.x+\n\nNot Required\n\n### Step 2: Configure scripted-plugin\n\nRecommended settings by SBT:\n\n#### SBT 0.13 (\u003chttp://www.scala-sbt.org/0.13/docs/Testing-sbt-plugins.html#step+2%3A+scripted-plugin\u003e)\n\n```scala\n// build.sbt\nScriptedPlugin.scriptedSettings\nscriptedLaunchOpts := { scriptedLaunchOpts.value ++\n  Seq(\"-Xmx1024M\", \"-XX:MaxPermSize=256M\", \"-Dplugin.version=\" + version.value)\n}\nscriptedBufferLog := false\n```\n\nIf you are using [sbt-cross-building](https://github.com/jrudolph/sbt-cross-building) (SBT \u0026lt; 0.13.6), don't add scripted-plugin to `project/scripted.sbt`, and replace `ScriptedPlugin.scriptedSettings` in `build.sbt` with `CrossBuilding.scriptedSettings`.\n\n#### SBT 1.0.x-1.1.x\n\n```scala\n// build.sbt\nlazy val root = (project in file(\".\"))\n  .settings(\n    name := \"sbt-something\",\n    scriptedLaunchOpts := { scriptedLaunchOpts.value ++\n      Seq(\"-Xmx1024M\", \"-Dplugin.version=\" + version.value)\n    },\n    scriptedBufferLog := false\n  )\n```\n\n#### SBT 1.2.x+ (\u003chttp://www.scala-sbt.org/1.x/docs/Testing-sbt-plugins.html#step+2%3A+scripted-plugin\u003e)\n\n```scala\n// build.sbt\nlazy val root = (project in file(\".\"))\n  .enablePlugins(SbtPlugin)\n  .settings(\n    name := \"sbt-something\",\n    scriptedLaunchOpts := { scriptedLaunchOpts.value ++\n      Seq(\"-Xmx1024M\", \"-Dplugin.version=\" + version.value)\n    },\n    scriptedBufferLog := false\n  )\n```\n\n### Step 3: Create the test subproject\n\nCreate the test subproject in `sbt-test/\u003ctest-group\u003e/\u003ctest-name\u003e`.\n\nInclude your plugin in the build.\n\nSee \u003chttp://www.scala-sbt.org/0.13/docs/Testing-sbt-plugins.html#step+3%3A+src%2Fsbt-test\u003e for an example.\n\n### Step 4: Include sbt-scripted-scalatest in your build\n\nAdd the following to your `sbt-test/\u003ctest-group\u003e/\u003ctest-name\u003e/project/plugins.sbt`:\n\n```scala\naddSbtPlugin(\"com.github.daniel-shuy\" % \"sbt-scripted-scalatest\" % \"1.1.1\")\n```\n\nOverride the `scalatest` dependency version with the version of ScalaTest you wish to use:\n\n```scala\naddSbtPlugin(\"com.github.daniel-shuy\" % \"sbt-scripted-scalatest\" % \"1.1.1\")\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"3.0.5\"\n```\n\n### Step 5: Configure `test` script\n\nPut **only** the following in the `sbt-test/\u003ctest-group\u003e/\u003ctest-name\u003e/test` script file:\n\n`\u003e scriptedScalatest`\n\n### Step 6: Configure project settings for the plugin\n\nIn `sbt-test/\u003ctest-group\u003e/\u003ctest-name\u003e/build.sbt`, create a new ScalaTest Suite/Spec, mixin `ScriptedScalaTestSuiteMixin` and pass it into `scriptedScalaTestSpec`. When mixing in `ScriptedScalaTestSuiteMixin`, implement `sbtState` as `state.value`.\n\nUsing SBT's Example in \u003chttp://www.scala-sbt.org/0.13/docs/Testing-sbt-plugins.html#step+6%3A+custom+assertion\u003e:\n\n```scala\nimport com.github.daniel.shuy.sbt.scripted.scalatest.ScriptedScalaTestSuiteMixin\nimport org.scalatest.Assertions._\nimport org.scalatest.wordspec.AnyWordSpec\n\nlazy val root = (project in file(\".\"))\n  .settings(\n    version := \"0.1\",\n    scalaVersion := \"2.10.6\",\n    assemblyJarName in assembly := \"foo.jar\",\n\n    scriptedScalaTestSpec := Some(new AnyWordSpec with ScriptedScalaTestSuiteMixin {\n      override val sbtState: State = state.value\n\n      \"assembly\" should {\n        \"create a JAR that prints out 'hello'\" in {\n          Project.runTask(Keys.assembly, sbtState)\n          val process = sbt.Process(\"java\", Seq(\"-jar\", (crossTarget.value / \"foo.jar\").toString))\n          val out = (process!!)\n          assert(out.trim == \"bye\")\n        }\n      }\n    }\n  )\n```\n\nIt is possible move the ScalaTest Suite/Spec into a separate `.scala` file in the `project` folder, however that may cause issues when trying to access SBT `SettingKey`s or declaring custom `TaskKey`s, therefore is currently not recommended except for extremely simple tests. A better approach would be to move all configurations related to this plugin to a new `.sbt` file, eg. `test.sbt`.\n\nSee [Settings](#settings) for other configurable settings.\n\n### Step 7: Use the scripted-plugin as usual\n\nAppend `-SNAPSHOT` to the main project `version` before running `scripted-plugin`.\n\nEg. Run `sbt scripted` on the main project to execute all tests.\n\n## Settings\n\n| Setting                    | Type                                           | Description                                                                                                                                                                                                                     |\n| -------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| scriptedScalaTestSpec      | Option[Suite with ScriptedScalaTestSuiteMixin] | **Required**. The ScalaTest Suite/Spec. If not configured (defaults to `None`), no tests will be executed.                                                                                                                      |\n| scriptedScalaTestDurations | Boolean                                        | **Optional**. If `true`, displays durations of tests. Defaults to `true`.                                                                                                                                                       |\n| scriptedScalaTestStacks    | NoStacks / ShortStacks / FullStacks            | **Optional**. The length of stack traces to display for failed tests. `NoStacks` will not display any stack traces. `ShortStacks` displays short stack traces. `FullStacks` displays full stack traces. Defaults to `NoStacks`. |\n| scriptedScalaTestStats     | Boolean                                        | **Optional**. If `true`, displays various statistics of tests. Defaults to `true`.                                                                                                                                              |\n\n## Tasks\n\n| Task              | Description                                                                                                                                                                  |\n| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| scriptedScalatest | Executes all test configured in `scriptedScalaTestSpec`. This task must be [configured for scripted-plugin to run in the `test` script file](#step-5-configure-test-script). |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-shuy%2Fscripted-scalatest-sbt-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel-shuy%2Fscripted-scalatest-sbt-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-shuy%2Fscripted-scalatest-sbt-plugin/lists"}