At this point we assume core is using ES6, following Airbnb coding standards.
There are hundred of testing libraries. One of the most used testing tool is mocha (also used by airbnb). But it doesn't really matter, most testing libs are the same. This one has integration written for (almost?) everything we can think of using in core js.
The patch is big since it's a diff from my es6 branch. I split the test code in it's own patch for showing how it looks like. For now apply the huge patch and run the following
npm install
npm run test:core
This is the output (with code coverage):
$ npm run test:core
> Drupal@8.3.0 test:core β¦/drupal
> nyc mocha -r jsdom-global/register $(find core/ -name '*.test.js') || exit 0
Drupal
#checkPlain()
β should escape html strings safe for printing
1 passing (6ms)
---------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
---------------|----------|----------|----------|----------|----------------|
All files | 19.44 | 1.54 | 11.11 | 20 | |
drupal.es6.js | 19.44 | 1.54 | 11.11 | 20 |... 573,574,588 |
---------------|----------|----------|----------|----------|----------------|
There are many things to fix, like mocking the browser env, fixing scripts so that mocking isn't needed, excluding vendor code from code coverage, a way to compile es6 files on the fly for testing, etc.
But it's a start.
Needs work
10.1 β¨
Last updated
Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.
Used to track the progress of issues reviewed by the Drupal Needs Review Queue Initiative.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.