CI is currently failing because package.json refers chromedriver
^80.0.1, which also matches 80.0.2.
In 80.0.2, chromedriver updated the `extract-zip` dependency:
16151de4c7
extract-zip 2.0.0 has dropped support for Node <10, e.g. by using APIs
that were introduced in Node 10:
https://github.com/maxogden/extract-zip/blob/v2.0.0/index.js#L11
which triggers the following error when run on earlier versions of Node:
```
> chromedriver@80.0.2 install /home/travis/build/mozilla/webextension-polyfill/node_modules/chromedriver
> node install.js
internal/util.js:214
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original', 'function');
^
TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
at promisify (internal/util.js:214:11)
at Object.<anonymous> (/home/travis/build/mozilla/webextension-polyfill/node_modules/extract-zip/index.js:11:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/travis/build/mozilla/webextension-polyfill/node_modules/chromedriver/install.js:14:20)
```
This commit fixes the issue by running tests with Node 10.
Node 8 had become end-of-life on 2019-12-31 anyway.
This commit introduces tape as the test framework used to define the tests in the
test extension contexts and send them to the nodejs script that orchestrate the
test run.
The nodejs script has also been migrated from mocha to tape, it uses the custom test
helpers provided to setup the test environment (e.g. create a temporary dir
for the test extension, copy the last polyfill build, bundle tape to be used
in the test extension, start the browser which run the test extension
and finally collect the results of the test extension) and then it merges all the
tap logs collected from every test extension into a single "per browser" test suite.
- updated travis nodejs environment to nodejs 8
- uses tape to collect test results from inside the test extension
- added test case to check polyfill 'existing browser API object' detection
- added test for expected rejection on tabs.sendMessage with an invalid tabId
- added test with multiple listeners which resolves to undefined and null
- optionally run chrome smoketests with --enable-features=NativeCrxBindings