Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] export default configuration on moduleAPI #5229

Closed
Closed
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
64 changes: 64 additions & 0 deletions packages/config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* The default config for Cypress server
*/
const CONFIG_DEFAULTS = {
port: null,
hosts: null,
morgan: true,
baseUrl: null,
socketId: null,
projectId: null,
userAgent: null,
isTextTerminal: false,
reporter: 'spec',
reporterOptions: null,
blacklistHosts: null,
clientRoute: '/__/',
xhrRoute: '/xhrs/',
socketIoRoute: '/__socket.io',
socketIoCookie: '__socket.io',
reporterRoute: '/__cypress/reporter',
ignoreTestFiles: '*.hot-update.js',
testFiles: '**/*.*',
defaultCommandTimeout: 4000,
requestTimeout: 5000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
execTimeout: 60000,
taskTimeout: 60000,
video: true,
videoCompression: 32,
videoUploadOnPasses: true,
modifyObstructiveCode: true,
chromeWebSecurity: true,
waitForAnimations: true,
animationDistanceThreshold: 5,
numTestsKeptInMemory: 50,
watchForFileChanges: true,
trashAssetsBeforeRuns: true,
autoOpen: false,
viewportWidth: 1000,
viewportHeight: 660,
fileServerFolder: '',
videosFolder: 'cypress/videos',
supportFile: 'cypress/support',
fixturesFolder: 'cypress/fixtures',
integrationFolder: 'cypress/integration',
screenshotsFolder: 'cypress/screenshots',
namespace: '__cypress',
pluginsFile: 'cypress/plugins',
configFile: 'cypress.json',

// deprecated
javascripts: [],
}

module.exports = {
/**
* Returns the default config for the Cypress server
* @returns {Object} containing the default config.
*/
getDefaults () {
return CONFIG_DEFAULTS
},
}
6 changes: 6 additions & 0 deletions packages/config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@packages/config",
"version": "0.0.0",
"description": "Exports the default configuration for Cypress",
"main": "index.js"
}
53 changes: 2 additions & 51 deletions packages/server/lib/config.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
config = require("@packages/config")
_ = require("lodash")
path = require("path")
Promise = require("bluebird")
Expand Down Expand Up @@ -78,57 +79,7 @@ breakingConfigKeys = toWords """
trashAssetsBeforeHeadlessRuns
"""

CONFIG_DEFAULTS = {
port: null
hosts: null
morgan: true
baseUrl: null
socketId: null
projectId: null
userAgent: null
isTextTerminal: false
reporter: "spec"
reporterOptions: null
blacklistHosts: null
clientRoute: "/__/"
xhrRoute: "/xhrs/"
socketIoRoute: "/__socket.io"
socketIoCookie: "__socket.io"
reporterRoute: "/__cypress/reporter"
ignoreTestFiles: "*.hot-update.js"
testFiles: "**/*.*"
defaultCommandTimeout: 4000
requestTimeout: 5000
responseTimeout: 30000
pageLoadTimeout: 60000
execTimeout: 60000
taskTimeout: 60000
video: true
videoCompression: 32
videoUploadOnPasses: true
modifyObstructiveCode: true
chromeWebSecurity: true
waitForAnimations: true
animationDistanceThreshold: 5
numTestsKeptInMemory: 50
watchForFileChanges: true
trashAssetsBeforeRuns: true
autoOpen: false
viewportWidth: 1000
viewportHeight: 660
fileServerFolder: ""
videosFolder: "cypress/videos"
supportFile: "cypress/support"
fixturesFolder: "cypress/fixtures"
integrationFolder: "cypress/integration"
screenshotsFolder: "cypress/screenshots"
namespace: "__cypress"
pluginsFile: "cypress/plugins"
configFile: "cypress.json"

## deprecated
javascripts: []
}
CONFIG_DEFAULTS = config.getDefaults()

validationRules = {
animationDistanceThreshold: v.isNumber
Expand Down