Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/desktop-gui/cypress/fixtures/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
4 changes: 0 additions & 4 deletions packages/server/lib/config_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ export const options = [
name: 'isTextTerminal',
defaultValue: false,
isInternal: true,
}, {
name: 'javascripts',
defaultValue: [],
isInternal: true,
}, {
name: 'morgan',
defaultValue: true,
Expand Down
11 changes: 5 additions & 6 deletions packages/server/lib/controllers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/server/lib/specs-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
12 changes: 2 additions & 10 deletions packages/server/lib/util/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
])),
Expand Down Expand Up @@ -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'

Expand Down
18 changes: 10 additions & 8 deletions packages/server/test/integration/http_requests_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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) => {
Expand All @@ -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',
Expand Down Expand Up @@ -738,7 +741,7 @@ describe('Routes', () => {
projectRoot: Fixtures.projectPath('no-server'),
config: {
integrationFolder: 'my-tests',
javascripts: ['helpers/includes.js'],
supportFile: 'helpers/includes.js',
},
})
})
Expand All @@ -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)
Expand Down Expand Up @@ -1108,7 +1111,6 @@ describe('Routes', () => {
integrationFolder: 'tests',
fixturesFolder: 'tests/_fixtures',
supportFile: 'tests/_support/spec_helper.js',
javascripts: ['tests/etc/etc.js'],
},
}, {}, spec)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 0 additions & 4 deletions packages/server/test/unit/config_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1137,10 +1137,6 @@ describe('lib/config', () => {
})
})

it('javascripts=[]', function () {
return this.defaults('javascripts', [])
})

it('viewportWidth=1000', function () {
return this.defaults('viewportWidth', 1000)
})
Expand Down