Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthemanuel committed Mar 28, 2022
2 parents 2f862e8 + 30206af commit 5e93175
Show file tree
Hide file tree
Showing 18 changed files with 2,460 additions and 17 deletions.
7 changes: 7 additions & 0 deletions npm/webpack-dev-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [@cypress/webpack-dev-server-v1.8.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.2...@cypress/webpack-dev-server-v1.8.3) (2022-03-15)


### Bug Fixes

* **webpack-dev-server:** do not encodeUri in loader ([#20575](https://github.com/cypress-io/cypress/issues/20575)) ([1b152fc](https://github.com/cypress-io/cypress/commit/1b152fca1b9ed9894cf7a5b2a964c856f73fc685)), closes [#20593](https://github.com/cypress-io/cypress/issues/20593)

# [@cypress/webpack-dev-server-v1.8.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.1...@cypress/webpack-dev-server-v1.8.2) (2022-03-03)


Expand Down
2 changes: 1 addition & 1 deletion npm/webpack-dev-server/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const makeImport = (file: Cypress.Cypress['spec'], filename: string, chunkName:
const magicComments = chunkName ? `/* webpackChunkName: "${chunkName}" */` : ''

return `"${filename}": {
shouldLoad: () => document.location.pathname.includes("${encodeURI(file.absolute)}"),
shouldLoad: () => decodeURI(document.location.pathname).includes("${file.absolute}"),
load: () => import("${file.absolute}" ${magicComments}),
chunkName: "${chunkName}",
}`
Expand Down
108 changes: 93 additions & 15 deletions npm/webpack-dev-server/test/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { webpackDevServerFacts } from '../src/webpackDevServerFacts'

import { defineDevServerConfig, devServer, startDevServer } from '../'

const requestSpecFile = (port: number) => {
const requestSpecFile = (file: string, port: number) => {
return new Promise((res) => {
const opts = {
host: 'localhost',
port,
path: '/test/fixtures/foo.spec.js',
path: encodeURI(file),
}

const callback = (response: EventEmitter) => {
Expand Down Expand Up @@ -41,13 +41,15 @@ const webpackConfig = {

}

const specs: Cypress.Cypress['spec'][] = [
{
name: `${root}/test/fixtures/foo.spec.js`,
relative: `${root}/test/fixtures/foo.spec.js`,
absolute: `${root}/test/fixtures/foo.spec.js`,
},
]
const createSpecs = (name: string): Cypress.Cypress['spec'][] => {
return [
{
name: `${root}/test/fixtures/${name}`,
relative: `${root}/test/fixtures/${name}`,
absolute: `${root}/test/fixtures/${name}`,
},
]
}

const config = {
projectRoot: root,
Expand All @@ -62,12 +64,12 @@ describe('#startDevServer', () => {
webpackConfig,
options: {
config,
specs,
specs: createSpecs('foo.spec.js'),
devServerEvents: new EventEmitter(),
},
})

const response = await requestSpecFile(port as number)
const response = await requestSpecFile('/test/fixtures/foo.spec.js', port as number)

expect(response).to.eq('const foo = () => {}\n')

Expand All @@ -76,13 +78,89 @@ describe('#startDevServer', () => {
})
})

it('serves specs in directory with [] chars via a webpack dev server', async () => {
const { port, close } = await startDevServer({
webpackConfig,
options: {
config,
specs: createSpecs('[foo]/bar.spec.js'),
devServerEvents: new EventEmitter(),
},
})

const response = await requestSpecFile('/test/fixtures/[foo]/bar.spec.js', port as number)

expect(response).to.eq(`it('this is a spec with a path containing []', () => {})\n`)

return new Promise((res) => {
close(() => res())
})
})

it('serves specs in directory with non English chars via a webpack dev server', async () => {
const { port, close } = await startDevServer({
webpackConfig,
options: {
config,
specs: createSpecs('サイプレス.spec.js'),
devServerEvents: new EventEmitter(),
},
})

const response = await requestSpecFile('/test/fixtures/サイプレス.spec.js', port as number)

expect(response).to.eq(`it('サイプレス', () => {})\n`)

return new Promise((res) => {
close(() => res())
})
})

it('serves specs in directory with ... in the file name via a webpack dev server', async () => {
const { port, close } = await startDevServer({
webpackConfig,
options: {
config,
specs: createSpecs('[...bar].spec.js'),
devServerEvents: new EventEmitter(),
},
})

const response = await requestSpecFile('/test/fixtures/[...bar].spec.js', port as number)

expect(response).to.eq(`it('...bar', () => {})\n`)

return new Promise((res) => {
close(() => res())
})
})

it('serves a file with spaces via a webpack dev server', async () => {
const { port, close } = await startDevServer({
webpackConfig,
options: {
config,
specs: createSpecs('foo bar.spec.js'),
devServerEvents: new EventEmitter(),
},
})

const response = await requestSpecFile('/test/fixtures/foo bar.spec.js', port as number)

expect(response).to.eq(`it('this is a spec with a path containing a space', () => {})\n`)

return new Promise((res) => {
close(() => res())
})
})

it('emits dev-server:compile:success event on successful compilation', async () => {
const devServerEvents = new EventEmitter()
const { close } = await startDevServer({
webpackConfig,
options: {
config,
specs,
specs: createSpecs('foo.spec.js'),
devServerEvents,
},
})
Expand Down Expand Up @@ -137,7 +215,7 @@ describe('#startDevServer', () => {
webpackConfig,
options: {
config,
specs,
specs: createSpecs('foo.spec.js'),
devServerEvents,
},
})
Expand Down Expand Up @@ -172,13 +250,13 @@ describe('#startDevServer', () => {
const { port, close } = await devServer(
{
config,
specs,
specs: createSpecs('foo.spec.js'),
devServerEvents,
},
defineDevServerConfig({ webpackConfig }),
)

const response = await requestSpecFile(port as number)
const response = await requestSpecFile('/test/fixtures/foo.spec.js', port as number)

expect(response).to.eq('const foo = () => {}\n')

Expand Down
1 change: 1 addition & 0 deletions npm/webpack-dev-server/test/fixtures/[...bar].spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
it('...bar', () => {})
1 change: 1 addition & 0 deletions npm/webpack-dev-server/test/fixtures/[foo]/bar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
it('this is a spec with a path containing []', () => {})
1 change: 1 addition & 0 deletions npm/webpack-dev-server/test/fixtures/foo bar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
it('this is a spec with a path containing a space', () => {})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
it('サイプレス', () => {})
2 changes: 1 addition & 1 deletion packages/server/lib/controllers/iframes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const iframesController = {
// attach header data for webservers
// to properly intercept and serve assets from the correct src root
// TODO: define a contract for dev-server plugins to configure this behavior
req.headers.__cypress_spec_path = req.params[0]
req.headers.__cypress_spec_path = encodeURI(req.params[0])
req.url = `${config.devServerPublicPathRoute}/index.html`

// user the node proxy here instead of the network proxy
Expand Down
1 change: 1 addition & 0 deletions system-tests/projects/webpack-dev-server/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
it('...bar', () => {})
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('this test is in a directory with [] in the path', () => {
it('works great!', () => {
expect(1).to.eq(1)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('this test is in a file with space in the path', () => {
it('works great!', () => {
expect(1).to.eq(1)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
it('サイプレス', () => {})
10 changes: 10 additions & 0 deletions system-tests/projects/webpack-dev-server/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { startDevServer } = require('@cypress/webpack-dev-server')

module.exports = (on, config) => {
on('dev-server:start', (options) => {
return startDevServer({
options,
webpackConfig: {},
})
})
}
Empty file.
5 changes: 5 additions & 0 deletions system-tests/projects/webpack-dev-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"webpack": "^4"
}
}
Loading

10 comments on commit 5e93175

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/linux-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/win32-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/darwin-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.3/linux-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.3/win32-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.3/darwin-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.3/linux-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.3/linux-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.3/darwin-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e93175 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.3/win32-x64/develop-5e93175762ab9364fd5def8019d18c7f1935ceb3/cypress.tgz

Please sign in to comment.