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

Support jest-environment directive #46

Merged
merged 2 commits into from
Feb 27, 2023
Merged

Support jest-environment directive #46

merged 2 commits into from
Feb 27, 2023

Conversation

CalebAlbers
Copy link
Member

🛠️ Description

From an internal report:


Our JS testing library, jest, has a feature to specify a test environment per-file using a comment at the top, like this:

/**
 * @jest-environment jsdom
 */

Per the docs, the heuristic here is:

Any docblock pragmas in test files will be passed to the environment constructor and can be used for per-test configuration.

What's happening is that when the copyright header is added to the top of the file, it takes the place of the existing docblock and the jest-environment specification isn't respected:

/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: MPL-2.0
 */

/**
 * @jest-environment jsdom
 */

Given that the @jest-environment directive needs to be in the first docblock, this PR adds support for inline docblocks specifically using the @jest-environment directive.

🔗 External Links

https://hashicorp.atlassian.net/browse/ENGSYS2-601

👍 Definition of Done

  • New functionality works?
  • Tests added?

🤔 Can be merged upon approval?

@CalebAlbers CalebAlbers requested a review from a team February 27, 2023 18:06
Copy link

@BRKalow BRKalow left a comment

Choose a reason for hiding this comment

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

💯

Copy link
Contributor

@dlaguerta dlaguerta left a comment

Choose a reason for hiding this comment

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

🚀 thank you!

@dlaguerta dlaguerta merged commit 7e4c65c into main Feb 27, 2023
@dlaguerta dlaguerta deleted the ENGSYS2-601 branch February 27, 2023 20:13
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

Successfully merging this pull request may close these issues.

None yet

3 participants