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

Upgrade elm-test & test suite #771

Merged
merged 14 commits into from Dec 3, 2016

Conversation

Projects
None yet
4 participants
@turboMaCk
Contributor

turboMaCk commented Dec 3, 2016

Why?

I think it's important to have working tests. Otherwise it's really hard to tell if any PR actually fixes problem and doesn't broke anything else.

How

I was trying to reproduce some issues with array and made repository with test. I think it make sense to give it back to community so we all can benefit from having working tests for core library

Choices Made

I'm using (local) npm installation of elm-test by @rtfeldman which is de facto community standard. I'm also using npm test script as alias to local installation. On the other hand I don't want to make any unnecessary change to current work flow. This is why main script for running tests is almost the same as before (and using npm test internally).

*This was changed after code review. We are using global elm-test install. See: https://github.com/elm-lang/core/pull/771#pullrequestreview-11285372

Elm-test version is updated. One other change is that I've moved tests/Test.elm => tests/Main.elm which is more standard way to do it.

Fixing Tests

There are some breaking changes in elm-test. This means tests (files in tests/Tests) should be updated one by one:

  • Array.tests
  • Basics.tests
  • Bitwise.tests
  • Char.tests
  • CodeGen.tests
  • Dict.tests
  • Equality.tests
  • Json.tests
  • List.tests
  • Result.tests
  • Set.tests
  • String.tests
  • Regex.tests

This PR do not and will not include any other changes beside what is necessary to make current tests work as they are.

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Dec 3, 2016

Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Dec 3, 2016

Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@turboMaCk turboMaCk changed the title from WIP: update elm-test & test suite to WIP: upgrade elm-test & test suite Dec 3, 2016

@turboMaCk turboMaCk changed the title from WIP: upgrade elm-test & test suite to Upgrade elm-test & test suite Dec 3, 2016

@turboMaCk

This is ready for review.

@@ -63,21 +63,21 @@ customTests =
"I want to see this message!"
myDecoder =
Json.customDecoder ("foo" := Json.string) (\_ -> Err customErrorMessage)
Json.field "foo" Json.string |> Json.andThen (\_ -> Json.fail customErrorMessage)

This comment has been minimized.

@turboMaCk

turboMaCk Dec 3, 2016

Contributor

testing andThen instead of legacy customDecoder.

@turboMaCk

turboMaCk Dec 3, 2016

Contributor

testing andThen instead of legacy customDecoder.

Show outdated Hide outdated tests/run-tests.sh
node test.js
elm-make --yes --output test.js Main.elm
npm test

This comment has been minimized.

@turboMaCk

turboMaCk Dec 3, 2016

Contributor

I think that this depend caching (elm-test does not overwrite & recompile anything but will try though). That doesn't feels right:-/ Please pay attention to this line & integration with elm-test

@turboMaCk

turboMaCk Dec 3, 2016

Contributor

I think that this depend caching (elm-test does not overwrite & recompile anything but will try though). That doesn't feels right:-/ Please pay attention to this line & integration with elm-test

, takingArraysApartTests
, mappingAndFoldingTests
, nativeTests
]

This comment has been minimized.

@turboMaCk

turboMaCk Dec 3, 2016

Contributor

This is the only file formatted by elm-format. Please let me know if you want to keep old formatting.

@turboMaCk

turboMaCk Dec 3, 2016

Contributor

This is the only file formatted by elm-format. Please let me know if you want to keep old formatting.

This comment has been minimized.

@rtfeldman

rtfeldman Dec 3, 2016

Member

Nope, looks great!

@rtfeldman

rtfeldman Dec 3, 2016

Member

Nope, looks great!

This comment has been minimized.

@turboMaCk

turboMaCk Dec 3, 2016

Contributor

I would like to format all tests then. I think it's good time to do so since tests ware broken anyway so there is really low possibility it will make conflicts with any opened PR. What do you think?

@turboMaCk

turboMaCk Dec 3, 2016

Contributor

I would like to format all tests then. I think it's good time to do so since tests ware broken anyway so there is really low possibility it will make conflicts with any opened PR. What do you think?

This comment has been minimized.

@turboMaCk

turboMaCk Dec 3, 2016

Contributor
  • I'm speaking only about tests. Doing same thing in src can cause nasty conflicts I don't want to be associated with :D
@turboMaCk

turboMaCk Dec 3, 2016

Contributor
  • I'm speaking only about tests. Doing same thing in src can cause nasty conflicts I don't want to be associated with :D

This comment has been minimized.

@rtfeldman

rtfeldman Dec 4, 2016

Member

@turboMaCk If you'd like to make a separate PR that runs elm-format on all tests, I'd be happy to accept it!

@rtfeldman

rtfeldman Dec 4, 2016

Member

@turboMaCk If you'd like to make a separate PR that runs elm-format on all tests, I'd be happy to accept it!

This comment has been minimized.

@turboMaCk

turboMaCk Dec 4, 2016

Contributor

@rtfeldman Not super important but here we go. https://github.com/elm-lang/core/pull/774.

@turboMaCk

turboMaCk Dec 4, 2016

Contributor

@rtfeldman Not super important but here we go. https://github.com/elm-lang/core/pull/774.

Show outdated Hide outdated .travis.yml
@@ -3,6 +3,7 @@ language: node_js
node_js:
- "4.3"
install:
- npm install -g elm@0.17
- npm install -g elm@0.18
- npm install

This comment has been minimized.

@rtfeldman

rtfeldman Dec 3, 2016

Member

🤔 what is the npm install part here doing?

@rtfeldman

rtfeldman Dec 3, 2016

Member

🤔 what is the npm install part here doing?

This comment has been minimized.

@rtfeldman

rtfeldman Dec 3, 2016

Member

Oh I see - it's because of "test": "node_modules/.bin/elm-test"

@rtfeldman

rtfeldman Dec 3, 2016

Member

Oh I see - it's because of "test": "node_modules/.bin/elm-test"

@rtfeldman

This is super great @turboMaCk! Thank you so much for doing this! 😻

My only comment is that I don't think package.json makes sense here. I would rather we changed the instructions from "run npm install and then npm test to run the tests" to "run npm install -g elm-test if you haven't already, and then run elm-test to run the tests."

That would also eliminate the npm install step in .travis.yml, which I think is a good thing.

Sound reasonable?

@turboMaCk

This comment has been minimized.

Show comment
Hide comment
@turboMaCk

turboMaCk Dec 3, 2016

Contributor

@rtfeldman No problem at all. I did it this way only because it makes elm-test version independent on global installation. If it's preferable to use global install I don't see any blocker for switching to that.

Contributor

turboMaCk commented Dec 3, 2016

@rtfeldman No problem at all. I did it this way only because it makes elm-test version independent on global installation. If it's preferable to use global install I don't see any blocker for switching to that.

@turboMaCk

This comment has been minimized.

Show comment
Hide comment
@turboMaCk
Contributor

turboMaCk commented Dec 3, 2016

@mgold

This comment has been minimized.

Show comment
Hide comment
@mgold

mgold Dec 3, 2016

Contributor

Looks great to me!

Contributor

mgold commented Dec 3, 2016

Looks great to me!

@rtfeldman rtfeldman merged commit d8df24b into elm:master Dec 3, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rtfeldman

This comment has been minimized.

Show comment
Hide comment
@rtfeldman

rtfeldman Dec 3, 2016

Member

Thank you so much @turboMaCk!

Member

rtfeldman commented Dec 3, 2016

Thank you so much @turboMaCk!

@turboMaCk turboMaCk referenced this pull request Dec 4, 2016

Merged

elm-fromat for tests #774

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment