Merge branch 'develop' into unified-desktop-gui

This commit is contained in:
Lachlan Miller
2021-09-16 11:37:41 +10:00
10 changed files with 21 additions and 37 deletions

View File

@@ -132,7 +132,6 @@
"integrationFolder": "/Users/jennifer/Dev/Projects/cypress-example-kitchensink/cypress/integration",
"isHeadless": false,
"isNewProject": false,
"javascripts": [],
"morgan": true,
"namespace": "__cypress",
"numTestsKeptInMemory": 50,

View File

@@ -136,7 +136,7 @@ class $Cypress {
// change this in the NEXT_BREAKING
const { env } = config
config = _.omit(config, 'env', 'remote', 'resolved', 'scaffoldedFiles', 'javascripts', 'state', 'testingType')
config = _.omit(config, 'env', 'remote', 'resolved', 'scaffoldedFiles', 'state', 'testingType')
_.extend(this, browserInfo(config))

View File

@@ -137,10 +137,6 @@ export const options = [
name: 'isTextTerminal',
defaultValue: false,
isInternal: true,
}, {
name: 'javascripts',
defaultValue: [],
isInternal: true,
}, {
name: 'morgan',
defaultValue: true,

View File

@@ -32,7 +32,7 @@ module.exports = {
return this.getSpecs(test, config, extraOptions)
.then((specs) => {
return this.getJavascripts(config)
return this.getSupportFile(config)
.then((js) => {
const allFilesToSend = js.concat(specs)
@@ -142,14 +142,13 @@ module.exports = {
return test
},
getJavascripts (config) {
const { projectRoot, supportFile, javascripts } = config
getSupportFile (config) {
const { projectRoot, supportFile } = config
// automatically add in support scripts and any javascripts
let files = [].concat(javascripts)
let files = []
if (supportFile !== false) {
files = [supportFile].concat(files)
files = [supportFile]
}
// TODO: there shouldn't be any reason

View File

@@ -10,7 +10,7 @@ interface SpecsWatcherOptions {
onSpecsChanged: (specFiles: SpecFiles) => void
}
const COMMON_SEARCH_OPTIONS = ['fixturesFolder', 'supportFile', 'projectRoot', 'javascripts', 'testFiles', 'ignoreTestFiles']
const COMMON_SEARCH_OPTIONS = ['fixturesFolder', 'supportFile', 'projectRoot', 'testFiles', 'ignoreTestFiles']
// TODO: shouldn't this be on the trailing edge, not leading?
const debounce = (fn) => _.debounce(fn, 250, { leading: true })

View File

@@ -69,22 +69,14 @@ function findSpecsOfType (searchOptions, specPattern) {
const supportFilePath = searchOptions.supportFile || []
// map all of the javascripts to the project root
// TODO: think about moving this into config
// and mapping each of the javascripts into an
// absolute path
const javascriptsPaths = _.map(searchOptions.javascripts, (js) => {
return path.join(searchOptions.projectRoot, js)
})
// ignore fixtures + javascripts
// ignore fixtures
const options = {
sort: true,
absolute: true,
nodir: true,
cwd: searchFolderPath,
ignore: _.compact(_.flatten([
javascriptsPaths,
supportFilePath,
fixturesFolderPath,
])),
@@ -183,7 +175,7 @@ function findSpecsOfType (searchOptions, specPattern) {
* with one of TEST_TYPES values.
*/
const find = (config, specPattern) => {
const commonSearchOptions = ['fixturesFolder', 'supportFile', 'projectRoot', 'javascripts', 'testFiles', 'ignoreTestFiles']
const commonSearchOptions = ['fixturesFolder', 'supportFile', 'projectRoot', 'testFiles', 'ignoreTestFiles']
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'

View File

@@ -449,13 +449,12 @@ describe('Routes', () => {
integrationFolder: 'tests',
fixturesFolder: 'tests/_fixtures',
supportFile: 'tests/_support/spec_helper.js',
javascripts: ['tests/etc/**/*'],
},
})
})
it('returns base json file path objects of only tests', function () {
// this should omit any _fixture files, _support files and javascripts
// this should omit any _fixture files, _support files
return glob(path.join(Fixtures.projectPath('todos'), 'tests', '_fixtures', '**', '*'))
.then((files) => {
// make sure there are fixtures in here!
@@ -477,7 +476,7 @@ describe('Routes', () => {
body,
} = res
expect(body.integration).to.have.length(4)
expect(body.integration).to.have.length(5)
// remove the absolute path key
body.integration = _.map(body.integration, (obj) => {
@@ -487,8 +486,12 @@ describe('Routes', () => {
expect(res.body).to.deep.eq({
integration: [
{
'name': 'sub/a&b%c.js',
'relative': 'tests/sub/a&b%c.js',
name: 'etc/etc.js',
relative: 'tests/etc/etc.js',
},
{
name: 'sub/a&b%c.js',
relative: 'tests/sub/a&b%c.js',
},
{
name: 'sub/sub_test.coffee',
@@ -738,7 +741,7 @@ describe('Routes', () => {
projectRoot: Fixtures.projectPath('no-server'),
config: {
integrationFolder: 'my-tests',
javascripts: ['helpers/includes.js'],
supportFile: 'helpers/includes.js',
},
})
})
@@ -752,7 +755,7 @@ describe('Routes', () => {
})
})
it('processes helpers/includes.js javascripts', function () {
it('processes helpers/includes.js supportFile', function () {
return this.rp('http://localhost:2020/__cypress/tests?p=helpers/includes.js')
.then((res) => {
expect(res.statusCode).to.eq(200)
@@ -1108,7 +1111,6 @@ describe('Routes', () => {
integrationFolder: 'tests',
fixturesFolder: 'tests/_fixtures',
supportFile: 'tests/_support/spec_helper.js',
javascripts: ['tests/etc/etc.js'],
},
}, {}, spec)
}

View File

@@ -13,7 +13,7 @@
if (!Cypress) {
throw new Error("Tests cannot run without a reference to Cypress!");
}
return Cypress.onSpecWindow(window, [{"absolute":"/<path-to-project>/todos/tests/_support/spec_helper.js","relative":"tests/_support/spec_helper.js","relativeUrl":"/__cypress/tests?p=tests/_support/spec_helper.js"},{"absolute":"/<path-to-project>/todos/tests/etc/etc.js","relative":"tests/etc/etc.js","relativeUrl":"/__cypress/tests?p=tests/etc/etc.js"},{"absolute":"/<path-to-project>/todos/tests/sub/sub_test.coffee","relative":"tests/sub/sub_test.coffee","relativeUrl":"/__cypress/tests?p=tests/sub/sub_test.coffee"}]);
return Cypress.onSpecWindow(window, [{"absolute":"/<path-to-project>/todos/tests/_support/spec_helper.js","relative":"tests/_support/spec_helper.js","relativeUrl":"/__cypress/tests?p=tests/_support/spec_helper.js"},{"absolute":"/<path-to-project>/todos/tests/sub/sub_test.coffee","relative":"tests/sub/sub_test.coffee","relativeUrl":"/__cypress/tests?p=tests/sub/sub_test.coffee"}]);
})(window.opener || window.parent);
</script>
</body>

View File

@@ -13,7 +13,7 @@
if (!Cypress) {
throw new Error("Tests cannot run without a reference to Cypress!");
}
return Cypress.onSpecWindow(window, [{"absolute":"/<path-to-project>/todos/tests/_support/spec_helper.js","relative":"tests/_support/spec_helper.js","relativeUrl":"/__cypress/tests?p=tests/_support/spec_helper.js"},{"absolute":"/<path-to-project>/todos/tests/etc/etc.js","relative":"tests/etc/etc.js","relativeUrl":"/__cypress/tests?p=tests/etc/etc.js"},{"absolute":"/<path-to-project>/todos/tests/test2.coffee","relative":"tests/test2.coffee","relativeUrl":"/__cypress/tests?p=tests/test2.coffee"}]);
return Cypress.onSpecWindow(window, [{"absolute":"/<path-to-project>/todos/tests/_support/spec_helper.js","relative":"tests/_support/spec_helper.js","relativeUrl":"/__cypress/tests?p=tests/_support/spec_helper.js"},{"absolute":"/<path-to-project>/todos/tests/test2.coffee","relative":"tests/test2.coffee","relativeUrl":"/__cypress/tests?p=tests/test2.coffee"}]);
})(window.opener || window.parent);
</script>
</body>

View File

@@ -1137,10 +1137,6 @@ describe('lib/config', () => {
})
})
it('javascripts=[]', function () {
return this.defaults('javascripts', [])
})
it('viewportWidth=1000', function () {
return this.defaults('viewportWidth', 1000)
})