Skip to content

Commit

Permalink
[fixusageoutsidejest] Allow import outside of jest (#1018)
Browse files Browse the repository at this point in the history
## Summary:
The `wait` function copied from Webapp verified that jest was in use at import. This worked when in webapp and it was just a file being imported, but now it's in Wonder Stuff Testing, it causes an error if any of the non-jest code is used outside of a jest environment, which is not what we want at all.

So, this removes that module level check, which in turn means Wonder Stuff Testing can be used in non-jest contexts, like stories.

See [Slack thread](https://khanacademy.slack.com/archives/CEA6W0F6F/p1707955461083099?thread_ts=1707867450.595019&cid=CEA6W0F6F) for more context, if you have access.

Issue: XXX-XXXX

## Test plan:
`yarn test`

Once published, we can update webapp and verify `dataFactoryFor` is usable within stories.

Author: somewhatabstract

Reviewers: somewhatabstract, jeresig, evanchaney, jeremywiebe

Required Reviewers:

Approved By: jeresig

Checks: ✅ Test (macos-latest, 20.x), ✅ codecov/project, ✅ CodeQL, ✅ Lint, typecheck, and coverage check (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Analyze (javascript), ✅ gerald, ⏭️  dependabot

Pull Request URL: #1018
  • Loading branch information
somewhatabstract authored Feb 15, 2024
1 parent d588332 commit 3277b69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-cobras-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/wonder-stuff-testing": patch
---

Allow Wonder Stuff Testing to be imported outside of jest
3 changes: 0 additions & 3 deletions packages/wonder-stuff-testing/src/jest/wait.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {verifyRealTimers} from "./internal/verify-real-timers";
import {unverifiedWait} from "./internal/unverified-wait";
import {assertJest} from "./internal/assert-jest";

assertJest();

type WaitOptions = {
/**
Expand Down

0 comments on commit 3277b69

Please sign in to comment.