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

add a testTZ/testTimeZone config value like testURL but for setting a timezone tests should run in #9103

Closed
wldcordeiro opened this issue Oct 26, 2019 · 4 comments

Comments

@wldcordeiro
Copy link

wldcordeiro commented Oct 26, 2019

#8497 🚀 Feature Proposal

Motivation

Enforcing a consistent timezone in an easily configurable way just like setting a base URL.

Example

// in a jest.config.js
module.exports = {
  setupFilesAfterEnv: './setup.js',
  testTZ: 'America/Denver',
  testURL: 'http://localhost',
}

Pitch

Sometimes even with mocks you run into problems of you and another dev in another timezone producing different results because of your computer timezones. You could do something like TZ=foo jest as a workaround and put that in your package.json as well but then if you have a Windows user doing dev you now need something like cross-env to work around the variables.

@ide
Copy link
Contributor

ide commented Feb 10, 2021

As of Node 13+ you can set process.env.TZ in your globalSetup function (NB I haven't tried this on Windows).

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 1, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants