Skip to content

Commit

Permalink
Update TESTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sashadev-sky committed Jan 14, 2020
1 parent c536663 commit c2ad965
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@ To learn more about these tools, visit the official docs:
- [Karma](https://karma-runner.github.io/4.0/config/configuration-file.html)
- [Grunt](https://gruntjs.com/getting-started)

`npm test` runs tests from the `test/` folder.
`npm test` runs tests from the `test/` folder. It is just a wrapper around the `grunt test` task, which runs JSHint and Karma tasks.



`npm test` is just a wrapper around `grunt test` task which runs JSHint and Karma tasks.

[JSHint](https://jshint.com/docs/) is a JavaScript code quality tool, an alternative to [ESLint](https://eslint.org/).
[JSHint](https://jshint.com/docs/) is a JavaScript code quality tool and an alternative to [ESLint](https://eslint.org/).

[Karma](https://karma-runner.github.io/latest/index.html) is a test runner, it allows us to test our code in multiple browsers and devices.



### Running just one test

For this, you need to install Mocha globally. Run `npm i -g mocha`
Expand All @@ -28,8 +22,6 @@ After you've successfully installed Mocha, you can run just one type of test by

`mocha <filename>.js`



### Running a single test block within a test file

In order to do this, you don't need to install Mocha globally.
Expand All @@ -38,8 +30,6 @@ You can just attach a `.only()` function call to a test block that you want to e

It can be attached to both, `describe` and `it` test blocks.



**EXAMPLE**:

```javascript
Expand All @@ -56,16 +46,12 @@ it('tests feature 3', function(){
});
```



### Skipping tests

Sometimes, we just want to write a boilerplate code for a test, but we don't want to implement it yet.

We can attach `.skip()` function call, which will skip our `it` or `describe` blocks, works just like `.only()`.

**NOTE**: After you finish writing a test, remember to remove your `.only()` or `.skip()` calls.


**NOTE**: After you finish writing a test, remember to remove your `.only()`or `.skip()` calls.

They are meant for development purposes, in the production we don't want to alter the actual code of our tests.
They are meant for development purposes, in production we don't want to alter the actual code of our tests.

0 comments on commit c2ad965

Please sign in to comment.