Testing & Linting
All testing-related documentation can be added here, and moved to a more appropriate location later if need be.
All the tests and lints can be run in a single task through Grunt with the command $ grunt test
JavaScript unit testing
All new JavaScript should be covered by a test as part of our DOD going forward. We're using
Jasmine for this, which is run via Grunt: $ grunt jasmine
Spec files are placed in /tests/
. The directory structure and file naming within this directory should echo that of the JavaScript being tested, with *.js
extensions being replaced with *_spec.js
.
For example, /src/scripts/modules/jquery.pfAccordion.js
's corresponding spec file is /tests/scripts/modules/jquery.pfAccordion_spec.js
.
JavaScript linting
The JavaScript is run through
ESLint, and can be run via Grunt: $ grunt eslint
. Finer configuration of the linter rules can be made by tweaking the .eslintrc
and .eslintignore
files.