Skip to content

Commit

Permalink
Chore/upgrade to jest3 (#366)
Browse files Browse the repository at this point in the history
* setup jest 3, removed roblox-jest, ported tests in modules/react to jest 3

* port react-cache & react-devtools-extensions tests + some react-devtools-shared tests

* port ReactDevtoolsShared tests and introduce setupFiles for individual projects

* port react-reconciler tests (except one)

* port shared tests

* port scheduler tests

* port roact-compat tests

* fix: toggle fakeTimers individually in react suspense internal

* port react-test-renderer tests

* port react-shallow-renderer tests

* react-roblox tests

* port react-roblox client tests

* chore: stylua

* fix static analysis

* fix tests in release mode

* fix: ModuleScript could not be converted to string

* fix: update tests action

* fix: use model.rbxm instead of model.rbxmx

* Revert waitForEvents removal

* add mock scheduler flag to deferred tests action

* fix: no waitforevents?

* re-enable waitForEvents() again and increase max re-entrance depth

* fix: do not update snapshot, enable CI flag

* fix: max reentrancy depth to 65

* fix: delete obsolete snapshot

* fix: added missing parameters to code-coverage.yml

* fix code-coverage.yml

* fix: re-enable commented out test

* refactor: removed unnecessary workaround

* fix: uncomment test definition in order not to comment out beforeEach

* fix: removed increased test timeouts

* fix: proper comment on testSetupFile

* fix: unskip test suite, reenable fake timers in devtools-integration test

* fix: remove compat_warnings flag from tests in release mode
  • Loading branch information
RoFlection Bot committed Jan 23, 2023
1 parent 991e97e commit 939c239
Show file tree
Hide file tree
Showing 177 changed files with 49,600 additions and 54,670 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sourcemap.json
rotriever.lock
Packages/*
!Packages/.robloxrc
Expand Down
2 changes: 1 addition & 1 deletion Packages/.robloxrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"lint": {
"*": "disabled"
}
}
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ Projects not in the upstream React repo:
| Project | Description | Notes |
| - | - | - |
| 📌`react-shallow-renderer` | Shallow renderer used in tests for some older React features. Re-exported alongside `react-test-renderer`, source of truth [here](https://github.com/NMinhNguyen/react-shallow-renderer). | ✔️ Ported - with tests that are helping us exercise functionality in the `react` package |
| `roblox-jest` | Custom matchers and timer logic for Jest-Roblox| A rough approximation of what will eventually be provided in the [`jest` alignment effort](https://github.com/Roblox/jest-roblox) |
| `react-roblox` | Based on react-dom renderer, shares much of its code and public interface.| Also exports [`act()`](https://github.com/threepointone/react-act-examples/blob/master/sync.md) functionality, which is *required* for testing components that are asynchronously rendered (the default). |
| `roact-compat` | A comaptibility layer that emulates some deprecated behaviors of legacy Roact | Meant to ease initial adoption of Roact 17, using React APIs directly is encouraged and necessary for newer functonality (eg Hooks) |

Expand Down
24 changes: 24 additions & 0 deletions WorkspaceStatic/jest.config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local Workspace = script.Parent

-- In case we need to specify a custom testSetupFile for a project, we need to do that in in a separate jest.config.lua file that's in the project's root folder.
-- Therefore we specify the project here and provide it to the "projects" field in this config file.
-- We also need to add the project to the "testPathIgnorePatterns" field so that Jest doesn't try to run the project's tests again.
local projectsWithCustomJestConfig = {
Workspace.ReactDevtoolsShared.ReactDevtoolsShared,
}
local testPathIgnorePatterns = {}
local allProjects = { Workspace }

for _, project in projectsWithCustomJestConfig do
table.insert(testPathIgnorePatterns, project)
table.insert(allProjects, project)
end

return {
setupFilesAfterEnv = { Workspace.jest.testSetupFile },
projects = allProjects,
testMatch = {
"**/__tests__/*.(spec|test)",
},
testPathIgnorePatterns = testPathIgnorePatterns,
}
Loading

0 comments on commit 939c239

Please sign in to comment.