Commit graph

12 commits

Author SHA1 Message Date
Dan Stillman
722287b81a Switch back to @mozilla.org/browser/clh;1 and fix tests
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.
2023-05-24 08:21:16 -04:00
Dan Stillman
730e86d661 fx-compat: Restore tests and test using actual Zotero executable
The test runner now uses the Zotero executable from
`zotero-standalone-build/staging` rather than the Firefox from
`zotero-standalone-build/xulrunner`. Along with testing the actual
program, this restores visible UI updates during tests, which should
make debugging various things easier. We can also now remove anything
related to Zotero being an extension.

Many tests are still broken, but this at least lets us start running
them.
2022-06-17 20:24:43 -04:00
Dan Stillman
ccbc785499 fx-compat: XPCOMUtils.generateQI() → ChromeUtils.generateQI() 2022-05-12 02:38:59 -04:00
Dan Stillman
c11f1069d7 Add -e flag to runtests.sh to stop tests after a given file
This is useful when trying to debug an error that only happens after a
number of other tests have run -- specify -e and run tests from either
an earlier file with -s or from the beginning.
2017-06-20 05:48:38 -04:00
Dan Stillman
238ab80699 Add -s flag to runtests.sh to start at given file
Useful for restarting after spurious errors when using -f

E.g., ./runtests.sh -s syncEngine
2016-12-16 04:21:37 -05:00
Dan Stillman
4e50b7ddc2 Increase default test timeout to 10 seconds on Travis
Maybe this will fix some of the intermittent failures...
2016-04-26 02:43:44 -04:00
Simon Kornblith
9bb01d737c Merge branch '4.0' into sjk/659 2015-06-01 00:03:20 -04:00
Dan Stillman
fd45032210 Add -g flag to run only tests matching a pattern (grep)
(Actually, it's only matching strings for me, not patterns, but according to
Mocha it's supposed to compile the patterns using RegExp.)
2015-05-31 03:37:45 -04:00
Dan Stillman
f3a6b41c1c Add -f test flag to stop after first test failure
(Mocha has a 'bail' config flag that's supposed to do this, but it doesn't seem
to work when passed to mocha.setup() (maybe because we're setting a custom fail
handler?), so this just calls abort() on the runner manually.)
2015-05-29 04:01:40 -04:00
Aurimas Vinckevicius
2ebce91ecf Add -g flag to runtests.sh to generate test data
Add functions to generate sample data for various formats
* Zotero Web API JSON (Zotero.Item::toJSON)
* CiteProc-JS JSON
* Export translator JSON
* Direct serialization of Zotero.Item fields
Add a way to load sample data into DB from JSON
Add tests for loading sample data into DB
Add tests for automatically generated data
This will help us make sure that field mappings and data formats don't change
2015-05-26 16:04:55 -05:00
Simon Kornblith
50cd396918 Make debugging tests a bit easier
- Add command-line argument to enable debug logging
- Add command-line argument to open (and leave open) jsconsole
- Try to print error stack traces (although Mocha doesn't seem to like
  them?)
2015-03-07 22:17:44 -05:00
Simon Kornblith
1c32db68da Unit testing infrastructure
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...
2015-03-07 16:34:55 -05:00