Possible bug with the newest node version, time calculated wrongly
Closed this issue ยท 4 comments
What happens
Working from 08:00 to 16:58 results in 0 Hours and -23 Minutes
Expected behavior
Working from 08:00 to 16:58 should result in 8 Hours and 28 Minutes
Moro has been working fine before upgrading to the newest node.
โ date
ti 6.3.2018 16.58.31 +0200
โ moro hi 08:00
๐ Moro \o/
โ You clocked in at: 08:00
โฐ Working until 16:00 will make it a full (7.5 hours) day
_ % โ moro
๐ Moro \o/
โน Today looks like this so far:
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Today you worked โ 0 Hours and -23 Minutes โ
โโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Clock in โ 08:00 โ
โโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Clock out โ 08:07 โ
โโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Break duration โ 30 minutes โ
โโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Date โ 2018-03-06 โ
โโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโ
โน Run moro --help to learn how to edit your clock in, clock out or break duration for today
Version information
โ npm --version 5.6.0โ moro --version
๐ Moro \o/
_ 3.3.1
โ node --version
v9.7.1
โ lsb_release -d
Description: Ubuntu 16.04.4 LTS
Thanks for the perfect bug report @olpeh
I still can't reproduce it even though I used the same node version.
Can you run the tests and see which one breaks?
npm test
Should run everything.
I'm also unable to reproduce it anymore. And after that occurence moro has been working without any issues.
However, some of the tests fail, not sure if related.
Ran the tests: 9 tests, 4 failures
Test output
``` โ moro git:(master) โ nvm current v9.7.1 โ moro git:(master) โ npm i -g npm /home/olha/.nvm/versions/node/v9.7.1/bin/npm -> /home/olha/.nvm/versions/node/v9.7.1/lib/node_modules/npm/bin/npm-cli.js /home/olha/.nvm/versions/node/v9.7.1/bin/npx -> /home/olha/.nvm/versions/node/v9.7.1/lib/node_modules/npm/bin/npx-cli.js + npm@5.7.1 added 63 packages, removed 6 packages and updated 49 packages in 11.658s โ moro git:(master) โ npm testmoro@3.3.1 test /home/olha/projects/moro
cross-env MORO_TEST_MODE='true' ava && bats tests/end-to-end/moro.tests.bats
TAP version 13
test โบ singleDayReport runs without crashing
ok 1 - test โบ singleDayReport runs without crashing
Report of all the days:
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Date โ Work Hours โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-03-10 โ 7 Hours and 55 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Sum in week 10 โ 7 Hours and 55 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
test โบ printAllDaysReport runs without crashing
ok 2 - test โบ printAllDaysReport runs without crashing
Report of all the days:
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Date โ Work Hours โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-03-09 โ 7 Hours and 55 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-03-10 โ 7 Hours and 55 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Sum in week 10 โ 15 Hours and 50 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-03-14 โ 8 Hours and 0 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-03-15 โ 8 Hours and 0 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Sum in week 11 โ 16 Hours and 0 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
test โบ printAllDaysReport with week change runs without crashing
ok 3 - test โบ printAllDaysReport with week change runs without crashing
There are 3 search results:
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Date โ Time โ Note โ
โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-08-04 โ 17:00 โ #Workrelated โ
โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-08-04 โ 17:30 โ #Workrelated โ
โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-08-04 โ 18:00 โ Other project #related โ
โโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
test โบ printSearchResults runs without crashing
ok 4 - test โบ printSearchResults runs without crashing
db-tests โบ db file is created properly
ok 5 - db-tests โบ db file is created properly
Database file deleted successfully
db-tests โบ removeDatabase removes db file
ok 6 - db-tests โบ removeDatabase removes db file
Report of all the days:
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Date โ Work Hours โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-03-11 โ 7 Hours and 55 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Sum in week 10 โ 7 Hours and 55 Minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
db-tests โบ getFullReport outputs ok results
ok 7 - db-tests โบ getFullReport outputs ok results
db-tests โบ createTable makes tables alright
ok 8 - db-tests โบ createTable makes tables alright
db-tests โบ updateDatabase inserts and reads correctly
ok 9 - db-tests โบ updateDatabase inserts and reads correctly
db-tests โบ calculateWorkHours works
ok 10 - db-tests โบ calculateWorkHours works
There are 1 search result:
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Date โ Time โ Note โ
โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2017-08-04 โ 17:00 โ #Workrelated โ
โโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
db-tests โบ getSearchTerm returns the desired note
ok 11 - db-tests โบ getSearchTerm returns the desired note
1..11
tests 11
pass 11
fail 0
โ Check that moro report works
โ moro clear --yes works
โ moro with no argument, first time should register clock in, and calculate clock out accordingly
(from function assert_success' in file tests/end-to-end/../../node_modules/bats-assert/all.bash, line 25, in test file tests/end-to-end/moro.tests.bats, line 21)
assert_success' failed
command failed with exit status 127
output: /home/olha/projects/moro/node_modules/bats/libexec/bats-exec-test: line 58: faketime: command not found
โ moro with no argument, second time should register clock out
(from function assert_success' in file tests/end-to-end/../../node_modules/bats-assert/all.bash, line 25, in test file tests/end-to-end/moro.tests.bats, line 29)
assert_success' failed
command failed with exit status 127
output: /home/olha/projects/moro/node_modules/bats/libexec/bats-exec-test: line 58: faketime: command not found
โ moro hi 09:00 should adjust clock in at 09:00
โ moro bye 17:00 should adjust clock out at 17:00
โ moro break 45 should set break to 45 minutes
โ moro note should save a note with correct time
(from function assert_success' in file tests/end-to-end/../../node_modules/bats-assert/all.bash, line 25, in test file tests/end-to-end/moro.tests.bats, line 57)
assert_success' failed
command failed with exit status 127
output: /home/olha/projects/moro/node_modules/bats/libexec/bats-exec-test: line 58: faketime: command not found
โ moro search should find the note
(from function assert_contains' in file tests/end-to-end/../../node_modules/bats-assert/all.bash, line 63, from function
assert_output_contains' in file tests/end-to-end/../../node_modules/bats-assert/all.bash, line 98,
in test file tests/end-to-end/moro.tests.bats, line 65)
`assert_output_contains 'There are 1 search result:'' failed
expected:
๐ Moro \o/
to contain: There are 1 search result:
9 tests, 4 failures
npm ERR! Test failed. See above for more details.
โ moro git:(master) โ npm --version
5.7.1
โ moro git:(master) โ node --version
v9.7.1
Yes. Node 10 breaks moro, there's a branch with node 10 where tests fail. I'll check when I can.
Moro is ready for node 10 as in #182