Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node tests #707

Closed
wants to merge 19 commits into from
Closed

Node tests #707

wants to merge 19 commits into from

Conversation

aral
Copy link
Contributor

@aral aral commented May 28, 2018

This is a first attempt at getting Dexie tests running (and eventually passing) under Node.js.

To use:

Raw TAP output

(Verbose; more informative, harder to skim.)

npm run test:node

Pretty output

(Summary view courtesy of faucet.)

npm run test:node:pretty

Details

I’ve added a very simple custom test runner that does the minimum it needs to set up an environment in which existing tests can run. I’ve updated the test utilities to make them isomorphic (was just a couple of variables in a couple of places).

Specifically, it:

  • Creates a CommonJS version of the dexie-unittest-utils script
  • Sets up a Node testing environment using IndexedDBShim, QUnit, and QUnit-tap
  • Loads test scripts, strips imports from them and runs them in the Node environment

Each script is run in its own process so that failures do not affect the others. (At this point, I thought it would be more important to give us an initial overview of the state of the tests under Node.js instead of discovering it piecemeal. We can review this decision in the future.)

Current status: the runner executes all of the tests apart from those within specific test scripts following a timeout. It does, however, make its way through all the test scripts. Some test and some test scripts are timing out. Individual test timeouts are currently set to 3 seconds and test script timeouts at 10 seconds. Some of the issues may be due to issues with the test environment I’m setting up.

aral added 8 commits May 28, 2018 19:15
(These are deleted as part of the testing process but this is just so we can avoid accidentally committing them if they’re left behind because of a crash, etc.)
Also include test method from QUnit in the global test space.
(There are failing tests and some tests are timing out but all test files are run.)
@aral aral changed the title Node tests WIP: Node tests (please do not merge) May 28, 2018
@aral
Copy link
Contributor Author

aral commented May 29, 2018

CI seems to be failing due to npm rate limiting (error: npm ERR! 429 Too Many Requests: acorn@https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz).

aral added 3 commits May 29, 2018 10:38
Note: When run with npm run, this runs all the tests but errors at the end with an ELIFECYCLE errno 1 (looks like permission error). To avoid the final error, the workaround is to install faucet globally (npm i -g faucet) and run it manually with npm run test:node | faucet. For practical purposes, the npm script should suffice for now.
  * 4 spaces
  * Semi-colons at the end of lines
@aral aral changed the title WIP: Node tests (please do not merge) Node tests May 29, 2018
@aral
Copy link
Contributor Author

aral commented May 29, 2018

@dfahlander I just reformatted the code to match the project style used in the other tests. Barring any changes you’d like me to make, I believe this is now ready to be merged.

aral added 7 commits May 30, 2018 16:04
(Usage: npm run test:node -- test-name other-test-name etc.)
Tests 114 and 115 in tests-table.js now passing. Progress on dexie#709
Instead of ok(), using equal() – which I believe was the original intent. Not sure why the tests were passing in the browser but the number 2 in the method signature was expected to be a string by the ok() method.

Fixes dexie#710
(In or-issue#15-test, finally clause.)
@dfahlander
Copy link
Collaborator

Closing this for cleanup purpose.

@dfahlander dfahlander closed this Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants