Cypress: How to install the plugin "Chai Sorted"

Created on 6 Sep 2018  路  2Comments  路  Source: cypress-io/cypress

Hello,

I don't know what I have to write on the plugins/index.js files to get the chai-sorted plugin working.

website : http://www.chaijs.com/plugins/chai-sorted/

Can you help please ? : )

Best regard

Most helpful comment

Your tests and chai run in the browser, so chai plugins need to be configured there instead of the plugins file, which is run in the background Node.js process.

I haven't tested this out, but the following should work if you add it to support/index.js:

import chaiSorted from "chai-sorted"

chai.use(chaiSorted)

We're working on improving the docs around extending Cypress, so we'll try to make this clearer in the process.

All 2 comments

Your tests and chai run in the browser, so chai plugins need to be configured there instead of the plugins file, which is run in the background Node.js process.

I haven't tested this out, but the following should work if you add it to support/index.js:

import chaiSorted from "chai-sorted"

chai.use(chaiSorted)

We're working on improving the docs around extending Cypress, so we'll try to make this clearer in the process.

@chrisbreiding solution worked like a charm for me installing chai-subset, thank you!

Was this page helpful?
0 / 5 - 0 ratings