https://github.com/smacker/karma-jasmine-expect-jsx
A Karma plugin. Adds toEqualJSX matcher for the Jasmine BDD JavaScript testing library.
https://github.com/smacker/karma-jasmine-expect-jsx
Last synced: about 1 year ago
JSON representation
A Karma plugin. Adds toEqualJSX matcher for the Jasmine BDD JavaScript testing library.
- Host: GitHub
- URL: https://github.com/smacker/karma-jasmine-expect-jsx
- Owner: smacker
- Created: 2015-12-08T05:42:04.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-27T16:44:57.000Z (over 8 years ago)
- Last Synced: 2025-04-18T20:50:05.065Z (about 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# karma-jasmine-expect-jsx
> A [Karma](http://karma-runner.github.io/) plugin to inject [jasmine-expect-jsx](https://github.com/smacker/jasmine-expect-jsx) for [Jasmine](http://jasmine.github.io/).
## Installation
### npm
```bash
npm install karma-jasmine-expect-jsx --save-dev
```
## Integration
### Karma
Just include `'jasmine-expect-jsx'` in the `frameworks` section of your config.
If you want colored output add `'jasmine-expect-jsx'` in reporters section before others.
```javascript
module.exports = function(config) {
config.set({
frameworks: [
'jasmine',
'jasmine-expect-jsx'
],
reporters: [
'jasmine-expect-jsx',
'spec'
],
files: [
'src/**/*.js',
'src/**/*.spec.js'
]
});
};
```
## Usage
The following tests are all passing:
```javascript
class TestComponent extends React.Component {}
// equalJSX
expect(
).toEqualJSX();
expect().toEqualJSX();
expect(
).not.toEqualJSX();
expect().not.toEqualJSX();
// includeJSX
expect(
Hello World!).toIncludeJSX(Hello World!);
expect().toIncludeJSX(); // assuming is rendered by TestComponent's render
expect(
Hello World!).not.toIncludeJSX(Hello World!);
expect().not.toIncludeJSX(); // assuming is not rendered by TestComponent's render
```