Giter VIP home page Giter VIP logo

autofix's Introduction

ScalaTest

Build Status

ScalaTest is a free, open-source testing toolkit for Scala and Java programmers.

Official Website: http://www.scalatest.org/

Using ScalaTest

Setup

Please visit Download and Setup for download and setup instructions.

Quick Start

Please visit Quick Start for steps to get started quickly.

Building ScalaTest

Pre-Requisites

The followings are needed for building ScalaTest:

use the following SBT options instead:

SBT_OPTS="-Xms512M -Xmx3000M -Xss1M -XX:NewRatio=8"

Building and Running Tests

This command will build and run the regular tests:

$ sbt test

To include flicker tests, you'll need to set environment variable SCALATEST_RUN_FLICKER_TESTS=true:

> export SCALATEST_RUN_FLICKER_TESTS=true
> sbt test

To run generated all tests, you'll need to increase maximum heap size to at least -Xmx5000M, and use this command instead:

$ rm -rf gentests
$ sbt gentests/test

You can also run different groups generated tests separately:

$ rm -rf gentests
$ sbt genMustMatchersTests1/test
$ sbt genMustMatchersTests2/test
$ sbt genMustMatchersTests3/test
$ sbt genMustMatchersTests4/test
$ sbt genGenTests/test
$ sbt genTablesTests/test
$ sbt genInspectorsTests/test
$ sbt genInspectorsShorthandsTests1/test
$ sbt genInspectorsShorthandsTests2/test
$ sbt genTheyTests/test
$ sbt genContainTests1/test
$ sbt genContainTests2/test
$ sbt genSortedTests/test
$ sbt genLoneElementTests/test
$ sbt genEmptyTests/test

What it does is simply switch to gentests project and run test.

To run scala-js tests:

$ sbt scalatestAppJS/clean
$ sbt scalacticTestJS/test:compile
$ sbt scalacticTestJS/test
$ sbt scalatestTestJS/test:compile
$ sbt scalatestTestJS/test

To run scala-native tests:

$ sbt -Dscalatest.skip.jdk.check=true ++2.11.12 scalatestAppNative/clean
$ sbt -Dscalatest.skip.jdk.check=true ++2.11.12 scalacticTestNative/test:compile
$ sbt -Dscalatest.skip.jdk.check=true ++2.11.12 scalacticTestNative/test
$ sbt -Dscalatest.skip.jdk.check=true ++2.11.12 scalatestTestNative/test:compile
$ sbt -Dscalatest.skip.jdk.check=true ++2.11.12 scalatestTestNative/test

Building Examples

You can build examples project using this command:

$ sbt examples/compile

Packaging

You can package the ScalaTest JAR file using this command:

$ sbt package

The resulting JAR file will be produced in target/scala-2.11/.

You can also publish it to your local Ivy repository using this command:

$ sbt publishLocal

Or publish it to local maven repository using this command:

$ sbt publishM2

Publishing

To publish to Sonatype, you first need to make sure you have the following:

  • A GPG client is installed on your command line path. For more information, please refer to GNU Privacy Guard Website.
  • You have created your GPG keys and distributed your public key to hkp://pool.sks-keyservers.net/. For more information, please refer to How To Generate PGP Signatures With Maven.
  • You have been granted the right to publish using org.scalatest and org.scalactic domain.

By default, ScalaTest build will read your Sonatype credentials from ~/.ivy2/.credentials, which is a properties file that looks like this:

realm=Sonatype Nexus Repository Manager
host=oss.sonatype.org
user=xxxxxxxx
password=xxxxxxxx

You can use SCALATEST_NEXUS_LOGIN and SCALATEST_NEXUS_PASSWORD environment variables to override Sonatype credentials.

For signing, ScalaTest build will use ~/.gnupg/secring.gpg by default and prompt for GPG passphase if required. Alternatively you can use SCALATEST_GPG_FILE to use a different GPG file, and use SCALATEST_GPG_PASSPHASE to provide GPG passphase to avoid input prompt.

If you would like to export a particular private key into a separate GPG file, you can use the following command:

$ gpg --export-secret-keys [email protected] > example-secret-key.gpg

With Sonatype credentials and GPG file in place, you can now publish to Sonatype.

Before publishing any patch release, binary compatibility with previous version should be checked:

$ sbt ++2.11.12 scalactic/package scalactic/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestCore/package scalatestCore/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFeatureSpec/package scalatestFeatureSpec/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFlatSpec/package scalatestFlatSpec/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFreeSpec/package scalatestFreeSpec/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFunSuite/package scalatestFunSuite/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFunSpec/package scalatestFunSpec/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestPropSpec/package scalatestPropSpec/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestRefSpec/package scalatestRefSpec/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestWordSpec/package scalatestWordSpec/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestDiagrams/package scalatestDiagrams/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestMatchersCore/package scalatestMatchersCore/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestShouldMatchers/package scalatestShouldMatchers/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestMustMatchers/package scalatestMustMatchers/mimaReportBinaryIssues
$ sbt ++2.11.12 scalacticJS/package scalacticJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestCoreJS/package scalatestCoreJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFeatureSpecJS/package scalatestFeatureSpecJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFlatSpecJS/package scalatestFlatSpecJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFreeSpecJS/package scalatestFreeSpecJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFunSuiteJS/package scalatestFunSuiteJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestFunSpecJS/package scalatestFunSpecJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestPropSpecJS/package scalatestPropSpecJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestWordSpecJS/package scalatestWordSpecJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestDiagramsJS/package scalatestDiagramsJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestMatchersCoreJS/package scalatestMatchersCoreJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestShouldMatchersJS/package scalatestShouldMatchersJS/mimaReportBinaryIssues
$ sbt ++2.11.12 scalatestMustMatchersJS/package scalatestMustMatchersJS/mimaReportBinaryIssues

$ sbt ++2.12.17 scalactic/package scalactic/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestCore/package scalatestCore/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFeatureSpec/package scalatestFeatureSpec/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFlatSpec/package scalatestFlatSpec/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFreeSpec/package scalatestFreeSpec/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFunSuite/package scalatestFunSuite/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFunSpec/package scalatestFunSpec/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestPropSpec/package scalatestPropSpec/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestRefSpec/package scalatestRefSpec/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestWordSpec/package scalatestWordSpec/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestDiagrams/package scalatestDiagrams/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestMatchersCore/package scalatestMatchersCore/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestShouldMatchers/package scalatestShouldMatchers/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestMustMatchers/package scalatestMustMatchers/mimaReportBinaryIssues
$ sbt ++2.12.17 scalacticJS/package scalacticJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestCoreJS/package scalatestCoreJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFeatureSpecJS/package scalatestFeatureSpecJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFlatSpecJS/package scalatestFlatSpecJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFreeSpecJS/package scalatestFreeSpecJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFunSuiteJS/package scalatestFunSuiteJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestFunSpecJS/package scalatestFunSpecJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestPropSpecJS/package scalatestPropSpecJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestWordSpecJS/package scalatestWordSpecJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestDiagramsJS/package scalatestDiagramsJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestMatchersCoreJS/package scalatestMatchersCoreJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestShouldMatchersJS/package scalatestShouldMatchersJS/mimaReportBinaryIssues
$ sbt ++2.12.17 scalatestMustMatchersJS/package scalatestMustMatchersJS/mimaReportBinaryIssues

$ sbt ++2.13.12 scalactic/package scalactic/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestCore/package scalatestCore/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFeatureSpec/package scalatestFeatureSpec/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFlatSpec/package scalatestFlatSpec/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFreeSpec/package scalatestFreeSpec/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFunSuite/package scalatestFunSuite/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFunSpec/package scalatestFunSpec/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestPropSpec/package scalatestPropSpec/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestRefSpec/package scalatestRefSpec/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestWordSpec/package scalatestWordSpec/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestDiagrams/package scalatestDiagrams/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestMatchersCore/package scalatestMatchersCore/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestShouldMatchers/package scalatestShouldMatchers/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestMustMatchers/package scalatestMustMatchers/mimaReportBinaryIssues
$ sbt ++2.13.12 scalacticJS/package scalacticJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestCoreJS/package scalatestCoreJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFeatureSpecJS/package scalatestFeatureSpecJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFlatSpecJS/package scalatestFlatSpecJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFreeSpecJS/package scalatestFreeSpecJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFunSuiteJS/package scalatestFunSuiteJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestFunSpecJS/package scalatestFunSpecJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestPropSpecJS/package scalatestPropSpecJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestWordSpecJS/package scalatestWordSpecJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestDiagramsJS/package scalatestDiagramsJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestMatchersCoreJS/package scalatestMatchersCoreJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestShouldMatchersJS/package scalatestShouldMatchersJS/mimaReportBinaryIssues
$ sbt ++2.13.12 scalatestMustMatchersJS/package scalatestMustMatchersJS/mimaReportBinaryIssues

To publish scalatest modules for jvm, js, native and dotty, use the following commands:

$ ./publish.sh

autofix's People

Contributors

bvenners avatar cheeseng avatar fchaillou avatar github-brice-jaglin avatar yasami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

autofix's Issues

“error: repeated argument not allowed here” when varargs are present in the codebase

I'm using varargs like below in my code base.

     def acceptVarargs[S](s: S*): Unit = {}
     def toVarArgs[T](s: Seq[T]) = acceptVarargs(s: _*)

I'm using autofix plugin in my sbt project.

I'm following the steps here to run the scalafix command.

When I run the command sbt> scalafixAll dependency:[email protected]:autofix:3.0.8-1 I get below Error.

[error] /Users/rajkumar.natarajan/Documents/Coding/misc/varargs-scalafix-error/src/main/scala/Utils.scala:3: error: repeated argument not allowed here
[error] def toVarArgs[T](s: Seq[T]) = acceptVarargs(s: _*)
[error] ^
[error] at scala.meta.internal.parsers.Reporter.syntaxError(Reporter.scala:16)
[error] at scala.meta.internal.parsers.Reporter.syntaxError$(Reporter.scala:16)
[error] at scala.meta.internal.parsers.Reporter$$anon$1.syntaxError(Reporter.scala:22)
[error] at scala.meta.internal.parsers.Reporter.syntaxError(Reporter.scala:17)
[error] at scala.meta.internal.parsers.Reporter.syntaxError$(Reporter.scala:17)

The complete error stack trace is here

The project in github here

Other details -

sbt version - 1.5.2
scala version - 2.12.10
java version - 11.0.10-zulu

What is wrong in my codebase with varargs? How can I fix this error?

Related SO question as well.

Missing migration for org.scalatest.concurrent.Timeouts

First of all, thank you for providing this migration rewrite! I have already upgraded several projects to 3.1.0 and it's been mostly a seamless experience so far thanks to the rewrite and automatic Scala Steward PRs.

When upgrading the Scalafmt repo we hit on the following compile error after applying the rewrite scalameta/scalafmt#1582

[error] /home/travis/build/scalameta/scalafmt/scalafmt-tests/src/test/scala/org/scalafmt/FormatTests.scala:24:8: object Timeouts is not a member of package org.scalatest.concurrent

[error] import org.scalatest.concurrent.Timeouts

[error]        ^

[error] /home/travis/build/scalameta/scalafmt/scalafmt-tests/src/test/scala/org/scalafmt/FormatTests.scala:32:10: not found: type Timeouts

[error]     with Timeouts

[error]          ^

From the release notes

Removed the deprecated org.scalatest.concurrent.Timeouts trait. Please use org.scalatest.concurrent.TimeLimits instead.

http://www.scalatest.org/release_notes/3.1.0

Scala Version Confusion

Hi,

I used autofix to fix some of the scalatest code, but had a hard time with the semantic db portion.

I commented out the addCompilerPlugin(scalafixSemanticdb) , started up sbt , and ran scalafixEnable from the prompt.

I was using scala version 2.12.11, but it's looking for versions build with 2.12.8

Just wanted to pass this along just in case it comes up in conversation :)


Resolving after scalafixEnable

Resolving jline#jline;2.14.6 ...
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.8/scala-library-2.12.8.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-library;2.12.8!scala-library.jar (277ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.12.8/scala-reflect-2.12.8.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-reflect;2.12.8!scala-reflect.jar (172ms)
[info] downloading https://repo1.maven.org/maven2/org/scalameta/semanticdb-scalac_2.12.8/4.1.4/semanticdb-scalac_2.12.8-4.1.4.jar ...
[info] [SUCCESSFUL ] org.scalameta#semanticdb-scalac_2.12.8;4.1.4!semanticdb-scalac_2.12.8.jar (535ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.8/scala-compiler-2.12.8.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-compiler;2.12.8!scala-compiler.jar (445ms)
[info] Done updating.
[info] Compiling 32 Scala sources to /Users/fons/Repo/git.hub/MatrixMeta/target/scala-2.12/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.12.8. Compiling...
[info] Compilation completed in 8.55 s


Not resolving

info] Resolving org.fusesource.jansi#jansi;1.12 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scalameta#semanticdb-scalac_2.12.11;4.1.4: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.scalameta:semanticdb-scalac_2.12.11:4.1.4 (/Users/fons/Repo/git.hub/MatrixMeta/build.sbt#L63-64)
[warn] +- com.kabouterlabs:matrixmeta_2.12:0.1.0-SNAPSHOT
[trace] Stack trace suppressed: run last *:update for the full output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.