Skip to content

Support for adding new adapter #14

Description

@esteban-serfe

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.

Activity

  1. thiagodp commented on Oct 6, 2022

    @thiagodp
    Owner

    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?

  2. esteban-serfe commented on Oct 6, 2022

    @esteban-serfe
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions