mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-05 14:09:46 -06:00
fix(cypress/webpack-dev-server): correct path for indexHtmlFile (#27320)
* fix: correct path for indexHtmlt * changelog
This commit is contained in:
@@ -20,6 +20,7 @@ _Released 07/20/2023_
|
||||
- Fixed an issue where commands would fail with the error `must only be invoked from the spec file or support file` if their arguments were mutated. Fixes [#27200](https://github.com/cypress-io/cypress/issues/27200).
|
||||
- Fixed an issue where `cy.writeFile()` would erroneously fail with the error `cy.writeFile() must only be invoked from the spec file or support file`. Fixes [#27097](https://github.com/cypress-io/cypress/issues/27097).
|
||||
- Fixed an issue where web workers could not be created within a spec. Fixes [#27298](https://github.com/cypress-io/cypress/issues/27298).
|
||||
- Fixed an issue where having `cypress.config` in a nested directory would cause problems with locating the `component-index.html` file when using component testing. Fixes [#26400](https://github.com/cypress-io/cypress/issues/26400).
|
||||
|
||||
## 12.17.1
|
||||
|
||||
|
||||
@@ -12,6 +12,17 @@ describe('Config options', () => {
|
||||
cy.get('.passed > .num').should('contain', 1)
|
||||
})
|
||||
|
||||
it('supports nested config', () => {
|
||||
cy.scaffoldProject('webpack-react-nested-config')
|
||||
cy.openProject('webpack-react-nested-config', ['--config-file', 'cypress/cypress.config.js'])
|
||||
cy.startAppServer('component')
|
||||
|
||||
cy.visitApp()
|
||||
cy.contains('foo.cy.js').click()
|
||||
cy.waitForSpecToFinish()
|
||||
cy.get('.passed > .num').should('contain', 1)
|
||||
})
|
||||
|
||||
it('supports @cypress/webpack-dev-server', () => {
|
||||
cy.scaffoldProject('webpack5_wds4-react')
|
||||
cy.openProject('webpack5_wds4-react', ['--config-file', 'cypress-webpack-dev-server-function.config.ts'])
|
||||
|
||||
@@ -78,7 +78,7 @@ export function makeCypressWebpackConfig (
|
||||
},
|
||||
plugins: [
|
||||
new (HtmlWebpackPlugin as typeof import('html-webpack-plugin-5'))({
|
||||
template: indexHtmlFile,
|
||||
template: indexHtmlFile ? path.join(projectRoot, indexHtmlFile) : undefined,
|
||||
// Angular generates all of it's scripts with <script type="module">. Live-reloading breaks without this option.
|
||||
// We need to manually set the base here to `/__cypress/src/` so that static assets load with our proxy
|
||||
...(framework === 'angular' ? { scriptLoading: 'module', base: '/__cypress/src/' } : {}),
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
const { devServer } = require('@cypress/webpack-dev-server')
|
||||
|
||||
module.exports = {
|
||||
component: {
|
||||
supportFile: false,
|
||||
devServer: (args) => {
|
||||
return devServer({ ...args, webpackConfig: {} })
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<div data-cy-root></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@cypress/webpack-dev-server": "file:../../../npm/webpack-dev-server",
|
||||
"webpack": "^5",
|
||||
"webpack-dev-server": "^4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
it('renders hello world', () => {
|
||||
expect(1).to.eq(1)
|
||||
})
|
||||
3203
system-tests/projects/webpack-react-nested-config/yarn.lock
Normal file
3203
system-tests/projects/webpack-react-nested-config/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user