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

Support for adding new adapter #14

Open
esteban-serfe opened this issue Oct 4, 2022 · 2 comments
Open

Support for adding new adapter #14

esteban-serfe opened this issue Oct 4, 2022 · 2 comments

Comments

@esteban-serfe
Copy link

esteban-serfe commented Oct 4, 2022

Hi:

I'm trying to add a new adapter for my specific setup.

I'm using database-js-mysql2 to be able to connect to the newest version for mysql 8 which is not compatible with the MySQL adapter.

I've created the package, it works and tests works as expected.

I've installed it and get the following error:

Cannot read properties of undefined (reading 'setStatus')

With the following connection string: mysql2://root:rootpwd@localhost/qblite

is there anything else I need to configure so the new driver is accepted?

I'm using this functions inside a helper.

@thiagodp
Copy link
Owner

thiagodp commented Oct 6, 2022

Hi @esteban-serfe,

thank you for providing a new MySQL driver for database-js. I'll list it in the project's page soon.

Your package should work without configuring anything. I couldn't determine the reason from the given error message. The method setStatus isn't in the codeceptjs-dbhelper's source code. Could you get the stack trace?

@esteban-serfe
Copy link
Author

Hi @thiagodp
I'll try to recreate this with a simple test case and post the code for you to see.
I could not have a stack trace of this with --debug or other flags on the error.

I'm using it right now inside the helper with the following code and works without any issue:

async runQuery( query )
  {
    const { DbHelper } = this.helpers;
    await DbHelper.connect("test", "mysql2://root:rootpwd@localhost/qblite" );
    let result = await DbHelper.query("test", query );
    await DbHelper.removeConnection("test"); 
    return result;
  }

I think that the error might be triggered by trying to use this directly in the Actor class (steps_file.js) directly. My initial code was something like:

module.exports = function() {
  return actor({
    runQuery: function( query ) {
        await DbHelper.connect("test", "mysql2://root:rootpwd@localhost/qblite" );
        let result = await DbHelper.query("test", query );
        await DbHelper.removeConnection("test"); 
         return result;
    }

.....more code....
  }); 
}

Let me know if you have any questions.

I'll be submitting a request for adding also withint the database-js repository.

Regards

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

2 participants