Codium-ai / codiumai-jetbrains-release

59 stars 9 forks source link

Test generation is ignoring option "Test Framework" #103

Closed Portur closed 11 months ago

Portur commented 1 year ago

If you highlight a piece of code and select "generate tests" the window will open and you can select "Test Framework" and enable "Auto-Mock" for Jest, Mocha, Vitest, etc...

All generated tests keep generating Jest examples. Whether I select Vitest or Mocha.

Even after giving "Reference test examples" that use vi.mock or someFunctionMock.mockImplementationOnce it keeps generating jest.fn().mockResolvedValue(...) in the results.


Build info

IntelliJ IDEA 2023.2.1 (Ultimate Edition) Build #IU-232.9559.62, built on August 23, 2023

Runtime version: 17.0.8+7-b1000.8 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.5.1 GC: G1 Young Generation, G1 Old Generation Memory: 4048M Cores: 10 Metal Rendering is ON Registry: ide.experimental.ui=true

Kotlin: 232-1.9.0-IJ9559.62

┆Issue is synchronized with this Trello card by Unito

Portur commented 1 year ago

Seems the same is happening in VSCode.

Results like this below where sinon is not defined anywhere. Not sure what sinon is supposed to be here:

// Stub the knex insert method to return the newPlace mock
      const knexStub = sinon.stub(placesDBMock.knex, "insert").returns({
        into: sinon.stub().returns({
          onConflict: sinon.stub().returns({
            merge: sinon.stub().returns({
              returning: sinon.stub().returns([newPlace]),
            }),
          }),
        }),
      });
almog-lv commented 1 year ago

Hello @Portur have you clicked on the "regenerate" button after you select all your configurations?

Portur commented 1 year ago

Yes, I went through a few attempts clicking regenerate to test or force vitest, with no luck

almog-lv commented 1 year ago

@oranshiner can you please take a look?

DedyKredo commented 1 year ago

Thanks for reporting @Portur!

Can you please share your request ID for an example when this occurs?

Screen Shot 2023-09-08 at 15 15 12

@mrT23 FYI

ArtsiomCh commented 1 year ago

Just checked and Mocha test framework is remembered between requests for invocation either from selection or from inlays for JS/TS languages. @Portur could you please reproduce the issue? And if so could you share any piece of code the issue is reproduceable, please?

ArtsiomCh commented 11 months ago

Seems like we fixed it in latest versions, please feel free to report if experience it again!