Skip to content

Commit 4592df2

Browse files
authored
fix(server-ct): support exclusive inline config (#16468)
* fix: reproduce issue * better minimal repro * use resolved values for component folder and test files * use resolved values for testFiles and componentFolder * make code style more uniform * remove unused default value
1 parent 12ef3e8 commit 4592df2

File tree

9 files changed

+54
-1
lines changed

9 files changed

+54
-1
lines changed

packages/server-ct/src/specs-store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ export class SpecsStore {
2424
}
2525

2626
get specDirectory () {
27-
return this.cypressConfig.componentFolder || '.'
27+
return this.cypressConfig.resolved.componentFolder.value
28+
}
29+
30+
get testFiles () {
31+
return this.cypressConfig.resolved.testFiles.value
2832
}
2933

3034
get watchOptions (): chokidar.WatchOptions {
@@ -46,6 +50,7 @@ export class SpecsStore {
4650
const searchOptions = _.pick(this.cypressConfig, COMMON_SEARCH_OPTIONS)
4751

4852
searchOptions.searchFolder = this.specDirectory
53+
searchOptions.testFiles = this.testFiles
4954

5055
return findSpecsOfType(searchOptions)
5156
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function createApp(root) {
2+
const el = document.createElement('div')
3+
el.textContent = 'This is the app'
4+
root.appendChild(el)
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createApp } from './App.js'
2+
import { ROOT_ID } from '@cypress/mount-utils'
3+
4+
it('renders', () => {
5+
createApp(document.getElementById(ROOT_ID))
6+
cy.get('div').contains('This is the app')
7+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}

packages/server-ct/test/fixtures/projects/inline-config-only/cypress/integration/.keep

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { startDevServer } = require('@cypress/webpack-dev-server')
2+
3+
module.exports = (on, config) => {
4+
on('dev-server:start', (options) => {
5+
return startDevServer({
6+
webpackConfig: {
7+
output: {
8+
publicPath: '/',
9+
},
10+
devServer: {
11+
publicPath: '/',
12+
},
13+
},
14+
options,
15+
})
16+
})
17+
18+
return {
19+
...config,
20+
componentFolder: 'cypress/custom-folder',
21+
testFiles: '**/*.spec.js',
22+
video: false
23+
}
24+
}

packages/server-ct/test/fixtures/projects/inline-config-only/cypress/support/index.js

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"scripts": {
3+
"cy:run": "node ../../../../../../scripts/cypress.js run-ct",
4+
"cy:open": "node ../../../../../../scripts/cypress.js open-ct"
5+
}
6+
}

0 commit comments

Comments
 (0)