Opened 2 years ago

Last modified 22 months ago

#6884 closed change

Migrate from nodeunit to mocha (in adblockpluschrome) — at Version 3

Reported by: sebastian Assignee: sebastian
Priority: P3 Milestone: Adblock-Plus-3.4-for-Chrome-Opera-Firefox
Module: Platform Keywords:
Cc: tlucas, kzar, hfiguiere Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

Description (last modified by sebastian)


With #6717 we introduced nodeunit in adblockpluschrome in order to wrap WebDriver to run the actual (qunit) tests from the command line and the CI. We decided to use nodeunit becasue this is historically what we use in adblockpluscore (we might want to migrate to Mocha there as well).

There are following issues with nodeunit:

  • nodeunit is deprecated and no longer maintained.
  • If a test failed, the process appears to be terminated before completing pending asynchronous tasks, which calls for obscure workarounds (if available) when dealing with resources that need to be cleaned up (e.g. browser processes managed through WebDriver).
  • There is no concept of shared resources, setUp and tearDown are always called for each test, making it difficult to share resources (that require cleanup) across tests.

The latter two make it in particular impossible to extend the test suite (e.g. by running against our test pages), without resulting into an inferior test architecture and slower performance.

Mocha doesn't seem to have any of these issues and appears to have become the defacto standard testing framework for Node.js in modern days.

What to change

Replace nodeunit with the Mocha test framework in adblockpluchrome. While on it, leverage the before and after hooks (which wasn't possible before and will help to add more tests).

Change History (3)

comment:1 Changed 2 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 2 years ago by sebastian

  • Description modified (diff)

comment:3 Changed 2 years ago by sebastian

  • Description modified (diff)
Note: See TracTickets for help on using tickets.