-
Notifications
You must be signed in to change notification settings - Fork 82
Add elm-test init
#4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,19 @@ | ||
| # node-elm-test | ||
| Runs [elm-test](https://github.com/deadfoxygrandpa/Elm-Test) suites from Node.js | ||
|
|
||
| Install it with `npm install -g elm-test`, then try this after downloading this repository: | ||
| ## Installation | ||
|
|
||
| ```bash | ||
| cd examples | ||
| elm-package install --yes | ||
| elm-test Test.elm | ||
| npm install -g elm-test | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| elm-test init # Adds the Elm-Test dependency and creates TestRunner.elm and Tests.elm | ||
| elm-test TestRunner.elm # Runs the tests | ||
| ``` | ||
|
|
||
| Then add your tests to Tests.elm. | ||
|
|
||
| Also check out [`elm-check`](https://github.com/TheSeamau5/elm-check) for property-based testing via `elm-test`! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,8 @@ | |
| "version": "0.3.0", | ||
| "description": "Run elm-test suites.", | ||
| "main": "elm-test.js", | ||
| "engines" : { | ||
| "node" : ">=0.12.0" | ||
| "engines": { | ||
| "node": ">=0.12.0" | ||
| }, | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
|
|
@@ -28,6 +28,7 @@ | |
| }, | ||
| "homepage": "https://github.com/rtfeldman/node-elm-test#readme", | ||
| "dependencies": { | ||
| "fs-extra": "^0.23.1", | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any objection to pinning this to exactly
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The correct thing appears to be |
||
| "lodash": "3.9.3", | ||
| "node-elm-compiler": "0.4.0+elm-0.15.1", | ||
| "temp": "0.8.1" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| module Main where | ||
|
|
||
| import Basics exposing (..) | ||
| import Signal exposing (..) | ||
|
|
||
| import ElmTest.Assertion as A exposing (assertEqual, assert) | ||
| import ElmTest.Run as R | ||
| import ElmTest.Runner.Console exposing (runDisplay) | ||
| import ElmTest.Test exposing (..) | ||
| import IO.IO exposing (..) | ||
| import IO.Runner exposing (Request, Response) | ||
| import IO.Runner as Run | ||
|
|
||
| import String | ||
| import Tests | ||
|
|
||
| console : IO () | ||
| console = runDisplay Tests.all | ||
|
|
||
| port requests : Signal Request | ||
| port requests = Run.run responses console | ||
|
|
||
| port responses : Signal Response |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| module Tests where | ||
|
|
||
| import ElmTest.Assertion as A exposing (assertEqual, assert) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems reasonable to expose
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to remove |
||
| import ElmTest.Test exposing (..) | ||
|
|
||
| import String | ||
|
|
||
|
|
||
| all : Test | ||
| all = suite "A Test Suite" | ||
| [ test "Addition" (assertEqual (3 + 7) 10) | ||
| , test "String.left" (assertEqual "a" (String.left 1 "abcdefg")) | ||
| , test "This test should fail" (assert False) | ||
| ] | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd format this like so: all : Test
all =
suite "A Test Suite"
[
test "Addition" (assertEqual (3 + 7) 10),
test "String.left" (assertEqual "a" (String.left 1 "abcdefg")),
test "This test should fail" (assert False)
]
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay (I had just copied this code from the examples folder) |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want to include
--yeson these, yeah?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hesitant about that since people using
elm-testfor the first time might want to get the prompt for the new packages. But how about if we add a--yesoption toelm-test init?