diff options
author | Lukas Eipert <git@leipert.io> | 2018-04-10 13:03:46 +0300 |
---|---|---|
committer | Lukas Eipert <git@leipert.io> | 2018-04-10 13:03:46 +0300 |
commit | 029180f01645690d64398254dab03719801c4950 (patch) | |
tree | 416b2af5f6a269d9307127fc4ee920ec140b5844 /doc/development/testing_guide | |
parent | 267602fe84735f1c8a31ae7ec8e677b71b9098c6 (diff) |
add documentation for karma testing with specific files/folders
Diffstat (limited to 'doc/development/testing_guide')
-rw-r--r-- | doc/development/testing_guide/frontend_testing.md | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/doc/development/testing_guide/frontend_testing.md b/doc/development/testing_guide/frontend_testing.md index 0c63f51cb45..37653758e57 100644 --- a/doc/development/testing_guide/frontend_testing.md +++ b/doc/development/testing_guide/frontend_testing.md @@ -152,19 +152,33 @@ is sufficient (and saves you some time). ### Live testing and focused testing While developing locally, it may be helpful to keep karma running so that you -can get instant feedback on as you write tests and modify code. To do this -you can start karma with `npm run karma-start`. It will compile the javascript +can get instant feedback on as you write tests and modify code. To do this +you can start karma with `yarn run karma-start`. It will compile the javascript assets and run a server at `http://localhost:9876/` where it will automatically -run the tests on any browser which connects to it. You can enter that url on +run the tests on any browser which connects to it. You can enter that url on multiple browsers at once to have it run the tests on each in parallel. While karma is running, any changes you make will instantly trigger a recompile and retest of the entire test suite, so you can see instantly if you've broken -a test with your changes. You can use [jasmine focused][jasmine-focus] or +a test with your changes. You can use [jasmine focused][jasmine-focus] or excluded tests (with `fdescribe` or `xdescribe`) to get karma to run only the tests you want while you're working on a specific feature, but make sure to remove these directives when you commit your code. +It is also possible to only run karma on specific folders or files by simply +appending the file name to the karma command: + +```bash +# Run all files +yarn karma-start +# Run specific spec files +yarn karma-start profile/account/components/update_username_spec.js +# Run specific spec folder +yarn karma-start profile/account/components/ +# Run all specs in vue_shared and vue_mr_widget +yarn karma-start /vue_shared/ /vue_mr_widget/ +``` + ## RSpec feature integration tests Information on setting up and running RSpec integration tests with @@ -176,7 +190,7 @@ Information on setting up and running RSpec integration tests with Similar errors will be thrown if you're using JavaScript features not yet supported by the PhantomJS test runner which is used for both Karma and RSpec -tests. We polyfill some JavaScript objects for older browsers, but some +tests. We polyfill some JavaScript objects for older browsers, but some features are still unavailable: - Array.from @@ -188,7 +202,7 @@ features are still unavailable: - Symbol/Symbol.iterator - Spread -Until these are polyfilled appropriately, they should not be used. Please +Until these are polyfilled appropriately, they should not be used. Please update this list with additional unsupported features. ### RSpec errors due to JavaScript @@ -223,7 +237,7 @@ end ### Spinach errors due to missing JavaScript NOTE: **Note:** Since we are discouraging the use of Spinach when writing new -feature tests, you shouldn't ever need to use this. This information is kept +feature tests, you shouldn't ever need to use this. This information is kept available for legacy purposes only. In Spinach, the JavaScript driver is enabled differently. In the `*.feature` |