Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/dull-heads-fall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@lynx-js/react": patch
"@lynx-js/test-environment": patch
"create-rspeedy": patch
---

Add testing library for ReactLynx
5 changes: 5 additions & 0 deletions .changeset/yellow-wasps-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/qrcode-rsbuild-plugin": patch
---

Fix the issue where QR code fails to print after initial compilation errors are fixed.
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ jobs:
cd create-rspeedy-regression
pnpm install --registry=http://localhost:4873
pnpm run build
npx --registry http://localhost:4873 create-rspeedy-canary@latest --template react-vitest-rltl --dir create-rspeedy-regression-vitest-rltl
cd create-rspeedy-regression-vitest-rltl
pnpm install --registry=http://localhost:4873
pnpm run build
pnpm run test
test-tools:
needs: build
uses: ./.github/workflows/workflow-test.yml
Expand All @@ -170,6 +175,26 @@ jobs:
--no-cache
--logHeapUsage
--silent
test-testing-library:
needs: build
uses: ./.github/workflows/workflow-test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
runs-on: lynx-ubuntu-24.04-medium
run: >
pnpm run test
--project 'react/testing-library'
--project 'testing-library/*'
--test-timeout=50000
--reporter=github-actions
--reporter=dot
--reporter=junit
--outputFile=test-report.junit.xml
--coverage
--no-cache
--logHeapUsage
--silent
test-type:
needs: build
uses: ./.github/workflows/workflow-test.yml
Expand Down Expand Up @@ -247,6 +272,7 @@ jobs:
- test-rust
- test-rspeedy
- test-tools
- test-testing-library
- test-type
- website
- zizmor
Expand Down
3 changes: 3 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
"packages/web-platform/**",

"packages/third-party/**",

"packages/testing-library/**",
"packages/react/testing-library/**",
],
"rules": {
// We are migrating from ESLint to Biome
Expand Down
16 changes: 16 additions & 0 deletions cspell.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@
"parseable", // https://pnpm.io/cli/list
"debugids", // https://getsentry.github.io/debugids/
"zizmor", // https://github.com/woodruffw/zizmor
"wvid",
"bindscroll",
"deinit",
"layoutchange", // the "layoutchange" event of Lynx
"longtap",
"bgload",
"bgerror",
"mouseclick",
"mousedblclick",
"mouselongpress",
"mouselongpress",
"contentsizechanged",
"scrolltoupperedge",
"scrolltoloweredge",
"scrolltonormalstate",
"rltl", // ReactLynx Testing Library
// lighthouse CI
"lhci",
"lh",
Expand Down
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export default tseslint.config(
// TODO: enable eslint for web-platform
// web-platform
'packages/web-platform/**',

// TODO: enable eslint for testing-library
// testing-library
'packages/testing-library/**',
'packages/react/testing-library/**',
],
},
js.configs.recommended,
Expand Down
16 changes: 16 additions & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@
"lazy": "./runtime/lazy/legacy-react-runtime.js",
"default": "./runtime/lib/legacy-react-runtime/index.js"
},
"./testing-library": {
"types": "./testing-library/types/index.d.ts",
"default": "./testing-library/dist/index.js"
},
"./testing-library/pure": {
"types": "./testing-library/types/pure.d.ts",
"default": "./testing-library/dist/pure.js"
},
"./testing-library/vitest-config": {
"types": "./testing-library/types/vitest-config.d.ts",
"default": "./testing-library/dist/vitest.config.js"
},
"./package.json": "./package.json"
},
"types": "./types/react.d.ts",
Expand Down Expand Up @@ -139,6 +151,7 @@
"types",
"docs",
"worklet-runtime",
"testing-library",
"CHANGELOG.md",
"internal.js",
"README.md",
Expand All @@ -151,8 +164,11 @@
"preact": "npm:@hongzhiyuan/[email protected]"
},
"devDependencies": {
"@lynx-js/test-environment": "workspace:*",
"@lynx-js/types": "^3.2.1",
"@microsoft/api-extractor": "catalog:",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@types/react": "^18.3.20"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/react/runtime/__test__/lifecycle.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ describe('useEffect', () => {
expect(callback).toHaveBeenCalledTimes(0);
expect(cleanUp).toHaveBeenCalledTimes(0);

expect(callback).toHaveBeenCalledTimes(0);
expect(mtCallbacks.mock.calls.length).toBe(1);
mtCallbacks.mock.calls[0][2]();
lynx.getNativeApp().callLepusMethod.mockClear();
expect(callback).toHaveBeenCalledTimes(0);
expect(callback).toHaveBeenCalledTimes(1);
expect(cleanUp).toHaveBeenCalledTimes(0);

await waitSchedule();
Expand Down
Loading