Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something strange is going with chai.use() #1213

Closed
shapovalvladislav opened this issue Nov 29, 2018 · 1 comment
Closed

Something strange is going with chai.use() #1213

shapovalvladislav opened this issue Nov 29, 2018 · 1 comment

Comments

@shapovalvladislav
Copy link

Hi
I've got two files:
test1.js
'use strict';
const chai = require('chai');
chai.use(require('chai-things'));

test2.js
'use strict';

const chai = require('chai'),
expect = chai.expect;
chai.use(require('chai-like'));
chai.use(require('chai-things'));

describe('Test', function() {
it('test', function() {
expect([{test: 'test'}]).to.be.an('array')
.that.contains.something.like({ test: 'test' });
});
});

Try to execute each file:
mocha test1.js 0 passing (1ms)

mocha test2.js Test ✓ test 1 passing (7ms)

Everything is ok. Now let's try to run both files:
mocha test1.js test2.js

Test
1) test

0 passing (8ms)
1 failing

  1. Test
    test:
    AssertionError: expected { test: 'test' } to be like { test: 'test' }

If you add chai.use(require('chai-like')); to the test1.js the issue disappears:
test1.js
'use strict';

const chai = require('chai');

chai.use(require('chai-like'));
chai.use(require('chai-things'));

Run tests:
mocha test1.js test2.js

Test
✓ test

1 passing (8ms)

chai 4.2.0
chai-things 0.2.0
chai-like 1.1.1

@shapovalvladislav
Copy link
Author

Looks like I've found the root of the issue. Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant