diff --git a/eslint_temporary_suppressions.js b/eslint_temporary_suppressions.js index 6ec7fe1a54..683c6b3a8e 100644 --- a/eslint_temporary_suppressions.js +++ b/eslint_temporary_suppressions.js @@ -30,7 +30,12 @@ export default [ }, { // Allow circular testing package dependency in build and config - files: ['packages/build/tests/**/tests.js', 'packages/config/tests/**/tests.js'], + files: [ + 'packages/build/tests/**/tests.js', + 'packages/build/tests/**/*.test.js', + 'packages/config/tests/**/tests.js', + 'packages/config/tests/**/*.test.js', + ], rules: { 'n/no-extraneous-import': 'off', }, diff --git a/package-lock.json b/package-lock.json index 5f8af4830b..1ebee7dd18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24068,7 +24068,8 @@ "c8": "^10.0.0", "has-ansi": "^6.0.0", "is-ci": "^4.0.0", - "tmp-promise": "^3.0.2" + "tmp-promise": "^3.0.2", + "vitest": "^3.0.0" }, "engines": { "node": ">=22.12.0" diff --git a/packages/config/package.json b/packages/config/package.json index 4c7c58188f..0b6e7b9646 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -21,9 +21,11 @@ "scripts": { "prebuild": "rm -rf lib", "build": "tsc", - "test": "ava", + "test": "ava && vitest run", "test:dev": "ava -w", - "test:ci": "c8 -r lcovonly -r text -r json ava" + "test:ci": "npm run test:ci:ava && npm run test:ci:vitest", + "test:ci:ava": "c8 -r lcovonly -r text -r json ava", + "test:ci:vitest": "vitest run" }, "keywords": [ "javascript", @@ -89,7 +91,8 @@ "c8": "^10.0.0", "has-ansi": "^6.0.0", "is-ci": "^4.0.0", - "tmp-promise": "^3.0.2" + "tmp-promise": "^3.0.2", + "vitest": "^3.0.0" }, "engines": { "node": ">=22.12.0" diff --git a/packages/config/tests/normalize/__snapshots__/normalize.test.js.snap b/packages/config/tests/normalize/__snapshots__/normalize.test.js.snap new file mode 100644 index 0000000000..ec000cc675 --- /dev/null +++ b/packages/config/tests/normalize/__snapshots__/normalize.test.js.snap @@ -0,0 +1,3368 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Add build.commandOrigin config if it came from contexts 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/command_origin_context", + "config": { + "build": { + "command": "test", + "commandOrigin": "config", + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/command_origin_context", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/command_origin_context/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/command_origin_context/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/command_origin_context/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/command_origin_context", + "siteInfo": {} +}" +`; + +exports[`Add build.commandOrigin config if it came from netlify.toml 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/command_origin_config", + "config": { + "build": { + "command": "test", + "commandOrigin": "config", + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/command_origin_config", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/command_origin_config/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/command_origin_config/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/command_origin_config/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/command_origin_config", + "siteInfo": {} +}" +`; + +exports[`Add build.commandOrigin ui if it came from defaultConfig 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/empty", + "config": { + "build": { + "command": "test", + "commandOrigin": "ui", + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/empty", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/empty/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/empty/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/empty", + "siteInfo": {} +}" +`; + +exports[`Assign default edge-functions if build.edge_functions is not defined 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined", + "config": { + "build": { + "edge_functions": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined/netlify/edge-functions", + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined", + "siteInfo": {} +}" +`; + +exports[`Assign default functions if functions.directory is not defined and default directory exists 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/default_functions_not_defined", + "config": { + "build": { + "environment": {}, + "functions": "packages/config/tests/normalize/fixtures/default_functions_not_defined/netlify/functions", + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/default_functions_not_defined", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_not_defined/netlify/functions", + "functionsDirectoryOrigin": "default", + "headers": [], + "plugins": [], + "redirects": [] + }, + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/default_functions_not_defined/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_not_defined/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_not_defined", + "siteInfo": {} +}" +`; + +exports[`Assign default functions if functions.directory is not defined and the legacy default directory exists 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined", + "config": { + "build": { + "environment": {}, + "functions": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined/netlify-automatic-functions", + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "functionsDirectory": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined/netlify-automatic-functions", + "functionsDirectoryOrigin": "default-v1.0.0", + "headers": [], + "plugins": [], + "redirects": [] + }, + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined", + "siteInfo": {} +}" +`; + +exports[`Collects paths from \`included_files\` defined at different levels 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/function_config_included_files", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/function_config_included_files", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": { + "included_files": [ + "from-top" + ] + }, + "my_function": { + "included_files": [ + "!from-glob/two", + "from-function" + ] + }, + "my_prefix_*": { + "included_files": [ + "!from-top/one", + "from-glob" + ] + } + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/function_config_included_files/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/function_config_included_files/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/function_config_included_files/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/function_config_included_files", + "siteInfo": {} +}" +`; + +exports[`Context-specific plugins config is last in merged array 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [ + { + "inputs": {}, + "origin": "config", + "package": "netlify-plugin-test-two" + }, + { + "inputs": {}, + "origin": "config", + "package": "netlify-plugin-test" + } + ], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last", + "siteInfo": {} +}" +`; + +exports[`Does not add build.commandOrigin config if command is empty 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/command_empty", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/command_empty", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/command_empty/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/command_empty/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/command_empty/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/command_empty", + "siteInfo": {} +}" +`; + +exports[`Does not add build.commandOrigin config if there are none 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/empty", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/empty", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/empty/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/empty/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/empty", + "siteInfo": {} +}" +`; + +exports[`Does not assign default edge-functions if build.edge_functions is defined 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/default_edge_functions_defined", + "config": { + "build": { + "edge_functions": "packages/config/tests/normalize/fixtures/default_edge_functions_defined/test", + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/default_edge_functions_defined", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/default_edge_functions_defined/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/default_edge_functions_defined/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/default_edge_functions_defined/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/default_edge_functions_defined", + "siteInfo": {} +}" +`; + +exports[`Does not assign default functions if build.functions is defined 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy", + "config": { + "build": { + "environment": {}, + "functions": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/test", + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/test", + "functionsDirectoryOrigin": "config-v1.0.0", + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy", + "siteInfo": {} +}" +`; + +exports[`Does not assign default functions if default functions directory does not exist 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found", + "siteInfo": {} +}" +`; + +exports[`Does not assign default functions if functions.directory is defined 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/default_functions_defined", + "config": { + "build": { + "environment": {}, + "functions": "packages/config/tests/normalize/fixtures/default_functions_defined/test", + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/default_functions_defined", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_defined/test", + "functionsDirectoryOrigin": "config", + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/default_functions_defined/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/default_functions_defined/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_defined/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_defined", + "siteInfo": {} +}" +`; + +exports[`Gives priority to functions.star over functions when defined first 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first", + "config": { + "build": { + "environment": {}, + "functions": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/one", + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": { + "external_node_modules": [ + "testOne" + ], + "ignored_node_modules": [ + "testTwo" + ] + } + }, + "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/one", + "functionsDirectoryOrigin": "config", + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first", + "siteInfo": {} +}" +`; + +exports[`Gives priority to functions.star over functions when defined last 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last", + "config": { + "build": { + "environment": {}, + "functions": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/one", + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": { + "external_node_modules": [ + "testOne" + ], + "ignored_node_modules": [ + "testTwo" + ] + } + }, + "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/one", + "functionsDirectoryOrigin": "config", + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last", + "siteInfo": {} +}" +`; + +exports[`Handles function configuration objects for functions with the same name as one of the configuration properties 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/function_config_ambiguous", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/function_config_ambiguous", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {}, + "external_node_modules": { + "external_node_modules": [ + "module-three" + ] + } + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/function_config_ambiguous/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/function_config_ambiguous/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/function_config_ambiguous/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/function_config_ambiguous", + "siteInfo": {} +}" +`; + +exports[`Merges context-specific plugins 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [ + { + "inputs": { + "array": [ + "c", + "d" + ], + "boolean": false, + "object": { + "prop": false, + "unset": true + }, + "unset": true + }, + "origin": "config", + "package": "netlify-plugin-test" + }, + { + "inputs": { + "boolean": true + }, + "origin": "config", + "package": "netlify-plugin-test-two" + } + ], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context", + "siteInfo": {} +}" +`; + +exports[`Merges plugins in netlify.toml and defaultConfig 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [ + { + "inputs": { + "array": [ + "c", + "d" + ], + "boolean": false, + "object": { + "prop": false, + "unset": true + }, + "unset": true + }, + "origin": "config", + "package": "netlify-plugin-test" + }, + { + "inputs": { + "boolean": true + }, + "origin": "config", + "package": "netlify-plugin-test-two" + } + ], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default", + "siteInfo": {} +}" +`; + +exports[`Normalizes function configurations defined at different levels 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/function_config_all_levels", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/function_config_all_levels", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": { + "external_node_modules": [ + "module-one", + "module-two" + ], + "node_bundler": "esbuild" + }, + "my_function": { + "external_node_modules": [ + "module-three" + ], + "node_bundler": "zisi" + }, + "my_prefix_*": { + "external_node_modules": [ + "module-four" + ] + }, + "other_prefix_*": { + "node_bundler": "nft" + } + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/function_config_all_levels/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/function_config_all_levels/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/function_config_all_levels/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/function_config_all_levels", + "siteInfo": {} +}" +`; + +exports[`Normalizes function configurations defined at the top level 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/function_config_top_level", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/function_config_top_level", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": { + "external_node_modules": [ + "module-one", + "module-two" + ], + "node_bundler": "esbuild" + } + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/function_config_top_level/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/function_config_top_level/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/function_config_top_level/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/function_config_top_level", + "siteInfo": {} +}" +`; + +exports[`Some properties can be capitalized 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/props_case/base", + "config": { + "build": { + "base": "packages/config/tests/normalize/fixtures/props_case/base", + "command": "gulp build", + "commandOrigin": "config", + "edge_functions": "packages/config/tests/normalize/fixtures/props_case/base/edge-functions", + "environment": { + "TEST": "test" + }, + "functions": "packages/config/tests/normalize/fixtures/props_case/base/functions", + "ignore": "doIgnore", + "processing": { + "css": { + "bundle": true + }, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/props_case/base/publish", + "publishOrigin": "config", + "services": {} + }, + "functions": { + "*": {} + }, + "functionsDirectory": "packages/config/tests/normalize/fixtures/props_case/base/functions", + "functionsDirectoryOrigin": "config-v1.0.0", + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/props_case/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + }, + "TEST": { + "sources": [ + "configFile" + ], + "value": "test" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/props_case/base/publish/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/props_case/base/publish/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/props_case", + "siteInfo": {} +}" +`; + +exports[`Some properties can be capitalized even when merged with defaultConfig 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/props_case_default_config/base", + "config": { + "build": { + "base": "packages/config/tests/normalize/fixtures/props_case_default_config/base", + "command": "gulp build default", + "commandOrigin": "ui", + "edge_functions": "packages/config/tests/normalize/fixtures/props_case_default_config/base/edgeFunctions", + "environment": { + "TEST": "test" + }, + "functions": "packages/config/tests/normalize/fixtures/props_case_default_config/base/functions", + "ignore": "doIgnore", + "processing": { + "css": { + "bundle": false + }, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/props_case_default_config/base/publish", + "publishOrigin": "ui", + "services": {} + }, + "functions": { + "*": {} + }, + "functionsDirectory": "packages/config/tests/normalize/fixtures/props_case_default_config/base/functions", + "functionsDirectoryOrigin": "config-v1.0.0", + "headers": [], + "plugins": [], + "redirects": [] + }, + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + }, + "TEST": { + "sources": [ + "configFile" + ], + "value": "test" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/props_case_default_config/base/publish/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/props_case_default_config/base/publish/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/props_case_default_config", + "siteInfo": {} +}" +`; + +exports[`build.command empty 1`] = ` +"{ + "accounts": [], + "branch": "branch", + "buildDir": "packages/config/tests/normalize/fixtures/command_empty", + "config": { + "build": { + "environment": {}, + "processing": { + "css": {}, + "html": {}, + "images": {}, + "js": {} + }, + "publish": "packages/config/tests/normalize/fixtures/command_empty", + "publishOrigin": "default", + "services": {} + }, + "functions": { + "*": {} + }, + "headers": [], + "plugins": [], + "redirects": [] + }, + "configPath": "packages/config/tests/normalize/fixtures/command_empty/netlify.toml", + "context": "production", + "env": { + "BRANCH": { + "sources": [ + "general" + ], + "value": "branch" + }, + "BUILD_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "CACHED_COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "COMMIT_REF": { + "sources": [ + "general" + ], + "value": "HEXADECIMAL_ID" + }, + "CONTEXT": { + "sources": [ + "general" + ], + "value": "production" + }, + "DEPLOY_ID": { + "sources": [ + "general" + ], + "value": "0" + }, + "DEPLOY_PRIME_URL": { + "sources": [ + "general" + ], + "value": "https://branch--site-name.netlify.app" + }, + "DEPLOY_URL": { + "sources": [ + "general" + ], + "value": "https://0--site-name.netlify.app" + }, + "GATSBY_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "HEAD": { + "sources": [ + "general" + ], + "value": "branch" + }, + "LANG": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "LANGUAGE": { + "sources": [ + "general" + ], + "value": "en_US:en" + }, + "LC_ALL": { + "sources": [ + "general" + ], + "value": "en_US.UTF-8" + }, + "NETLIFY_LOCAL": { + "sources": [ + "general" + ], + "value": "true" + }, + "NEXT_TELEMETRY_DISABLED": { + "sources": [ + "general" + ], + "value": "1" + }, + "PULL_REQUEST": { + "sources": [ + "general" + ], + "value": "false" + } + }, + "headersPath": "packages/config/tests/normalize/fixtures/command_empty/_headers", + "integrations": [], + "redirectsPath": "packages/config/tests/normalize/fixtures/command_empty/_redirects", + "repositoryRoot": "packages/config/tests/normalize/fixtures/command_empty", + "siteInfo": {} +}" +`; diff --git a/packages/config/tests/normalize/normalize.test.js b/packages/config/tests/normalize/normalize.test.js new file mode 100644 index 0000000000..08f259cfcb --- /dev/null +++ b/packages/config/tests/normalize/normalize.test.js @@ -0,0 +1,160 @@ +import { Fixture, normalizeOutput } from '@netlify/testing' +import { expect, test } from 'vitest' + +test('build.command empty', async () => { + const output = await new Fixture(import.meta.url, './fixtures/command_empty').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Some properties can be capitalized', async () => { + const output = await new Fixture(import.meta.url, './fixtures/props_case').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Some properties can be capitalized even when merged with defaultConfig', async () => { + const output = await new Fixture(import.meta.url, './fixtures/props_case_default_config') + .withFlags({ + defaultConfig: { + Build: { + Base: 'base', + Command: 'gulp build default', + Edge_functions: 'edgeFunctions', + Functions: 'functions', + Ignore: 'doIgnore', + Publish: 'publish', + Environment: { TEST: 'test' }, + Processing: { css: { bundle: false } }, + }, + }, + }) + .runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Does not add build.commandOrigin config if there are none', async () => { + const output = await new Fixture(import.meta.url, './fixtures/empty').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Does not add build.commandOrigin config if command is empty', async () => { + const output = await new Fixture(import.meta.url, './fixtures/command_empty').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Add build.commandOrigin config if it came from netlify.toml', async () => { + const output = await new Fixture(import.meta.url, './fixtures/command_origin_config').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Add build.commandOrigin config if it came from contexts', async () => { + const output = await new Fixture(import.meta.url, './fixtures/command_origin_context').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Add build.commandOrigin ui if it came from defaultConfig', async () => { + const output = await new Fixture(import.meta.url, './fixtures/empty') + .withFlags({ + defaultConfig: { build: { command: 'test' } }, + }) + .runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Assign default functions if functions.directory is not defined and default directory exists', async () => { + const output = await new Fixture(import.meta.url, './fixtures/default_functions_not_defined').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Assign default functions if functions.directory is not defined and the legacy default directory exists', async () => { + const output = await new Fixture(import.meta.url, './fixtures/legacy_default_functions_not_defined').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Does not assign default functions if default functions directory does not exist', async () => { + const output = await new Fixture( + import.meta.url, + './fixtures/default_functions_not_defined_directory_not_found', + ).runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Does not assign default functions if functions.directory is defined', async () => { + const output = await new Fixture(import.meta.url, './fixtures/default_functions_defined').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Does not assign default functions if build.functions is defined', async () => { + const output = await new Fixture(import.meta.url, './fixtures/default_functions_defined_legacy').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Gives priority to functions.star over functions when defined first', async () => { + const output = await new Fixture(import.meta.url, './fixtures/default_functions_star_priority_first').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Gives priority to functions.star over functions when defined last', async () => { + const output = await new Fixture(import.meta.url, './fixtures/default_functions_star_priority_last').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Assign default edge-functions if build.edge_functions is not defined', async () => { + const output = await new Fixture(import.meta.url, './fixtures/default_edge_functions_not_defined').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Does not assign default edge-functions if build.edge_functions is defined', async () => { + const output = await new Fixture(import.meta.url, './fixtures/default_edge_functions_defined').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Normalizes function configurations defined at the top level', async () => { + const output = await new Fixture(import.meta.url, './fixtures/function_config_top_level').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Normalizes function configurations defined at different levels', async () => { + const output = await new Fixture(import.meta.url, './fixtures/function_config_all_levels').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Handles function configuration objects for functions with the same name as one of the configuration properties', async () => { + const output = await new Fixture(import.meta.url, './fixtures/function_config_ambiguous').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Collects paths from `included_files` defined at different levels', async () => { + const output = await new Fixture(import.meta.url, './fixtures/function_config_included_files').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Merges plugins in netlify.toml and defaultConfig', async () => { + const output = await new Fixture(import.meta.url, './fixtures/merge_netlify_toml_default') + .withFlags({ + defaultConfig: { + plugins: [ + { + package: 'netlify-plugin-test', + inputs: { + boolean: true, + unset: true, + array: ['a', 'b'], + object: { prop: true, unset: true }, + }, + }, + ], + }, + }) + .runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Merges context-specific plugins', async () => { + const output = await new Fixture(import.meta.url, './fixtures/merge_netlify_toml_context').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) + +test('Context-specific plugins config is last in merged array', async () => { + const output = await new Fixture(import.meta.url, './fixtures/merge_netlify_toml_context_last').runWithConfig() + expect(normalizeOutput(output)).toMatchSnapshot() +}) diff --git a/packages/config/tests/normalize/snapshots/tests.js.md b/packages/config/tests/normalize/snapshots/tests.js.md deleted file mode 100644 index a87148b694..0000000000 --- a/packages/config/tests/normalize/snapshots/tests.js.md +++ /dev/null @@ -1,3420 +0,0 @@ -# Snapshot report for `tests/normalize/tests.js` - -The actual snapshot is saved in `tests.js.snap`. - -Generated by [AVA](https://avajs.dev). - -## build.command empty - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/command_empty",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/command_empty",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/command_empty/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/command_empty/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/command_empty/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/command_empty",␊ - "siteInfo": {}␊ - }` - -## Some properties can be capitalized - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/props_case/base",␊ - "config": {␊ - "build": {␊ - "base": "packages/config/tests/normalize/fixtures/props_case/base",␊ - "command": "gulp build",␊ - "commandOrigin": "config",␊ - "edge_functions": "packages/config/tests/normalize/fixtures/props_case/base/edge-functions",␊ - "environment": {␊ - "TEST": "test"␊ - },␊ - "functions": "packages/config/tests/normalize/fixtures/props_case/base/functions",␊ - "ignore": "doIgnore",␊ - "processing": {␊ - "css": {␊ - "bundle": true␊ - },␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/props_case/base/publish",␊ - "publishOrigin": "config",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "functionsDirectory": "packages/config/tests/normalize/fixtures/props_case/base/functions",␊ - "functionsDirectoryOrigin": "config-v1.0.0",␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/props_case/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - },␊ - "TEST": {␊ - "sources": [␊ - "configFile"␊ - ],␊ - "value": "test"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/props_case/base/publish/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/props_case/base/publish/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/props_case",␊ - "siteInfo": {}␊ - }` - -## Some properties can be capitalized even when merged with defaultConfig - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/props_case_default_config/base",␊ - "config": {␊ - "build": {␊ - "base": "packages/config/tests/normalize/fixtures/props_case_default_config/base",␊ - "command": "gulp build default",␊ - "commandOrigin": "ui",␊ - "edge_functions": "packages/config/tests/normalize/fixtures/props_case_default_config/base/edgeFunctions",␊ - "environment": {␊ - "TEST": "test"␊ - },␊ - "functions": "packages/config/tests/normalize/fixtures/props_case_default_config/base/functions",␊ - "ignore": "doIgnore",␊ - "processing": {␊ - "css": {␊ - "bundle": false␊ - },␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/props_case_default_config/base/publish",␊ - "publishOrigin": "ui",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "functionsDirectory": "packages/config/tests/normalize/fixtures/props_case_default_config/base/functions",␊ - "functionsDirectoryOrigin": "config-v1.0.0",␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - },␊ - "TEST": {␊ - "sources": [␊ - "configFile"␊ - ],␊ - "value": "test"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/props_case_default_config/base/publish/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/props_case_default_config/base/publish/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/props_case_default_config",␊ - "siteInfo": {}␊ - }` - -## Does not add build.commandOrigin config if there are none - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/empty",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/empty",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/empty/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/empty/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/empty",␊ - "siteInfo": {}␊ - }` - -## Does not add build.commandOrigin config if command is empty - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/command_empty",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/command_empty",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/command_empty/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/command_empty/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/command_empty/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/command_empty",␊ - "siteInfo": {}␊ - }` - -## Add build.commandOrigin config if it came from netlify.toml - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/command_origin_config",␊ - "config": {␊ - "build": {␊ - "command": "test",␊ - "commandOrigin": "config",␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/command_origin_config",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/command_origin_config/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/command_origin_config/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/command_origin_config/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/command_origin_config",␊ - "siteInfo": {}␊ - }` - -## Add build.commandOrigin config if it came from contexts - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/command_origin_context",␊ - "config": {␊ - "build": {␊ - "command": "test",␊ - "commandOrigin": "config",␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/command_origin_context",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/command_origin_context/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/command_origin_context/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/command_origin_context/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/command_origin_context",␊ - "siteInfo": {}␊ - }` - -## Add build.commandOrigin ui if it came from defaultConfig - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/empty",␊ - "config": {␊ - "build": {␊ - "command": "test",␊ - "commandOrigin": "ui",␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/empty",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/empty/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/empty/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/empty",␊ - "siteInfo": {}␊ - }` - -## Assign default functions if functions.directory is not defined and default directory exists - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/default_functions_not_defined",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "functions": "packages/config/tests/normalize/fixtures/default_functions_not_defined/netlify/functions",␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/default_functions_not_defined",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_not_defined/netlify/functions",␊ - "functionsDirectoryOrigin": "default",␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/default_functions_not_defined/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_not_defined/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_not_defined",␊ - "siteInfo": {}␊ - }` - -## Assign default functions if functions.directory is not defined and the legacy default directory exists - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "functions": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined/netlify-automatic-functions",␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "functionsDirectory": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined/netlify-automatic-functions",␊ - "functionsDirectoryOrigin": "default-v1.0.0",␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/legacy_default_functions_not_defined",␊ - "siteInfo": {}␊ - }` - -## Does not assign default functions if default functions directory does not exist - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_not_defined_directory_not_found",␊ - "siteInfo": {}␊ - }` - -## Does not assign default functions if functions.directory is defined - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/default_functions_defined",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "functions": "packages/config/tests/normalize/fixtures/default_functions_defined/test",␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/default_functions_defined",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_defined/test",␊ - "functionsDirectoryOrigin": "config",␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/default_functions_defined/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/default_functions_defined/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_defined/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_defined",␊ - "siteInfo": {}␊ - }` - -## Does not assign default functions if build.functions is defined - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "functions": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/test",␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/test",␊ - "functionsDirectoryOrigin": "config-v1.0.0",␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_defined_legacy",␊ - "siteInfo": {}␊ - }` - -## Gives priority to functions.star over functions when defined first - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "functions": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/one",␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {␊ - "external_node_modules": [␊ - "testOne"␊ - ],␊ - "ignored_node_modules": [␊ - "testTwo"␊ - ]␊ - }␊ - },␊ - "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/one",␊ - "functionsDirectoryOrigin": "config",␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_star_priority_first",␊ - "siteInfo": {}␊ - }` - -## Gives priority to functions.star over functions when defined last - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "functions": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/one",␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {␊ - "external_node_modules": [␊ - "testOne"␊ - ],␊ - "ignored_node_modules": [␊ - "testTwo"␊ - ]␊ - }␊ - },␊ - "functionsDirectory": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/one",␊ - "functionsDirectoryOrigin": "config",␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/default_functions_star_priority_last",␊ - "siteInfo": {}␊ - }` - -## Assign default edge-functions if build.edge_functions is not defined - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined",␊ - "config": {␊ - "build": {␊ - "edge_functions": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined/netlify/edge-functions",␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/default_edge_functions_not_defined",␊ - "siteInfo": {}␊ - }` - -## Does not assign default edge-functions if build.edge_functions is defined - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/default_edge_functions_defined",␊ - "config": {␊ - "build": {␊ - "edge_functions": "packages/config/tests/normalize/fixtures/default_edge_functions_defined/test",␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/default_edge_functions_defined",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/default_edge_functions_defined/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/default_edge_functions_defined/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/default_edge_functions_defined/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/default_edge_functions_defined",␊ - "siteInfo": {}␊ - }` - -## Normalizes function configurations defined at the top level - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/function_config_top_level",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/function_config_top_level",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {␊ - "external_node_modules": [␊ - "module-one",␊ - "module-two"␊ - ],␊ - "node_bundler": "esbuild"␊ - }␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/function_config_top_level/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/function_config_top_level/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/function_config_top_level/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/function_config_top_level",␊ - "siteInfo": {}␊ - }` - -## Normalizes function configurations defined at different levels - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/function_config_all_levels",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/function_config_all_levels",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {␊ - "external_node_modules": [␊ - "module-one",␊ - "module-two"␊ - ],␊ - "node_bundler": "esbuild"␊ - },␊ - "my_function": {␊ - "external_node_modules": [␊ - "module-three"␊ - ],␊ - "node_bundler": "zisi"␊ - },␊ - "my_prefix_*": {␊ - "external_node_modules": [␊ - "module-four"␊ - ]␊ - },␊ - "other_prefix_*": {␊ - "node_bundler": "nft"␊ - }␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/function_config_all_levels/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/function_config_all_levels/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/function_config_all_levels/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/function_config_all_levels",␊ - "siteInfo": {}␊ - }` - -## Handles function configuration objects for functions with the same name as one of the configuration properties - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/function_config_ambiguous",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/function_config_ambiguous",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {},␊ - "external_node_modules": {␊ - "external_node_modules": [␊ - "module-three"␊ - ]␊ - }␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/function_config_ambiguous/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/function_config_ambiguous/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/function_config_ambiguous/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/function_config_ambiguous",␊ - "siteInfo": {}␊ - }` - -## Collects paths from `included_files` defined at different levels - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/function_config_included_files",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/function_config_included_files",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {␊ - "included_files": [␊ - "from-top"␊ - ]␊ - },␊ - "my_function": {␊ - "included_files": [␊ - "!from-glob/two",␊ - "from-function"␊ - ]␊ - },␊ - "my_prefix_*": {␊ - "included_files": [␊ - "!from-top/one",␊ - "from-glob"␊ - ]␊ - }␊ - },␊ - "headers": [],␊ - "plugins": [],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/function_config_included_files/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/function_config_included_files/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/function_config_included_files/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/function_config_included_files",␊ - "siteInfo": {}␊ - }` - -## Merges plugins in netlify.toml and defaultConfig - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [␊ - {␊ - "inputs": {␊ - "array": [␊ - "c",␊ - "d"␊ - ],␊ - "boolean": false,␊ - "object": {␊ - "prop": false,␊ - "unset": true␊ - },␊ - "unset": true␊ - },␊ - "origin": "config",␊ - "package": "netlify-plugin-test"␊ - },␊ - {␊ - "inputs": {␊ - "boolean": true␊ - },␊ - "origin": "config",␊ - "package": "netlify-plugin-test-two"␊ - }␊ - ],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/merge_netlify_toml_default",␊ - "siteInfo": {}␊ - }` - -## Merges context-specific plugins - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [␊ - {␊ - "inputs": {␊ - "array": [␊ - "c",␊ - "d"␊ - ],␊ - "boolean": false,␊ - "object": {␊ - "prop": false,␊ - "unset": true␊ - },␊ - "unset": true␊ - },␊ - "origin": "config",␊ - "package": "netlify-plugin-test"␊ - },␊ - {␊ - "inputs": {␊ - "boolean": true␊ - },␊ - "origin": "config",␊ - "package": "netlify-plugin-test-two"␊ - }␊ - ],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context",␊ - "siteInfo": {}␊ - }` - -## Context-specific plugins config is last in merged array - -> Snapshot 1 - - `{␊ - "accounts": [],␊ - "branch": "branch",␊ - "buildDir": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last",␊ - "config": {␊ - "build": {␊ - "environment": {},␊ - "processing": {␊ - "css": {},␊ - "html": {},␊ - "images": {},␊ - "js": {}␊ - },␊ - "publish": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last",␊ - "publishOrigin": "default",␊ - "services": {}␊ - },␊ - "functions": {␊ - "*": {}␊ - },␊ - "headers": [],␊ - "plugins": [␊ - {␊ - "inputs": {},␊ - "origin": "config",␊ - "package": "netlify-plugin-test-two"␊ - },␊ - {␊ - "inputs": {},␊ - "origin": "config",␊ - "package": "netlify-plugin-test"␊ - }␊ - ],␊ - "redirects": []␊ - },␊ - "configPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last/netlify.toml",␊ - "context": "production",␊ - "env": {␊ - "BRANCH": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "BUILD_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "CACHED_COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "COMMIT_REF": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "HEXADECIMAL_ID"␊ - },␊ - "CONTEXT": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "production"␊ - },␊ - "DEPLOY_ID": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "0"␊ - },␊ - "DEPLOY_PRIME_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://branch--site-name.netlify.app"␊ - },␊ - "DEPLOY_URL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "https://0--site-name.netlify.app"␊ - },␊ - "GATSBY_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "HEAD": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "branch"␊ - },␊ - "LANG": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "LANGUAGE": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US:en"␊ - },␊ - "LC_ALL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "en_US.UTF-8"␊ - },␊ - "NETLIFY_LOCAL": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "true"␊ - },␊ - "NEXT_TELEMETRY_DISABLED": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "1"␊ - },␊ - "PULL_REQUEST": {␊ - "sources": [␊ - "general"␊ - ],␊ - "value": "false"␊ - }␊ - },␊ - "headersPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last/_headers",␊ - "integrations": [],␊ - "redirectsPath": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last/_redirects",␊ - "repositoryRoot": "packages/config/tests/normalize/fixtures/merge_netlify_toml_context_last",␊ - "siteInfo": {}␊ - }` diff --git a/packages/config/tests/normalize/snapshots/tests.js.snap b/packages/config/tests/normalize/snapshots/tests.js.snap deleted file mode 100644 index 2db7a214f2..0000000000 Binary files a/packages/config/tests/normalize/snapshots/tests.js.snap and /dev/null differ diff --git a/packages/config/tests/normalize/tests.js b/packages/config/tests/normalize/tests.js deleted file mode 100644 index ede8adad34..0000000000 --- a/packages/config/tests/normalize/tests.js +++ /dev/null @@ -1,160 +0,0 @@ -import { Fixture, normalizeOutput } from '@netlify/testing' -import test from 'ava' - -test('build.command empty', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/command_empty').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Some properties can be capitalized', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/props_case').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Some properties can be capitalized even when merged with defaultConfig', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/props_case_default_config') - .withFlags({ - defaultConfig: { - Build: { - Base: 'base', - Command: 'gulp build default', - Edge_functions: 'edgeFunctions', - Functions: 'functions', - Ignore: 'doIgnore', - Publish: 'publish', - Environment: { TEST: 'test' }, - Processing: { css: { bundle: false } }, - }, - }, - }) - .runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Does not add build.commandOrigin config if there are none', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/empty').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Does not add build.commandOrigin config if command is empty', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/command_empty').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Add build.commandOrigin config if it came from netlify.toml', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/command_origin_config').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Add build.commandOrigin config if it came from contexts', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/command_origin_context').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Add build.commandOrigin ui if it came from defaultConfig', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/empty') - .withFlags({ - defaultConfig: { build: { command: 'test' } }, - }) - .runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Assign default functions if functions.directory is not defined and default directory exists', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/default_functions_not_defined').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Assign default functions if functions.directory is not defined and the legacy default directory exists', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/legacy_default_functions_not_defined').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Does not assign default functions if default functions directory does not exist', async (t) => { - const output = await new Fixture( - test.meta.file, - './fixtures/default_functions_not_defined_directory_not_found', - ).runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Does not assign default functions if functions.directory is defined', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/default_functions_defined').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Does not assign default functions if build.functions is defined', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/default_functions_defined_legacy').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Gives priority to functions.star over functions when defined first', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/default_functions_star_priority_first').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Gives priority to functions.star over functions when defined last', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/default_functions_star_priority_last').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Assign default edge-functions if build.edge_functions is not defined', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/default_edge_functions_not_defined').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Does not assign default edge-functions if build.edge_functions is defined', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/default_edge_functions_defined').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Normalizes function configurations defined at the top level', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/function_config_top_level').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Normalizes function configurations defined at different levels', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/function_config_all_levels').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Handles function configuration objects for functions with the same name as one of the configuration properties', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/function_config_ambiguous').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Collects paths from `included_files` defined at different levels', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/function_config_included_files').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Merges plugins in netlify.toml and defaultConfig', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/merge_netlify_toml_default') - .withFlags({ - defaultConfig: { - plugins: [ - { - package: 'netlify-plugin-test', - inputs: { - boolean: true, - unset: true, - array: ['a', 'b'], - object: { prop: true, unset: true }, - }, - }, - ], - }, - }) - .runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Merges context-specific plugins', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/merge_netlify_toml_context').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) - -test('Context-specific plugins config is last in merged array', async (t) => { - const output = await new Fixture(test.meta.file, './fixtures/merge_netlify_toml_context_last').runWithConfig() - t.snapshot(normalizeOutput(output)) -}) diff --git a/packages/config/vitest.config.ts b/packages/config/vitest.config.ts new file mode 100644 index 0000000000..941c7df6ba --- /dev/null +++ b/packages/config/vitest.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + restoreMocks: true, + environment: 'node', + testTimeout: 100_000, + include: ['tests/**/*.test.{js,ts}'], + exclude: ['**/fixtures/**', '**/node_modules/**'], + }, +})