Skip to content

Commit 49d6135

Browse files
danpeenzhoushaw
andauthored
feat(module-federation/bridge): Enhance Bridge capabilities and fix some issues (#2792)
Co-authored-by: Zhou xiao <[email protected]>
1 parent 6027d80 commit 49d6135

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+6974
-9669
lines changed

.changeset/good-bobcats-refuse.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@module-federation/bridge-react-webpack-plugin': patch
3+
'@module-federation/bridge-shared': patch
4+
'@module-federation/bridge-react': patch
5+
'@module-federation/bridge-vue3': patch
6+
---
7+
8+
feat(@module-federation/bridge): enhance Bridge capabilities and fix some issues

.github/workflows/build-and-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,8 @@ jobs:
7171
needs: checkout-install
7272
uses: ./.github/workflows/e2e-modern-ssr.yml
7373
secrets: inherit
74+
75+
e2e-router:
76+
needs: checkout-install
77+
uses: ./.github/workflows/e2e-router.yml
78+
secrets: inherit

.github/workflows/e2e-router.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# .github/workflows/e2e-router-host-2000.yml
2+
name: E2E Test for Router
3+
4+
on:
5+
workflow_call:
6+
7+
jobs:
8+
e2e-runtime:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Repository
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Install Pnpm
17+
run: corepack enable
18+
19+
- name: Setup Node.js 18
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '18'
23+
cache: 'pnpm'
24+
25+
- name: Set Nx SHA
26+
uses: nrwl/nx-set-shas@v3
27+
28+
- name: Set SKIP_DEVTOOLS_POSTINSTALL environment variable
29+
run: echo "SKIP_DEVTOOLS_POSTINSTALL=true" >> $GITHUB_ENV
30+
31+
- name: Install Dependencies
32+
run: pnpm install
33+
34+
- name: Install Cypress
35+
run: npx cypress install
36+
37+
- name: Run Build for All
38+
run: npx nx run-many --targets=build --projects=tag:type:pkg
39+
40+
- name: Run condition check script
41+
id: check-ci
42+
run: node tools/scripts/ci-is-affected.mjs --appName=router-host-2000,router-host-v5-2200,router-host-vue3-2100,router-remote1-2001,router-remote2-2002,router-remote3-2003,router-remote4-2004
43+
44+
- name: E2E Test for Runtime Demo
45+
if: steps.check-ci.outcome == 'success'
46+
run: npx kill-port --port 2000,2001,2002,2003,2004,2200,2100 && pnpm run app:router:dev & echo "done" && sleep 20 && npx nx run-many --target=test:e2e --projects=router-host-2000 --parallel=1 && lsof -ti tcp:2000,2001,2002,2003,2004,2200,2100 | xargs kill

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"diffEditor.wordWrap": "on"
2+
"diffEditor.wordWrap": "on",
3+
"editor.rename.enablePreview": false
34
}

apps/router-demo/router-host-2000/CHANGELOG.md

Lines changed: 0 additions & 121 deletions
This file was deleted.
File renamed without changes.

apps/router-demo/router-host-2000/cypress/e2e/memory-router.cy.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getH2, getH3, wait2s } from '../support/app.po';
1+
import { getH2, getP, getPre } from '../support/app.po';
22

33
describe('router-host-2000/', () => {
44
beforeEach(() => cy.visit('/'));
@@ -17,6 +17,7 @@ describe('router-host-2000/memory-router', () => {
1717
});
1818

1919
describe('memory-router', () => {
20+
Cypress.on('uncaught:exception', () => false);
2021
it('remote1', () => {
2122
getH2().contains('Remote1 home page');
2223
cy.get('.self-remote1-detail-link').click();
@@ -28,9 +29,9 @@ describe('router-host-2000/memory-router', () => {
2829
getH2().contains('Remote2 home page');
2930
});
3031
it('remote3', () => {
31-
getH2().contains('Remote3 detail page');
32-
cy.get('.self-remote3-home-link').click();
3332
getH2().contains('Remote3 home page');
33+
cy.get('.self-remote3-detail-link').click();
34+
getH2().contains('Remote3 detail page');
3435
});
3536
});
3637
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { getPre, getP } from '../support/app.po';
2+
3+
describe('router-remote-error in host', () => {
4+
beforeEach(() => cy.visit('/'));
5+
describe('Remote Error render and will trigger ErrorBoundary', () => {
6+
Cypress.on('uncaught:exception', () => false);
7+
it('jump to remote error page', () => {
8+
cy.get('.host-menu > li:nth-child(7)').click();
9+
getP().contains('Something went wrong');
10+
getPre().contains('This is a deliberately thrown error');
11+
});
12+
});
13+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { wait5s, getP, getPre } from '../support/app.po';
2+
3+
describe('router-remote-error in host', () => {
4+
beforeEach(() => cy.visit('/'));
5+
6+
describe('Remote Resource Error render and will trigger ErrorBoundary', () => {
7+
Cypress.on('uncaught:exception', () => false);
8+
it('jump to remote error page', async () => {
9+
cy.get('.host-menu > li:nth-child(8)').click();
10+
11+
cy.get('[data-test-id="loading"]').should('have.length', 1);
12+
cy.get('[data-test-id="loading"]')
13+
.first()
14+
.should('have.text', 'loading...');
15+
16+
await wait5s();
17+
getP().contains('Something went wrong');
18+
getPre().contains(
19+
'Error: The request failed three times and has now been abandoned',
20+
);
21+
});
22+
});
23+
});
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getH2, getH3, wait2s } from '../support/app.po';
1+
import { getH2, getH3, getH4, wait2s } from '../support/app.po';
22

33
describe('router-remote1-2001/', () => {
44
beforeEach(() => cy.visit('http://localhost:2001/'));
@@ -12,17 +12,21 @@ describe('router-remote1-2001/', () => {
1212
});
1313
});
1414

15-
// describe('router-remote1-2001 in host', () => {
16-
// beforeEach(() => cy.visit('/'));
15+
describe('router-remote1-2001 in host', () => {
16+
beforeEach(() => cy.visit('/'));
1717

18-
// describe('Remote1 render and destroy', () => {
19-
// it('jump to remote1 home page', () => {
20-
// cy.get('.host-menu > li:nth-child(3)').click();
21-
// cy.get('.menu-remote1-home-link').click();
18+
describe('Remote1 render and destroy', () => {
19+
it('jump to remote1 home page', () => {
20+
cy.get('.host-menu > li:nth-child(3)').click();
21+
cy.get('.menu-remote1-home-link').click();
2222

23-
// getH2().contains('Remote1 home page');
24-
// cy.get('.menu-remote1-detail-link').click();
25-
// getH2().contains('Remote1 detail page');
26-
// });
27-
// });
28-
// });
23+
getH2().contains('Remote1 home page');
24+
getH3().contains('Ming');
25+
getH3().contains('12');
26+
getH4().contains('Some text');
27+
28+
cy.get('.menu-remote1-detail-link').click();
29+
getH2().contains('Remote1 detail page');
30+
});
31+
});
32+
});

0 commit comments

Comments
 (0)