- Before starting, we can install some JS extensions like 'Prettier' and 'ESLint' if not installed already so that most of our JS conventions will be taken care of.
You can find the links below:
2. Some people follow indentation of 4 spaces. But in BigBinary, we follow indentation of 2 spaces consistently as we follow the same in Ruby on Rails as well.
3. Variables should always be in lower camel case.
const firstName = Oliver
4. When declaring the variables prefer using
const instead of
let can be used when we are modifying the variable. If we are modifying the object or an array
const can still be used instead of
6. When writing a comment we must ensure that it is meaningful and we must keep some space after comment.
1//add first client steps => incorrect 2// add first client steps => correct
File Naming Conventions
- The name of the file must convey the test suite name.
e.g. If we are adding test case file for login, name of file should be: login.spec.js
2. All the spec files should be stored in “integrations” folder.
JS conventions for naming the files(i.e lowerCamelCase).
e.g. If we are creating spec file for creating a customer, the name of spec file should be: createCustomer.spec.js