Menu

Add Custom Chai Assertions to your Adaptive.js Project

Follow these steps to access Mobify's custom Chai assertions for your tests if your Adaptive.js version is previous to 1.6.0.

Mobify's Custom Chai Assertions are automatically included for projects generated with version 1.6.0 and onward of the Adaptive.js generator.


1. In an editor app, from your root project folder, open the package.json file.

2. In the package.json file, in the dependencies block, add the mobify-chai-assertions line:

...
"mobify-chai-assertions": "1.2.0",
...

Save the file and close it.

3. In your editor, from the tests/runner folder, open the config.js test configuration file.

4. In the config.js file, in the paths block, add the chaiPlugin line:

...
'chaiPlugin': "node_modules/mobify-chai-assertions',
...

Save the file and close it.

5. In your editor, from the tests/runner/ folder, open the `...guage": "javascript" } ] } [/block]

7. Open a new Terminal (Mac) or Command Prompt (Windows).

8. To change directories to your root project folder, enter the following command on the command line:

cd path/to/project/directory

9. To download and to install all dependencies correctly, enter the following command on the command line:

npm install

10. To push to Git the changes to the last 3 files that you edited, enter the following command on the command line:

git push

Because node_modules is not pushed to Git by default, everyone who pulls these changes from your repository also needs to run the npm install command.

Edit in GitHub