Repository: eslint/eslint
File: tests/lib/eslint/eslint.js (JavaScript)

Code before:
					await engine.loadFormatter("table-external");
				},
				error => {
					assert.ok(
						error.message.includes(
							"There was a problem loading formatter",
						) &&
							!error.message.includes(
								"no longer part of core ESLint",
							),
						`Unexpected error message: ${error.message}`,
					);
					return true;
				},
			);
		});

		it("should throw if a removed formatter from node_modules throws on loading", async () => {
			const engine = new ESLint();
			const formatterPath = getFixturePath(
				"cli-engine/node_modules/eslint-formatter-checkstyle/index.js",
			);

			await assert.rejects(async () => {
				await engine.loadFormatter(formatterPath);
			}, /There was a problem loading formatter.*Error: Formatter loading failed/su);
		});
	});

	describe("getErrorResults()", () => {
		it("should report 5 error messages when looking for errors only", async () => {
			process.chdir(originalDir);
			const engine = new ESLint({
				overrideConfigFile: true,
				overrideConfig: {
					rules: {
						quotes: "error",
						"no-var": "error",
						"eol-last": "error",
						"no-unused-vars": "error",
					},
				},
			});
			const results = await engine.lintText("var foo = 'bar';");
			const errorResults = ESLint.getErrorResults(results);

			assert.strictEqual(
				errorResults[0].messages.length,
				4,
				"messages.length is wrong",
			);

Review comment (bug):
```suggestion
			const engine = new ESLint({
				cwd: getFixturePath("cli-engine"),
			});

			await assert.rejects(async () => {
				await engine.loadFormatter("checkstyle");
			}, /There was a problem loading formatter.*Error: Formatter loading failed/su);
```

We should pass just the formatter name to verify that the problem is fixed. With the full path, the test was passing without the code change.

Code after:
					await engine.loadFormatter("table-external");
				},
				error => {
					assert.ok(
						error.message.includes(
							"There was a problem loading formatter",
						) &&
							!error.message.includes(
								"no longer part of core ESLint",
							),
						`Unexpected error message: ${error.message}`,
					);
					return true;
				},
			);
		});

		it("should throw if a removed formatter from node_modules throws on loading", async () => {
			const engine = new ESLint({
				cwd: getFixturePath("cli-engine"),
			});

			await assert.rejects(async () => {
				await engine.loadFormatter("checkstyle");
			}, /There was a problem loading formatter.*Error: Formatter loading failed/su);
		});
	});

	describe("getErrorResults()", () => {
		it("should report 5 error messages when looking for errors only", async () => {
			process.chdir(originalDir);
			const engine = new ESLint({
				overrideConfigFile: true,
				overrideConfig: {
					rules: {
						quotes: "error",
						"no-var": "error",
						"eol-last": "error",
						"no-unused-vars": "error",
					},
				},
			});
			const results = await engine.lintText("var foo = 'bar';");
			const errorResults = ESLint.getErrorResults(results);

			assert.strictEqual(
				errorResults[0].messages.length,
				4,
				"messages.length is wrong",
			);
			assert.strictEqual(