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

migrate to something else now that karma is deprecated #440

Open
Trott opened this issue May 7, 2024 · 2 comments
Open

migrate to something else now that karma is deprecated #440

Trott opened this issue May 7, 2024 · 2 comments

Comments

@Trott
Copy link
Owner

Trott commented May 7, 2024

No description provided.

@screensaversclub
Copy link
Contributor

Tried jest, pretty much drop in at this point.

  1. Installed jest
  2. Simple change for setup and teardown hooks:
diff --git a/test/react-native.test.js b/test/react-native.test.js
index ccfb681..5a7c777 100644
--- a/test/react-native.test.js
+++ b/test/react-native.test.js
@@ -5,11 +5,11 @@ if (typeof window === 'undefined') {
   describe('React Native-like environment', function () {
     let slug

-    before(function () {
+    beforeEach(function () {
       global.window = {}
       delete require.cache[require.resolve('../slug')]
     })
-    after(function () {
+    afterEach(function () {
       delete global.window
       delete require.cache[require.resolve('../slug')]
     })
  1. Running jest at this point produces the following:
image

We could possibly migrate all assert functions to Jest's expect , which would allow us to remove a few devDependencies (https://jestjs.io/docs/migration-guide).

Here's a WIP:
main...screensaversclub:slug:jest-setup
(sorry about the formatting - I ran npx standard --fix so that the test would run. Will figure out how to preserve formatting if this refactor exercise looks like a go ahead)

@Trott
Copy link
Owner Author

Trott commented May 8, 2024

If I'm not mistaken, that looks like you're using jest to replace mocha, which we don't need. We need browser testing.

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

No branches or pull requests

2 participants