Skip to end of metadata
Go to start of metadata

Goals

The intention of selecting a test framework is to test pure node.js scripts in the data-update-github repository. So far, these scripts include Cindy's new-download-trigger-PR script and Ted’s diffing/merging algorithm.

It hasn't been discussed whether the data merge web interface will be developed in this repository. Since the web UI will very likely be developed using the infusion framework, if UI is a part of this repository, jqUnit from infusion will be the best choice. However, if UI is not part of this repository, pulling in 43M infusion library for testing a few node.js scripts seems an overkill. This evaluation is to determine in the latter case, what's the best choice for testing these node.js scripts.

Requirements

  1. Can test node.js scripts;
  2. Support the test of asynchronous code such as Promise;
  3. Simple and lightweight;
  4. It would be a bonus if the testing framework supports browser tests, but this is not a must-have.

Comparison

This section compares a few popular Javascript testing framework surfaced via research and recommendations from fluid-work community.

FeatureInfusion jqUnitMochaAvaJest
Must have features
Can test node.js scriptsYesYesYesYes
Support the test of asynchronous code such as PromiseYesYesYesYes
DocumentationGoodGoodGoodGood
Size42.2M3.04M272K4.34K
In active developmentDeveloped and supported by our own teamYes, maintained by volunteersYesYes, maintained by Facebook
Community supportActiveActiveActiveActive
Is open sourceYesYesYesYes
Popularity1.3K weekly downloads4.7M weekly downloads185.8K weekly downloads9.6M weekly downloads
Bonus but optional features
Support browser testsYesYesNoNo
Support other ES6 features such as import/exportNo. Installing esm or babel package may help to support ES6 import/export.Needs to install esm package or babel to support ES6 import/export.Needs to specify babel in package.json to support ES6 import/export. See this discussion.Needs to install a plugin to transform ES6 to commonjs. See this discussion.

Conclusion

If this repository will contain UI code developed using infusion, the infusion testing framework is the best choice.

Otherwise, Jest seems to be the best choice.

Decision

The decision made at the tech check in meeting on 2020-11-12 is to use infusion node-jqUnit as the testing framework because fluid-testem built around jqUnit is an existing helper for producing the coverage report for combined node.js and browser tests.

  • No labels