Repository: eslint/eslint
File: lib/rule-tester/rule-tester.js (JavaScript)

Code before:
							actualLocation.line = message.line;
							expectedLocation.line = error.line;
						}

						if (hasOwnProperty(error, "column")) {
							actualLocation.column = message.column;
							expectedLocation.column = error.column;
						}

						if (hasOwnProperty(error, "endLine")) {
							actualLocation.endLine = message.endLine;
							expectedLocation.endLine = error.endLine;
						}

						if (hasOwnProperty(error, "endColumn")) {
							actualLocation.endColumn = message.endColumn;
							expectedLocation.endColumn = error.endColumn;
						}

						if (Object.keys(expectedLocation).length > 0) {
							assert.deepStrictEqual(
								actualLocation,
								expectedLocation,
								`Error location should be ${util.inspect(
									expectedLocation,
								)}, found ${util.inspect(actualLocation)}`,
							);
						}

						assert.ok(
							!message.suggestions ||
								hasOwnProperty(error, "suggestions"),
							`Error at index ${i} has suggestions. Please specify 'suggestions' property on the test error object.`,
						);
						if (hasOwnProperty(error, "suggestions")) {
							// Support asserting there are no suggestions
							const expectsSuggestions = Array.isArray(
								error.suggestions,
							)
								? error.suggestions.length > 0
								: Boolean(error.suggestions);
							const hasSuggestions =
								message.suggestions !== void 0;

							if (!hasSuggestions && expectsSuggestions) {
								assert.ok(
									!error.suggestions,
									`Error should have suggestions on error with message: "${message.message}"`,
								);
							} else if (hasSuggestions) {
								assert.ok(

Review comment (suggestion):
I would prefer if we will show the full actual location here for two reasons:

- If there is an error it helps with detecting the reported range
- It nudges developers to verify all location properties instead the subset they might be using.

```suggestion
								)}, found ${util.inspect(fullActualLocation)}`,
```

Code after:
							actualLocation.line = message.line;
							expectedLocation.line = error.line;
						}

						if (hasOwnProperty(error, "column")) {
							actualLocation.column = message.column;
							expectedLocation.column = error.column;
						}

						if (hasOwnProperty(error, "endLine")) {
							actualLocation.endLine = message.endLine;
							expectedLocation.endLine = error.endLine;
						}

						if (hasOwnProperty(error, "endColumn")) {
							actualLocation.endColumn = message.endColumn;
							expectedLocation.endColumn = error.endColumn;
						}

						if (Object.keys(expectedLocation).length > 0) {
							assert.deepStrictEqual(
								actualLocation,
								expectedLocation,
								"Actual error location does not match expected error location.",
							);
						}

						assert.ok(
							!message.suggestions ||
								hasOwnProperty(error, "suggestions"),
							`Error at index ${i} has suggestions. Please specify 'suggestions' property on the test error object.`,
						);
						if (hasOwnProperty(error, "suggestions")) {
							// Support asserting there are no suggestions
							const expectsSuggestions = Array.isArray(
								error.suggestions,
							)
								? error.suggestions.length > 0
								: Boolean(error.suggestions);
							const hasSuggestions =
								message.suggestions !== void 0;

							if (!hasSuggestions && expectsSuggestions) {
								assert.ok(
									!error.suggestions,
									`Error should have suggestions on error with message: "${message.message}"`,
								);
							} else if (hasSuggestions) {
								assert.ok(
									expectsSuggestions,
									`Error should have no suggestions on error with message: "${message.message}"`,