mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Add projectWithElmCore and add elm/core by default to test projects
This commit is contained in:
parent
0c838d3ba0
commit
0c67c88eed
@ -115,6 +115,7 @@ import Review.Error as Error
|
||||
import Review.Fix as Fix
|
||||
import Review.Project as Project exposing (Project, ProjectModule)
|
||||
import Review.Rule as Rule exposing (ReviewError, Rule)
|
||||
import Review.Test.Dependencies exposing (projectWithElmCore)
|
||||
import Review.Test.FailureMessage as FailureMessage
|
||||
import Set exposing (Set)
|
||||
import Vendor.ListExtra as ListExtra
|
||||
@ -208,7 +209,7 @@ If your rule is interested in project related details, then you should use
|
||||
-}
|
||||
run : Rule -> String -> ReviewResult
|
||||
run rule source =
|
||||
runWithProjectData Project.new rule source
|
||||
runWithProjectData projectWithElmCore rule source
|
||||
|
||||
|
||||
{-| Run a `Rule` on a `String` containing source code, with data about the
|
||||
@ -289,7 +290,7 @@ If your rule is interested in project related details, then you should use
|
||||
-}
|
||||
runOnModules : Rule -> List String -> ReviewResult
|
||||
runOnModules rule sources =
|
||||
runOnModulesWithProjectData Project.new rule sources
|
||||
runOnModulesWithProjectData projectWithElmCore rule sources
|
||||
|
||||
|
||||
{-| Run a `Rule` on several modules. You can then use
|
||||
|
@ -1,4 +1,7 @@
|
||||
module Review.Test.Dependencies exposing (elmCore, elmHtml, elmParser, elmUrl)
|
||||
module Review.Test.Dependencies exposing
|
||||
( elmCore, elmHtml, elmParser, elmUrl
|
||||
, projectWithElmCore
|
||||
)
|
||||
|
||||
{-| Pre-built dependencies that you can use for your tests.
|
||||
|
||||
@ -13,8 +16,11 @@ script to generate dependencies](TODO LINK).
|
||||
|
||||
@docs elmCore, elmHtml, elmParser, elmUrl
|
||||
|
||||
@docs projectWithElmCore
|
||||
|
||||
-}
|
||||
|
||||
import Review.Project as Project exposing (Project)
|
||||
import Review.Project.Dependency exposing (Dependency)
|
||||
import Review.Test.Dependencies.ElmCore
|
||||
import Review.Test.Dependencies.ElmHtml
|
||||
@ -23,12 +29,27 @@ import Review.Test.Dependencies.ElmUrl
|
||||
|
||||
|
||||
{-| Dependency for `elm/core`. It contains operators.
|
||||
|
||||
It is present by default in `elm-review` tests when you use [`Review.Test.run`](./Review-Test#run) or
|
||||
[`Review.Test.runOnModules`](./Review-Test#runOnModules).
|
||||
|
||||
Note that if you create a new project using [`Review.Project.new`](/Review-Project#new), you'll have to manually add it
|
||||
again with [`Review.Project.addDependency`](./Review-Project#addDependency) if you so wish to. You can also use
|
||||
[`projectWithElmCore`](#projectWithElmCore) as a starting block instead of `Review.Project.new`.
|
||||
|
||||
-}
|
||||
elmCore : Dependency
|
||||
elmCore =
|
||||
Review.Test.Dependencies.ElmCore.dependency
|
||||
|
||||
|
||||
{-| A project that only contains the `elm/core` dependency.
|
||||
-}
|
||||
projectWithElmCore : Project
|
||||
projectWithElmCore =
|
||||
Project.addDependency elmCore Project.new
|
||||
|
||||
|
||||
{-| Dependency for `elm/html`.
|
||||
-}
|
||||
elmHtml : Dependency
|
||||
|
Loading…
Reference in New Issue
Block a user