docson
docson copied to clipboard
What is the proper way of running tests?
I am confused as to how to run tests for Docson (and add tests for bugs I’m trying to fix, which is my actual motivation). Here is what I tried:
- README.md refers to http://lbovet.github.io/docson/tests/test.html, however the current version of that file does not seem to work – it seems to have been left behind in the move of several things to public/. I can fix the paths, but then I discover that public/docson.js used by it seems to be outdated – it is not updated by
npm run build
, unlike the files in public/js. There however seems to be no usable replacement for it, I cannot find an output file that is both loadable in the browser (is not a CommonJS module, unlike lib/index.js) and exports thedocson
API without already using it (unlike public/js/webpage.js). - integration/README.md has some instructions. When I follow them (plus
npm -g install nightwatch
, which is not mentioned), I get the messageError: Cannot read test source location: /Users/cwalther/Documents/json-schema-tools/docson/nightwatch
. I suspect this is a sign of bitrot too, since a folder nightwatch has existed once, before it was renamed to integration, and therefore stop searching in this direction. - I seem to have some success with
node_modules/.bin/jest
, which I try on a whim based on the presence of a jest.config.js. When run like that, it gets stuck with one test suite passing and the other still running (I think I have a fix for that and will follow up with a pull request), but when run individually (node_modules/.bin/jest integration/widget.test.js
,node_modules/.bin/jest integration/basic.test.js
), they pass. So it that the proper way?
Could any outdated things please be removed from the repository, or clearly marked as outdated?
If there is a supported automated way of running tests, I would also suggest naming it as scripts.test in package.json so that no detective work is required to find it.
I have to dig back into my notes. I think that the tests were originally using Nightwatch, and I moved them to jest/puppeter. The part I don't remember is if all tests were already set to be running together, or if I always ran them one by one. I'll check back things, and get back to you -- prolly tomorrow.