In Firefox 102, `-file` was being swallowed by `nsBrowserContentHandler`
in BrowserContentHandler.jsm, so ab7d916e0 overrode that by using the
same contract id for our main nsICommandLineHandler in
zotero-service.js. But `nsBrowserContentHandler` also handles `-chrome`,
which we were using in tests to pass runtests.html. There's no need to
pass in dynamically though -- we can just hard-code that and open the
window ourselves.
* Use mocha, chai & sinon from the npm. As of sinon 2.0
sinon-as-promised is no longer required so it is removed
* Tweak code to re-use the same loader with the same environment
throghout the code
* Introduce browserify step for testing tools that only provide
node-compatible libraries (sinon, chai-as-promised)
* Introduce copy step for test data to resolve multiple issues with
tests depending on files not being symlinks
* Re-introduce custom implementation of setTimeout to resolve issues
with few tests
* Re-introduce custom Bluebird Promises config & monkey patch
Improves UX of sync authentication.
The account is now linked and unlinked and an API key related to
the client is generated transparently in the background.
The API key is deleted on unlinking.
No sync options are allowed before linking an account.
Also some support code that was useful here and will probably be
useful for other tests. This is a pretty complicated thing to test, but
it seems to work.
Implements the beginnings of unit testing infrastructure using
mocha/chai. The unit tests can be run locally using test/runtests.sh,
although this will need tweaks to run on Windows. They should also run
on commit using Travis-CI.
The unit tests themselves live in test/tests. The index.js file
specifies separate test sets, which can be run individually by calling
test/runtests.sh <testsets>. Right now there is only a single unit
test, but hopefully we'll have more soon...