siddharth23 / cypress-postgres

Use this plugin to query Postgres database and use response in cypress tests
https://github.com/siddharth23/cypress-postgres
7 stars 10 forks source link

Task can't find configuration file when it is in a different folder #6

Open IzGiulio opened 3 years ago

IzGiulio commented 3 years ago

I'm using cypress-postgres together with Quasar. I want to have different configuration files in different folders but, when I try to run the tests, it says:

cy.task('dbQuery') failed with the following error:

Cannot find module '/../cypress.json'
Require stack:
- /.../node_modules/cypress-postgres/cypress/plugins/index.js
- /.../test/cypress/plugins/index.ts 

This is what I have inside my plugins/index.ts

const pluginConfig: Cypress.PluginConfig = (on, config) => {
    on('task', {
        dbQuery: (query) => {
            require('cypress-postgres')(query.query, query.connection)
        }
    })
}