Code Formatting and
Testing
David Tucker
CTO Consultant
@_davidtucker_ | [Link]
Unit Testing
Unit testing is where individual components (or "units") of an application are
tested to make sure they behave as the author intended. These tests are
usually written for a specific unit testing framework. It is common for these
tests to get executed every time code is committed to a project to ensure
the new code does not break application functionality.
Unit testing is just one type of testing that complex software projects may
leverage.
Jest
Mocha
Jasmine JavaScript Testing Frameworks
AVA
Vitest
More Information
JavaScript Unit Testing with Jest
Gabriel McNeilly
Code Coverage
Code Coverage is a metric designed to tell you how much of an application
is actually tested by the collection of unit tests that have been written for it.
While there are different approaches for calculating this metric, it is
generally assumed that a higher code coverage number is better than a
lower one as it means more of the application is tested by the unit tests.
Code Linting and Formatting
Code Linting
Linting is the automated checking of your source code for programmatic
and stylistic errors. This is done by using a lint tool (otherwise known as
linter). A lint tool is a basic static code analyzer Linting is important to
reduce errors and improve the overall quality of your code. Using lint tools
can help you accelerate development and reduce costs by finding errors
earlier.
Bellairs, Richard. "What is Lint Code? And What is Linting and Why is Linting Important." Perforce. [Link]
...
[Link]
“ESLint statically analyzes your
code to quickly find problems. It
is built into most text editors and
you can run ESLint as part of your
continuous integration pipeline.”
[Link]
“ESLint statically analyzes your
code to quickly find problems. It
is built into most text editors and
you can run ESLint as part of your
continuous integration pipeline.”
Next Steps