avajs/ava · error · Error
The ’watchMode.ignoreChanges’ configuration must be an array
Error message
The ’watchMode.ignoreChanges’ configuration must be an array containing glob patterns.
What it means
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.
Source
Thrown at lib/globs.js:41
normalizePatterns,
} from './glob-helpers.js';
const defaultIgnoredByWatcherPatterns = [
'**/*.snap.md', // No need to rerun tests when the Markdown files change.
'**/*.tsbuildinfo', // No need to rerun tests when TypeScript build info files change.
'ava.config.js', // Config is not reloaded so avoid rerunning tests when it changes.
'ava.config.mjs', // Config is not reloaded so avoid rerunning tests when it changes.
];
const buildExtensionPattern = extensions => extensions.length === 1 ? extensions[0] : `{${extensions.join(',')}}`;
export function normalizeGlobs({extensions, files: filePatterns, ignoredByWatcher: ignoredByWatcherPatterns, providers}) {
if (filePatterns !== undefined && (!Array.isArray(filePatterns) || filePatterns.length === 0)) {
throw new Error('The ’files’ configuration must be an array containing glob patterns.');
}
if (ignoredByWatcherPatterns !== undefined && (!Array.isArray(ignoredByWatcherPatterns) || ignoredByWatcherPatterns.length === 0)) {
throw new Error('The ’watchMode.ignoreChanges’ configuration must be an array containing glob patterns.');
}
const extensionPattern = buildExtensionPattern(extensions);
const defaultTestPatterns = [
`test.${extensionPattern}`,
`{src,source}/test.${extensionPattern}`,
`**/__tests__/**/*.${extensionPattern}`,
`**/*.spec.${extensionPattern}`,
`**/*.test.${extensionPattern}`,
`**/test-*.${extensionPattern}`,
`**/test/**/*.${extensionPattern}`,
`**/tests/**/*.${extensionPattern}`,
'!**/__tests__/**/__{helper,fixture}?(s)__/**/*',
'!**/test?(s)/**/{helper,fixture}?(s)/**/*',
];
if (filePatterns) {
filePatterns = normalizePatterns(filePatterns);View on GitHub (pinned to bbfd946322)
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.
Example fix
// before
export default {watchMode: {ignoreChanges: 'fixtures/**'}};
// after
export default {watchMode: {ignoreChanges: ['fixtures/**']}}; Defensive patterns
Strategy: validation
Validate before calling
const ig = config.watchMode?.ignoreChanges;
if (ig !== undefined && (!Array.isArray(ig) || ig.length === 0)) {
throw new TypeError('watchMode.ignoreChanges must be a non-empty array of glob strings');
} Type guard
const isValidIgnoreChanges = v => v === undefined || (Array.isArray(v) && v.length > 0 && v.every(p => typeof p === 'string'));
Try / catch
try {
await run();
} catch (err) {
if (err.message.includes('watchMode.ignoreChanges')) {
console.error('ignoreChanges must be a non-empty array of globs');
process.exitCode = 1;
} else throw err;
} Prevention
- 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.
When it happens
Trigger: Setting `watchMode: {ignoreChanges: 'fixtures/**'}` (string instead of array) or `watchMode: {ignoreChanges: []}` in ava.config.js/package.json or via the API.
Common situations: Doc examples copied as bare strings; empty arrays after config filtering; YAML configs where the value parses as a scalar rather than a list.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- The ’files’ configuration must be an array containing glob p
- The ’environmentVariables’ configuration must be an object c
- The extensions option must be an array
- Unexpected duplicate extensions in options: ’${[...duplicate
- ${fileForErrorMessage} must export a plain object or factory
AI-assisted analysis of avajs/ava@bbfd946322 (2026-09-02).
Data as JSON: /api/errors/0faa29987c4eba36.
Report an issue: GitHub.