alexander34ro / DevOps

Repo with DevOps research
Apache License 2.0
2 stars 2 forks source link

Use a framework to migrate old tests #20

Closed alexander34ro closed 4 years ago

alexander34ro commented 4 years ago

We need to integrate the old Python tests into our rewritten JavaScript app. There are multiple competing JavaScript frameworks that suit our basic needs:

Screenshot from 2020-02-12 22-40-44

Jasmine & Mocha

Jasmine and Mocha are no-goes for us as they don't offer support for the most recent versions of Javascript.

Jest

Jest looks really good on paper but requires more dependencies than Ava and its extra features are redundant for our project. The Jest syntax is also quite outdated.

Ava

Ava is our framework of choice for migrating our tests to a new language. This is due to its ease of setup and use. Ava can be installed using a single command. Its syntax is the most elegant out of the bunch.

Sample Ava test:

import test from 'ava';
test('Sum numbers', t => {
  const sum = 1 + 2;
  const expectedResult = 3;
  t.equal(sum, expectedResult);
});

References: https://blog.logrocket.com/the-best-unit-testing-frameworks-for-node-js/ https://blog.risingstack.com/node-hero-node-js-unit-testing-tutorial/

jianupetrut commented 4 years ago

https://github.com/avajs/ava/blob/master/docs/recipes/endpoint-testing-with-mongoose.md