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

Configurable vitest config #12

Open
krivachy opened this issue Jun 14, 2022 · 3 comments
Open

Configurable vitest config #12

krivachy opened this issue Jun 14, 2022 · 3 comments

Comments

@krivachy
Copy link

krivachy commented Jun 14, 2022

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?

@linux-china
Copy link
Owner

linux-china commented Jun 15, 2022

@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?

@kclay
Copy link

kclay commented Aug 18, 2022

@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.

@windylaugit
Copy link

@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: #30 (comment)

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

4 participants