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

Fix vitest files resolving #845

Merged
merged 2 commits into from
Jan 18, 2024
Merged

Fix vitest files resolving #845

merged 2 commits into from
Jan 18, 2024

Conversation

epszaw
Copy link
Member

@epszaw epszaw commented Jan 18, 2024

Context

Checklist

@epszaw epszaw added type:bug Something isn't working theme:vitest labels Jan 18, 2024
@epszaw epszaw requested a review from baev January 18, 2024 14:33
@baev baev merged commit 0882050 into master Jan 18, 2024
7 checks passed
@baev baev deleted the fix-vitest branch January 18, 2024 14:46
@@ -27,82 +28,87 @@ const injectAllureMeta = (context: vitest.TaskContext) => {
};
};

export const label = (context: vitest.TaskContext, name: string, value: string) => {
export const label = async (context: vitest.TaskContext, name: string, value: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Do you have some plans adding async code here in the future?

I can understand it for steps and attachments, but not much for labels.

There is a hidden issue that a missing await now may attach a label to an incorrect test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to provide async API for all the Allure methods for all the Allure integrations. The main reason is that we're currently working on a single Allure Facade, exposed by commons, that all the frameworks will implement.

That will allow us to create second-level integrations, e.g. with tools like Axios. There is an issue with such integrations right now since it should know what AllureApi to use to add an attachment.

So, the solution would be a single Facade, similar to how it's implemented for other languages:

const { allure } from "allure-js-commons";

it("it could be any test framework", async() => {
  await allure.step(...);
});

Having this in mind, should AllureFacade be async or not? It should, at least for the step and attachment API. For some frameworks (hi, playwright), the bus we use to communicate from the worker process to the main (reporter) process is asynchronous by design, so all the Allure methods are asynchronous.

We don't like to have this difference between different frameworks, nor do we want to support both async and non-async APIs.

That's why we decided to have all the Allure API methods async.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:vitest type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants