{"record":{"id":"0faa29987c4eba36","repo":"avajs/ava","slug":"the-watchmode-ignorechanges-configuration-must-b","errorCode":null,"errorMessage":"The ’watchMode.ignoreChanges’ configuration must be an array containing glob patterns.","messagePattern":"The ’watchMode\\.ignoreChanges’ configuration must be an array containing glob patterns\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/globs.js","lineNumber":41,"sourceCode":"\tnormalizePatterns,\n} from './glob-helpers.js';\n\nconst defaultIgnoredByWatcherPatterns = [\n\t'**/*.snap.md', // No need to rerun tests when the Markdown files change.\n\t'**/*.tsbuildinfo', // No need to rerun tests when TypeScript build info files change.\n\t'ava.config.js', // Config is not reloaded so avoid rerunning tests when it changes.\n\t'ava.config.mjs', // Config is not reloaded so avoid rerunning tests when it changes.\n];\n\nconst buildExtensionPattern = extensions => extensions.length === 1 ? extensions[0] : `{${extensions.join(',')}}`;\n\nexport function normalizeGlobs({extensions, files: filePatterns, ignoredByWatcher: ignoredByWatcherPatterns, providers}) {\n\tif (filePatterns !== undefined && (!Array.isArray(filePatterns) || filePatterns.length === 0)) {\n\t\tthrow new Error('The ’files’ configuration must be an array containing glob patterns.');\n\t}\n\n\tif (ignoredByWatcherPatterns !== undefined && (!Array.isArray(ignoredByWatcherPatterns) || ignoredByWatcherPatterns.length === 0)) {\n\t\tthrow new Error('The ’watchMode.ignoreChanges’ configuration must be an array containing glob patterns.');\n\t}\n\n\tconst extensionPattern = buildExtensionPattern(extensions);\n\tconst defaultTestPatterns = [\n\t\t`test.${extensionPattern}`,\n\t\t`{src,source}/test.${extensionPattern}`,\n\t\t`**/__tests__/**/*.${extensionPattern}`,\n\t\t`**/*.spec.${extensionPattern}`,\n\t\t`**/*.test.${extensionPattern}`,\n\t\t`**/test-*.${extensionPattern}`,\n\t\t`**/test/**/*.${extensionPattern}`,\n\t\t`**/tests/**/*.${extensionPattern}`,\n\t\t'!**/__tests__/**/__{helper,fixture}?(s)__/**/*',\n\t\t'!**/test?(s)/**/{helper,fixture}?(s)/**/*',\n\t];\n\n\tif (filePatterns) {\n\t\tfilePatterns = normalizePatterns(filePatterns);","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/avajs/ava/blob/bbfd946322fdeca2b547a691d947fb4e18c0c67f/lib/globs.js#L23-L59","documentation":"The `watchMode.ignoreChanges` option tells AVA's watcher which file changes to skip; it must be a non-empty array of glob patterns. normalizeGlobs throws this error when the option is present but is not an array or is empty.","triggerScenarios":"Setting `watchMode: {ignoreChanges: 'fixtures/**'}` (string instead of array) or `watchMode: {ignoreChanges: []}` in ava.config.js/package.json or via the API.","commonSituations":"Doc examples copied as bare strings; empty arrays after config filtering; YAML configs where the value parses as a scalar rather than a list.","solutions":["Use an array: `watchMode: {ignoreChanges: ['fixtures/**']}`.","Remove the empty array — omit the key to use default ignore behavior.","Validate Array.isArray and length before passing the value.","Check config generation/merging code that may flatten the list."],"exampleFix":"// before\nexport default {watchMode: {ignoreChanges: 'fixtures/**'}};\n// after\nexport default {watchMode: {ignoreChanges: ['fixtures/**']}};","handlingStrategy":"validation","validationCode":"const ig = config.watchMode?.ignoreChanges;\nif (ig !== undefined && (!Array.isArray(ig) || ig.length === 0)) {\n  throw new TypeError('watchMode.ignoreChanges must be a non-empty array of glob strings');\n}","typeGuard":"const isValidIgnoreChanges = v => v === undefined || (Array.isArray(v) && v.length > 0 && v.every(p => typeof p === 'string'));","tryCatchPattern":"try {\n  await run();\n} catch (err) {\n  if (err.message.includes('watchMode.ignoreChanges')) {\n    console.error('ignoreChanges must be a non-empty array of globs');\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Always use array syntax for ignoreChanges patterns.","Omit the option rather than passing [] when nothing needs ignoring.","Quote globs in YAML/JSON so they stay strings and lists.","Re-validate the option after any config-generation change."],"tags":["configuration","validation","watch-mode","globs"],"backgroundTag":"schema-validation-failed","analyzedSha":"bbfd946322fdeca2b547a691d947fb4e18c0c67f","analyzedAt":"2026-09-02T01:24:43.834Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}