- 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:
- 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.
- Variables should always be in lower camel case. e.g. const firstName = Oliver
- When declaring the variables prefer using const instead of let.
- 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 let.
- 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
- All the spec files should be stored in “integrations” folder.
- Follow 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