Skip to content

Commit efb4062

Browse files
authored
Merge pull request #18101 from cypress-io/chore/remove-legacy-javascripts-config
chore: remove legacy javascripts config option and related code
2 parents f82c08e + da74782 commit efb4062

File tree

10 files changed

+21
-37
lines changed

10 files changed

+21
-37
lines changed

packages/desktop-gui/cypress/fixtures/config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
"integrationFolder": "/Users/jennifer/Dev/Projects/cypress-example-kitchensink/cypress/integration",
133133
"isHeadless": false,
134134
"isNewProject": false,
135-
"javascripts": [],
136135
"morgan": true,
137136
"namespace": "__cypress",
138137
"numTestsKeptInMemory": 50,

packages/driver/src/cypress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class $Cypress {
136136
// change this in the NEXT_BREAKING
137137
const { env } = config
138138

139-
config = _.omit(config, 'env', 'remote', 'resolved', 'scaffoldedFiles', 'javascripts', 'state', 'testingType')
139+
config = _.omit(config, 'env', 'remote', 'resolved', 'scaffoldedFiles', 'state', 'testingType')
140140

141141
_.extend(this, browserInfo(config))
142142

packages/server/lib/config_options.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ export const options = [
137137
name: 'isTextTerminal',
138138
defaultValue: false,
139139
isInternal: true,
140-
}, {
141-
name: 'javascripts',
142-
defaultValue: [],
143-
isInternal: true,
144140
}, {
145141
name: 'morgan',
146142
defaultValue: true,

packages/server/lib/controllers/files.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232

3333
return this.getSpecs(test, config, extraOptions)
3434
.then((specs) => {
35-
return this.getJavascripts(config)
35+
return this.getSupportFile(config)
3636
.then((js) => {
3737
const allFilesToSend = js.concat(specs)
3838

@@ -142,14 +142,13 @@ module.exports = {
142142
return test
143143
},
144144

145-
getJavascripts (config) {
146-
const { projectRoot, supportFile, javascripts } = config
145+
getSupportFile (config) {
146+
const { projectRoot, supportFile } = config
147147

148-
// automatically add in support scripts and any javascripts
149-
let files = [].concat(javascripts)
148+
let files = []
150149

151150
if (supportFile !== false) {
152-
files = [supportFile].concat(files)
151+
files = [supportFile]
153152
}
154153

155154
// TODO: there shouldn't be any reason

packages/server/lib/specs-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface SpecsWatcherOptions {
1010
onSpecsChanged: (specFiles: SpecFiles) => void
1111
}
1212

13-
const COMMON_SEARCH_OPTIONS = ['fixturesFolder', 'supportFile', 'projectRoot', 'javascripts', 'testFiles', 'ignoreTestFiles']
13+
const COMMON_SEARCH_OPTIONS = ['fixturesFolder', 'supportFile', 'projectRoot', 'testFiles', 'ignoreTestFiles']
1414

1515
// TODO: shouldn't this be on the trailing edge, not leading?
1616
const debounce = (fn) => _.debounce(fn, 250, { leading: true })

packages/server/lib/util/specs.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,14 @@ function findSpecsOfType (searchOptions, specPattern) {
6969

7070
const supportFilePath = searchOptions.supportFile || []
7171

72-
// map all of the javascripts to the project root
7372
// TODO: think about moving this into config
74-
// and mapping each of the javascripts into an
75-
// absolute path
76-
const javascriptsPaths = _.map(searchOptions.javascripts, (js) => {
77-
return path.join(searchOptions.projectRoot, js)
78-
})
79-
80-
// ignore fixtures + javascripts
73+
// ignore fixtures
8174
const options = {
8275
sort: true,
8376
absolute: true,
8477
nodir: true,
8578
cwd: searchFolderPath,
8679
ignore: _.compact(_.flatten([
87-
javascriptsPaths,
8880
supportFilePath,
8981
fixturesFolderPath,
9082
])),
@@ -183,7 +175,7 @@ function findSpecsOfType (searchOptions, specPattern) {
183175
* with one of TEST_TYPES values.
184176
*/
185177
const find = (config, specPattern) => {
186-
const commonSearchOptions = ['fixturesFolder', 'supportFile', 'projectRoot', 'javascripts', 'testFiles', 'ignoreTestFiles']
178+
const commonSearchOptions = ['fixturesFolder', 'supportFile', 'projectRoot', 'testFiles', 'ignoreTestFiles']
187179

188180
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
189181

packages/server/test/integration/http_requests_spec.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,12 @@ describe('Routes', () => {
449449
integrationFolder: 'tests',
450450
fixturesFolder: 'tests/_fixtures',
451451
supportFile: 'tests/_support/spec_helper.js',
452-
javascripts: ['tests/etc/**/*'],
453452
},
454453
})
455454
})
456455

457456
it('returns base json file path objects of only tests', function () {
458-
// this should omit any _fixture files, _support files and javascripts
457+
// this should omit any _fixture files, _support files
459458
return glob(path.join(Fixtures.projectPath('todos'), 'tests', '_fixtures', '**', '*'))
460459
.then((files) => {
461460
// make sure there are fixtures in here!
@@ -477,7 +476,7 @@ describe('Routes', () => {
477476
body,
478477
} = res
479478

480-
expect(body.integration).to.have.length(4)
479+
expect(body.integration).to.have.length(5)
481480

482481
// remove the absolute path key
483482
body.integration = _.map(body.integration, (obj) => {
@@ -487,8 +486,12 @@ describe('Routes', () => {
487486
expect(res.body).to.deep.eq({
488487
integration: [
489488
{
490-
'name': 'sub/a&b%c.js',
491-
'relative': 'tests/sub/a&b%c.js',
489+
name: 'etc/etc.js',
490+
relative: 'tests/etc/etc.js',
491+
},
492+
{
493+
name: 'sub/a&b%c.js',
494+
relative: 'tests/sub/a&b%c.js',
492495
},
493496
{
494497
name: 'sub/sub_test.coffee',
@@ -738,7 +741,7 @@ describe('Routes', () => {
738741
projectRoot: Fixtures.projectPath('no-server'),
739742
config: {
740743
integrationFolder: 'my-tests',
741-
javascripts: ['helpers/includes.js'],
744+
supportFile: 'helpers/includes.js',
742745
},
743746
})
744747
})
@@ -752,7 +755,7 @@ describe('Routes', () => {
752755
})
753756
})
754757

755-
it('processes helpers/includes.js javascripts', function () {
758+
it('processes helpers/includes.js supportFile', function () {
756759
return this.rp('http://localhost:2020/__cypress/tests?p=helpers/includes.js')
757760
.then((res) => {
758761
expect(res.statusCode).to.eq(200)
@@ -1108,7 +1111,6 @@ describe('Routes', () => {
11081111
integrationFolder: 'tests',
11091112
fixturesFolder: 'tests/_fixtures',
11101113
supportFile: 'tests/_support/spec_helper.js',
1111-
javascripts: ['tests/etc/etc.js'],
11121114
},
11131115
}, {}, spec)
11141116
}

packages/server/test/support/fixtures/server/expected_todos_filtered_tests_iframe.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
if (!Cypress) {
1414
throw new Error("Tests cannot run without a reference to Cypress!");
1515
}
16-
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"}]);
16+
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"}]);
1717
})(window.opener || window.parent);
1818
</script>
1919
</body>

packages/server/test/support/fixtures/server/expected_todos_iframe.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
if (!Cypress) {
1414
throw new Error("Tests cannot run without a reference to Cypress!");
1515
}
16-
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"}]);
16+
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"}]);
1717
})(window.opener || window.parent);
1818
</script>
1919
</body>

packages/server/test/unit/config_spec.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,10 +1137,6 @@ describe('lib/config', () => {
11371137
})
11381138
})
11391139

1140-
it('javascripts=[]', function () {
1141-
return this.defaults('javascripts', [])
1142-
})
1143-
11441140
it('viewportWidth=1000', function () {
11451141
return this.defaults('viewportWidth', 1000)
11461142
})

0 commit comments

Comments
 (0)