Running ruby tests from IntelliJ fails because of teamcity formatter

已回答

Hi,

I'm using IntelliJ (2023.3.4) with the ruby plugin, and have a vagrant env setup, and the ruby inside that vagrant as the project's SDK.

When I try to run any test using IntelliJ's run command, I get an error: Unable to load any of [MysqlClient::Adapters::MysqlGem, MysqlClient::Adapters::Mysql2Gem]

If I copy the same command that IntelliJ is running (/vagrant/.rbenv/linux-2.6-libc-2.5-x86_64/versions/2.5.1/bin/ruby /vagrant/.rbenv/linux-2.6-libc-2.5-x86_64/versions/2.5.1/bin/rspec /vagrant/puppet/modules/postgres/spec/integration/import-export/import_tables_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter
) and run it manually inside the vagrant machine, I get the same error, however, if I remove the require and format parts, the test runs fine.

Is there any way to configure IntelliJ to not add that require and formatter? Or alternatively, figure out how to overcome this issue with the formatter? I do not want to install a different mysql gem in that vagrant machine, since it is replicating a production machine.

 

Thanks,
Ofer

0

Hello,

There's no way to remove that from the command being run, but it should not fail with MySQL error. Is your project open source so that it's possible to try to reproduce the problem?

0

Thanks for the reply.

No, my project is closed source. I'm not sure if mysql is directly connected. It might be required somewhere in one of the helper classes we have, but it's not directly used in the test I'm running here. BTW, this happens with multiple files. Also, the tests we have that do need mysql, pass without a problem when we run them normally without the formatter.

0

Ofer Zelichover it seems that the problem you're facing is project specific, but it's hard to say which particular part causes it. Could you please take a look at our sample project and change it so that it looks like yours and you get the same behaviour there?

0

I will try when I have some time, but I doubt I'll be able to reproduce it. The project I'm working on is very large and also uses an old ruby version.

It would be nice if it were just possible to turn off the formatter.

0

As a workaround you can try creating a corresponding Gem command Run configuration with the necessary parameters. 

0

请先登录再写评论。