cd CliClient npm run test -- --filter="integration_ShowAllNotes"
Sometimes all tests pass. But it also sometimes fails with different errors.
This is one type of error I get.
Failures:
integration_ShowAllNotes should show retain note selection when going from a folder to all-notes
Message:
Unhandled promise rejection: Error: Accessing database before it has been initialised
Sometimes I also get this failure
Failures:
integration_ShowAllNotes should show all notes
Message:
Expected $.length = 0 to equal 9.
It happens on the latest original master branch without any code changes by me. It should be reproducible.
Unhandled promise rejection: Error: Accessing database before it has been initialised
I believe this error is not a fault of the test. It's just that if I run npm run test -- --filter="integration_ShowAllNotes"
soon enough, the database does not have time to initialize.
But I don't understand how it sometimes fails with this error.
> joplin@1.0.161 test /home/naviji/Projects/RoughWork/joplin/CliClient
> gulp buildTests -L && jasmine --config=tests/support/jasmine.json "--filter=integration_ShowAllNotes"
Testing with sync target: memory
Randomized with seed 44614
Started
.F
Failures:
1) integration_ShowAllNotes should show all notes
Message:
Expected $.length = 0 to equal 9.
Expected $[0] = undefined to equal '185752143570473f9f69fd7b9dad84be'.
Expected $[1] = undefined to equal '3a8c9f50f6dd438dad75fa242dc30cfe'.
Expected $[2] = undefined to equal '627fec95b1c14f19a2c71eb2ed59a9ab'.
Expected $[3] = undefined to equal '710f8ba8f087438784b29559f6cf777f'.
Expected $[4] = undefined to equal '886fdeffa1144fe49d2f15e82fc41449'.
Expected $[5] = undefined to equal 'b232d5bbd6934513b8faca72fa4b95c0'.
Expected $[6] = undefined to equal 'c6c6d738e3b74133ae2244d7c4a3567f'.
Expected $[7] = undefined to equal 'd84d00d46d9a423b9d8a80d08e62c85b'.
Expected $[8] = undefined to equal 'eed010a53d5e4e8082c5fb450ee2648a'.
@mic704b, the tests are ran in random order and you can use the seed, in that case 44614, to run them in a predefined order. I think the command would be npm test -- --seed 44164
Yes, I've tried that too just now, 150 repeats no fails.
I suspect the order doesn't matters here, however I suspect it will always be the second test that fails for him.
There is certainly something about his setup that aggravates the problem.
I actually have some more fixes on another branch. On that branch, I had to stop the synchronizer from running, because when it started a sync in the background during the tests, it would cause the running test to miss it's 100ms deadline and so fail. Perhaps this is related to that?
I could prepare a branch with just the fixes, and perhaps @naviji could try it and see if it stops the problems he's seeing?
Maybe. If it times out it would show a different error, but it might be related in that when something is running slow, some clean up that runs asynchronously doesn't finish on time.
I can see in addition to the synchronizer disable, I also found an bug in the shutdown of the 'registry.js' timers. They are a little more complex than the other services, and I think I got it wrong previously.
Please apply the patch from your project base directory (git apply test-harness-fixes.patch) and try the tests again. Don’t forget to npm install in the CliClient directory.
That is interesting. If the integration tests runs first (before any unit tests) I can see a path (bug) where this call doesn't happen. I'll look into it and maybe create another patch for naviji to try.