-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow promoting selected suites based on filter
- Loading branch information
Showing
7 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import snapshot4s.BuildInfo.snapshot4sVersion | ||
|
||
lazy val root = (project in file(".")) | ||
.settings( | ||
scalaVersion := "3.3.1", | ||
scalacOptions += "-Xsource:3", | ||
crossScalaVersions := Seq("3.3.1", "2.12.20", "2.13.14"), | ||
libraryDependencies += "com.siriusxm" %% "snapshot4s-weaver" % snapshot4sVersion % Test | ||
) | ||
.enablePlugins(Snapshot4sPlugin) |
6 changes: 6 additions & 0 deletions
6
modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sys.props.get("plugin.version") match { | ||
case Some(x) => | ||
addSbtPlugin("com.siriusxm" % "sbt-snapshot4s" % x) | ||
case _ => sys.error("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
} |
1 change: 1 addition & 0 deletions
1
...ugin/src/sbt-test/sbt-snapshot4s/promote-filter/src/test/resources/snapshot/existing-file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
old-contents |
1 change: 1 addition & 0 deletions
1
...st/sbt-snapshot4s/promote-filter/src/test/resources/snapshot/nested-directory/nested-file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
old-contents |
29 changes: 29 additions & 0 deletions
29
modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/src/test/scala/FilterTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package simple | ||
|
||
import weaver.* | ||
import snapshot4s.weaver.SnapshotExpectations | ||
import snapshot4s.generated.snapshotConfig | ||
|
||
object FilterTest extends SimpleIOSuite with SnapshotExpectations { | ||
|
||
test("inline") { | ||
assertInlineSnapshot(1, 2) | ||
} | ||
|
||
test("new inline snapshot") { | ||
assertInlineSnapshot(1, ???) | ||
} | ||
|
||
test("file that doesn't exist") { | ||
assertFileSnapshot("contents", "nonexistent-file") | ||
} | ||
|
||
test("existing file") { | ||
assertFileSnapshot("contents", "existing-file") | ||
} | ||
|
||
test("file in nested directory") { | ||
assertFileSnapshot("contents", "nested-directory/nested-file") | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated code should compile | ||
> ++ 2.12 compile | ||
> ++ 2.13 compile | ||
> ++ 3 compile | ||
# # Tests should fail as snapshots are out of date | ||
-> ++ 2.12 test | ||
-> ++ 2.13 test | ||
-> ++ 3 test | ||
# Not update anything with invalid filter | ||
> snapshot4sPromote *IDontExist* | ||
# Tests should fail as snapshots are out of date | ||
-> ++ 2.12 test | ||
-> ++ 2.13 test | ||
-> ++ 3 test | ||
# # Update snapshots with correct filter | ||
> snapshot4sPromote *FilterTest* | ||
# # Tests should succeed with updated snapshots | ||
> ++ 2.12 test | ||
> ++ 2.13 test | ||
> ++ 3 test |