Skip to content

Audits shouldn't require you to know the URL in order to generate the list of tests #24

Closed
@glasser

Description

@glasser

I would like to integrate the audits in my Jest test suite as shown in the README.

I don’t want to have a fixed port for my URL: I want to be able to listen on port 0 and get the URL back and pass that to the tests.

But I don’t want to actually start and listen on a server at the “top level” of a file, because I don't want it to run unless the particular tests are selected (eg, if it.only or the like disables this part of the test file, I don't want to start a server). So listening should go in beforeAll or beforeEach or something.

But you need to give Jest the list of tests before this code runs, and the API here only gives you the list of audit tests once you already have an URL.

It would work better if the url was an argument to fn instead, or if you can pass a function returning an URL or something.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestreleasedHas been released and published

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions