Adobe Campaign JavaScript SDK

Commit Checklist

In summary, the following tasks must be performed before submitting a pull request

    npm i
    npm run unit-tests
    npm audit
    node_modules/jshint/bin/jshint src/
    npm run jsdoc
    open ./docs/jsdoc/index.html
    node ./compile.js
    

Write and run tests

The JS SDK has 100% coverage and should stay so. Each PR must include a series of unit test which test that the feature works, but also test all the error cases and edge cases. In general it's better to write more tests than few.

Tests should be fast. We will not accept tests which wait for timeouts for example. Each test should not run for more than a few ms.

npm run unit-tests

The result should look like this

    PASS  test/soap.test.js
    PASS  test/xtkPersist.test.js
    PASS  test/domUtil.test.js
    PASS  test/caches.test.js
    PASS  test/testUtil.test.js
    PASS  test/entityAccessor.test.js
    PASS  test/client.hasPackage.test.js
    PASS  test/xtkProxy.test.js
    PASS  test/credentials.test.js
    PASS  test/index.test.js
    PASS  test/crypto.test.js
    PASS  test/xtkCaster.test.js
    PASS  test/escape.test.js
    PASS  test/transport.test.js
    PASS  test/util.test.js
    PASS  test/web.bundler.test.js
    PASS  test/error.test.js
   --------------------|---------|----------|---------|---------|-------------------
   File                | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
   --------------------|---------|----------|---------|---------|-------------------
   All files           |     100 |      100 |    98.8 |     100 |
    src                |     100 |      100 |    98.8 |     100 |
     application.js    |     100 |      100 |     100 |     100 |
     cache.js          |     100 |      100 |     100 |     100 |
     cacheRefresher.js |     100 |      100 |     100 |     100 |
     client.js         |     100 |      100 |     100 |     100 |
     crypto.js         |     100 |      100 |     100 |     100 |
     domUtil.js        |     100 |      100 |   97.29 |     100 |
     entityAccessor.js |     100 |      100 |   85.71 |     100 |
     errors.js         |     100 |      100 |     100 |     100 |
     index.js          |     100 |      100 |     100 |     100 |
     methodCache.js    |     100 |      100 |     100 |     100 |
     optionCache.js    |     100 |      100 |     100 |     100 |
     soap.js           |     100 |      100 |     100 |     100 |
     testUtil.js       |     100 |      100 |     100 |     100 |
     transport.js      |     100 |      100 |     100 |     100 |
     util.js           |     100 |      100 |   93.33 |     100 |
     xtkCaster.js      |     100 |      100 |   95.65 |     100 |
     xtkEntityCache.js |     100 |      100 |     100 |     100 |
    src/web            |     100 |      100 |     100 |     100 |
     bundler.js        |     100 |      100 |     100 |     100 |
   --------------------|---------|----------|---------|---------|-------------------
   
   Test Suites: 21 passed, 21 total
   Tests:       1773 passed, 1773 total
   Snapshots:   0 total
   Time:        11.654 s

Run tests

npm run unit-tests

Check for security issues

Run npm audit to check for security issues. If any is found, make sure to fix it before you pull request your PR.

npm audit

It should not return any errors or warnings

Run the linter

node_modules/jshint/bin/jshint src/

It should not return any errors or warnings

Generate and run the JS doc

npm run jsdoc

It should not return any errors or warnings. You should then open the generated documentation and check it

open ./docs/jsdoc/index.html

Document your changes

Follow this link to understand how to document your changes

You'll also have to change the Changelog file