vitest-jetbrains-plugin icon indicating copy to clipboard operation
vitest-jetbrains-plugin copied to clipboard

Configurable vitest config

Open krivachy opened this issue 3 years ago • 3 comments

Thanks for the plugin!

With jest we were able to provide a custom configuration file and custom arguments in the Run/Debug configurations.

Example: image

The use-case is that we would like to have two different vitest configs, one for unit tests and one for integration tests as they do different things (e.g. integration tests need more global setup + longer test timeouts + other things).

Is it possible to support this in the plugin as well?

krivachy avatar Jun 14 '22 19:06 krivachy

@krivachy Now Vitest Runner plugin does not use Run/Debug configurations to run test, and it uses CLI+Console to run Vitest. A solution is to tell the plugin choose Vitest config file to run tests, for example you should add vitest configurations in package.json.

 "vitest": {
    "configs": {
      "vitest-ci.config.ts": "tests/ci/**"
    }
  }

Do you have other suggestions to choose configs?

linux-china avatar Jun 15 '22 20:06 linux-china

@linux-china I'm having an issue with a mono repo.. I have both "workspaces" declared in the repo root package.json but I also have a project specs vitest.config.ts declared in the sub-project. But when a test on intergration.test.ts it doesn't pick up the project config but rather it picks up the root config.

.
├── package.json
├── vitest.config.ts
└── packages/
    └── my-project/
        ├── package.json
        ├── vitest.config.ts <- uses mergeConfig
        └── tests/
            └── intergration.test.ts

Looking at this line it seems that the logic should be reversed or atleast provide an option to force using the project config vs root when using workspaces.

kclay avatar Aug 18 '22 22:08 kclay

@linux-china I'm having an issue with a mono repo.. I have both "workspaces" declared in the repo root package.json but I also have a project specs vitest.config.ts declared in the sub-project. But when a test on intergration.test.ts it doesn't pick up the project config but rather it picks up the root config.

.
├── package.json
├── vitest.config.ts
└── packages/
    └── my-project/
        ├── package.json
        ├── vitest.config.ts <- uses mergeConfig
        └── tests/
            └── intergration.test.ts

Looking at this line it seems that the logic should be reversed or atleast provide an option to force using the project config vs root when using workspaces.

try this: https://github.com/linux-china/vitest-jetbrains-plugin/issues/30#issuecomment-1250483979

windylaugit avatar Sep 22 '22 05:09 windylaugit