Skip to content

Commit

Permalink
Merge pull request #18101 from cypress-io/chore/remove-legacy-javascr…
Browse files Browse the repository at this point in the history
…ipts-config

chore: remove legacy javascripts config option and related code
  • Loading branch information
lmiller1990 authored Sep 16, 2021
2 parents f82c08e + da74782 commit efb4062
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 37 deletions.
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

4 comments on commit efb4062

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on efb4062 Sep 16, 2021

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/8.4.1/circle-develop-efb40620a6332648301069beb797484b35af356b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on efb4062 Sep 16, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 ia32 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/8.4.1/appveyor-develop-efb40620a6332648301069beb797484b35af356b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on efb4062 Sep 16, 2021

Choose a reason for hiding this comment

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

AppVeyor 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/8.4.1/appveyor-develop-efb40620a6332648301069beb797484b35af356b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on efb4062 Sep 16, 2021

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/8.4.1/circle-develop-efb40620a6332648301069beb797484b35af356b/cypress.tgz

Please sign in to comment.