rluiten / elm-date-extra

Elm Date Extra library add/subtract/diff/format etc dates
http://package.elm-lang.org/packages/rluiten/elm-date-extra/latest
BSD 3-Clause "New" or "Revised" License
75 stars 36 forks source link

Test suite fails to run #61

Closed ikr closed 6 years ago

ikr commented 6 years ago

Running tests with elm-test (installed with npm -g) 0.18.12 results in

Success! Compiled 0 modules.
Successfully generated /dev/null
Success! Compiled 1 module.
Successfully generated /home/ikr/prj/elm-date-extra/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js
CreateTests currentOffsets: (-120,-60)
CreateTests currentOffsets: (-120,-60)
CreateTests currentOffsets: (-120,-60)
CreateTests currentOffsets: (-120,-60)
CreateTests currentOffsets: (-120,-60)
CreateTests currentOffsets: (-120,-60)
CreateTests currentOffsets: (-120,-60)
CreateTests currentOffsets: (-120,-60)

elm-test 0.18.12
----------------

Running 324 tests. To reproduce these results, run: elm-test --fuzz 100 --seed 1515671661

↓ Date.Extra.CreateTests
✗ Create module tests

    This `describe "Create.getTimezoneOffset - each describe PASSES in matching time zone ONLY."` has no tests in it. Let's give it some!

↓ Date.Extra.DurationTests
✗ Date.Duration tests

    This `describe "Duration.add"` has no tests in it. Let's give it some!

↓ Date.Extra.DurationTests
✗ Date.Duration tests

    This `describe "Duration.diff"` has no tests in it. Let's give it some!

↓ Date.Extra.DurationTests
✗ Date.Duration tests

    This `describe "Duration.diffDays"` has no tests in it. Let's give it some!

↓ Date.Extra.UtilsTests
✗ Date.Utils tests

    This `describe "Utils.isoWeek - test in matching time zones only."` has no tests in it. Let's give it some!

TEST RUN FAILED

Duration: 309 ms
Passed:   319
Failed:   5

Looks like tests are conditionally included. When the condition isn't met, a stub tests-set gets registered for execution. Those stubs make elm-test unhappy, it seems.

It all started for me with finding a problem with Duration.diff, and wanting to write a reproducing test. However I failed in making the tests run.

rluiten commented 6 years ago

There are time zone specific tests in the test suite. So you are running them in a zone that happens to have some suites empty.

An Empty suite is better than a failing test for something that won't success in your time zone in my opinion.

Next time I am in the code base I will see if i can remove the suite entirely if it has no tests so it won't fail.

Id like to have some way to automate it running the suite in each time zone in some specified list but it is a fairly complex thing to setup believe and is not a high priority for me.

ikr commented 6 years ago

Alright, I see. Thanks for your answer! Here's the initial problem that made me run the tests https://github.com/rluiten/elm-date-extra/pull/62

rluiten commented 6 years ago

Had a simple idea to address at least those empty test suites you referenced I have addressed them now. Just pushed 9.2.2.