-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove react-hot-loader (#29540)
- Loading branch information
Showing
30 changed files
with
162 additions
and
404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 17 additions & 19 deletions
36
...ts/development-runtime/cypress/integration/eslint-rules/limited-exports-page-templates.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
if (Cypress.env("HOT_LOADER") === `fast-refresh`) { | ||
describe(`limited-exports-page-templates`, () => { | ||
// Skipped because HMR not show warnings because of https://github.com/webpack-contrib/webpack-hot-middleware/pull/397 | ||
it.skip(`should log warning to console for invalid export`, () => { | ||
cy.visit(`/eslint-rules/limited-exports-page-templates`, { | ||
onBeforeLoad(win) { | ||
cy.stub(win.console, "log").as(`consoleLog`) | ||
}, | ||
}).waitForRouteChange() | ||
describe(`limited-exports-page-templates`, () => { | ||
// Skipped because HMR not show warnings because of https://github.com/webpack-contrib/webpack-hot-middleware/pull/397 | ||
it.skip(`should log warning to console for invalid export`, () => { | ||
cy.visit(`/eslint-rules/limited-exports-page-templates`, { | ||
onBeforeLoad(win) { | ||
cy.stub(win.console, "log").as(`consoleLog`) | ||
}, | ||
}).waitForRouteChange() | ||
|
||
cy.get(`@consoleLog`).should( | ||
`be.calledWithMatch`, | ||
/15:1 warning In page templates only a default export of a valid React component and the named export of a page query is allowed./i | ||
) | ||
cy.get(`@consoleLog`).should( | ||
`not.be.calledWithMatch`, | ||
/17:1 warning In page templates only a default export of a valid React component and the named export of a page query is allowed./i | ||
) | ||
}) | ||
cy.get(`@consoleLog`).should( | ||
`be.calledWithMatch`, | ||
/15:1 warning In page templates only a default export of a valid React component and the named export of a page query is allowed./i | ||
) | ||
cy.get(`@consoleLog`).should( | ||
`not.be.calledWithMatch`, | ||
/17:1 warning In page templates only a default export of a valid React component and the named export of a page query is allowed./i | ||
) | ||
}) | ||
} | ||
}) |
50 changes: 24 additions & 26 deletions
50
...velopment-runtime/cypress/integration/eslint-rules/no-anonymous-exports-page-templates.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
if (Cypress.env("HOT_LOADER") === `fast-refresh`) { | ||
describe(`no-anonymous-exports-page-templates`, () => { | ||
// Skipped because HMR not show warnings because of https://github.com/webpack-contrib/webpack-hot-middleware/pull/397 | ||
it.skip(`should log warning to console for arrow functions`, () => { | ||
cy.visit(`/eslint-rules/no-anonymous-exports-page-templates`, { | ||
onBeforeLoad(win) { | ||
cy.stub(win.console, "log").as(`consoleLog`) | ||
}, | ||
}).waitForRouteChange() | ||
describe(`no-anonymous-exports-page-templates`, () => { | ||
// Skipped because HMR not show warnings because of https://github.com/webpack-contrib/webpack-hot-middleware/pull/397 | ||
it.skip(`should log warning to console for arrow functions`, () => { | ||
cy.visit(`/eslint-rules/no-anonymous-exports-page-templates`, { | ||
onBeforeLoad(win) { | ||
cy.stub(win.console, "log").as(`consoleLog`) | ||
}, | ||
}).waitForRouteChange() | ||
|
||
cy.get(`@consoleLog`).should( | ||
`be.calledWithMatch`, | ||
/Anonymous arrow functions cause Fast Refresh to not preserve local component state./i | ||
) | ||
}) | ||
it.skip(`should log warning to console for function declarations`, () => { | ||
cy.visit(`/eslint-rules/no-anonymous-exports-page-templates-function`, { | ||
onBeforeLoad(win) { | ||
cy.stub(win.console, "log").as(`consoleLog`) | ||
}, | ||
}).waitForRouteChange() | ||
cy.get(`@consoleLog`).should( | ||
`be.calledWithMatch`, | ||
/Anonymous arrow functions cause Fast Refresh to not preserve local component state./i | ||
) | ||
}) | ||
it.skip(`should log warning to console for function declarations`, () => { | ||
cy.visit(`/eslint-rules/no-anonymous-exports-page-templates-function`, { | ||
onBeforeLoad(win) { | ||
cy.stub(win.console, "log").as(`consoleLog`) | ||
}, | ||
}).waitForRouteChange() | ||
|
||
cy.get(`@consoleLog`).should( | ||
`be.calledWithMatch`, | ||
/Anonymous function declarations cause Fast Refresh to not preserve local component state./i | ||
) | ||
}) | ||
cy.get(`@consoleLog`).should( | ||
`be.calledWithMatch`, | ||
/Anonymous function declarations cause Fast Refresh to not preserve local component state./i | ||
) | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
e2e-tests/development-runtime/cypress/integration/hot-reloading/hooks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 14 additions & 2 deletions
16
e2e-tests/development-runtime/cypress/integration/hot-reloading/non-js-file.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
const TEMPLATE = `SUB_TITLE` | ||
const TEST_ID = `sub-title` | ||
const message = `This is a sub-title` | ||
|
||
describe(`hot reloading non-js file`, () => { | ||
beforeEach(() => { | ||
cy.exec( | ||
`npm run update -- --file content/2018-12-14-hello-world.md --replacements "${message}:%${TEMPLATE}%" --exact` | ||
) | ||
cy.wait(1000) | ||
|
||
cy.visit(`/2018-12-14-hello-world/`).waitForRouteChange() | ||
|
||
cy.wait(1000) | ||
}) | ||
|
||
it(`displays placeholder content on launch`, () => { | ||
cy.getTestElement(TEST_ID).invoke(`text`).should(`contain`, TEMPLATE) | ||
}) | ||
|
||
it.skip(`hot reloads with new content`, () => { | ||
const message = `This is a sub-title` | ||
it(`hot reloads with new content`, () => { | ||
cy.getTestElement(TEST_ID).invoke(`text`).should(`contain`, TEMPLATE) | ||
|
||
cy.exec( | ||
`npm run update -- --file content/2018-12-14-hello-world.md --replacements "${TEMPLATE}:${message}"` | ||
) | ||
|
||
// wati for socket.io to update | ||
cy.wait(5000) | ||
|
||
cy.getTestElement(TEST_ID).invoke(`text`).should(`eq`, message) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.