Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 78de385
Showing
35 changed files
with
24,716 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Examples of tests | ||
|
||
All examples assume you have node and npm, and you know what is it. | ||
|
||
First do in root of repo: | ||
|
||
``` | ||
npm i | ||
``` | ||
|
||
## Most simple way - include all <script>'s | ||
|
||
Look in `simple-mocha-should` directory to look on most basic way to run tests with `mocha` and `should`. To repeat such steps: | ||
|
||
Assume you in project folder | ||
|
||
```shell | ||
//if it is not inited before, provide some answers | ||
npm init | ||
|
||
// install dependencies | ||
npm i --save-dev mocha should | ||
|
||
./node_modules/.bin/mocha init folder_with_browser_tests | ||
``` | ||
|
||
This will create basic structure you can see in `simple-mocha-should`, now you need to add script tags | ||
for should **before** your tests (mocha will add tests.js file by default). That is all, simple and practically useless. | ||
//if it is not inited before, provide some answers | ||
To run this example run `npm run browser` and open http://localhost:8080/simple-mocha-should/index.html | ||
|
||
## The same simple way but load tests with requirejs | ||
|
||
In this example we load everything with requirejs, you can see simple-mocha-should-requirejs to understand how it works. | ||
|
||
To run this example run `npm run browser` and open http://localhost:8080/simple-mocha-should-requirejs/index.html | ||
|
||
## Build test scripts with browserify | ||
|
||
To run build of tests `npm run build` in folder `browserify-mocha-should` and then run as before: | ||
|
||
`npm run browser` and open http://localhost:8080/browserify-mocha-should/index.html | ||
|
||
## Adding zuul | ||
|
||
zuul allow automatically build tests in bundle and have good integration with sauce-labs. | ||
But you still need locally open each browser by hands for tests | ||
|
||
## Launch browsers with karma | ||
|
||
Karma allow to run browser (also it sauce labs integration). All configuration happen in karma.conf.js files. | ||
To run tests just `npm test`. | ||
|
||
`karma-browserify-mocha-should` contain example of using browserify to bundle files. | ||
|
||
`karma-requirejs-mocha-should` contain example of using requirejs to load files | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
`Browserify` require that you build test first, for automation you can use `watchify` module. | ||
|
||
To build tests: | ||
``` | ||
npm i | ||
npm run build | ||
``` | ||
Now you can open this index.html in browser. Don't forget to look on package.json to see how browserify called. | ||
As an additional step you will need to combine you tests in some way (e.g. require each from one file, or concat them). |
Oops, something went wrong.