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

Code before:
						sinon.match.any,
						sinon.match(/^ESLintInactiveFlag_/u),
					)
					.returns();
			});

			afterEach(() => {
				delete process.env.ESLINT_FLAGS;
			});

			it("should return true if the flag is present and active", () => {
				eslint = new ESLint({
					cwd: getFixturePath(),
					flags: ["test_only"],
				});

				assert.strictEqual(eslint.hasFlag("test_only"), true);
			});

			it("should return true if the flag is present and active with ESLINT_FLAGS", () => {
				process.env.ESLINT_FLAGS = "test_only";
				eslint = new ESLint({
					cwd: getFixturePath(),
					flags: ["test_only"],
				});
				assert.strictEqual(eslint.hasFlag("test_only"), true);
			});

			it("should return true for multiple flags in ESLINT_FLAGS if the flag is present and active and one is duplicated in the API", () => {
				process.env.ESLINT_FLAGS = "test_only,test_only_2";

				eslint = new ESLint({
					cwd: getFixturePath(),
					flags: ["test_only"], // intentional duplication
				});

				assert.strictEqual(eslint.hasFlag("test_only"), true);
				assert.strictEqual(eslint.hasFlag("test_only_2"), true);
			});

			it("should return true for the replacement flag if an inactive flag that has been replaced is used", () => {
				eslint = new ESLint({
					cwd: getFixturePath(),
					flags: ["test_only_replaced"],
				});

				assert.strictEqual(eslint.hasFlag("test_only"), true);
				assert.strictEqual(
					processStub.callCount,
					1,
					"calls `process.emitWarning()` for flags once",

Review comment (bug):
```suggestion
			});
			
			it("should merge flags passed through API with flags passed through ESLINT_FLAGS", () => {
				process.env.ESLINT_FLAGS = "test_only";
				eslint = new ESLint({
					cwd: getFixturePath(),
					flags: ["test_only_2"],
				});
				assert.strictEqual(eslint.hasFlag("test_only"), true);
				assert.strictEqual(eslint.hasFlag("test_only_2"), true);
			});
```

It would be good to ensure the flags are merged. Currently, if we remove `...flags` from the merge function, no tests would fail.

Code after:
						sinon.match.any,
						sinon.match(/^ESLintInactiveFlag_/u),
					)
					.returns();
			});

			afterEach(() => {
				delete process.env.ESLINT_FLAGS;
			});

			it("should return true if the flag is present and active", () => {
				eslint = new ESLint({
					cwd: getFixturePath(),
					flags: ["test_only"],
				});

				assert.strictEqual(eslint.hasFlag("test_only"), true);
			});

			it("should return true if the flag is present and active with ESLINT_FLAGS", () => {
				process.env.ESLINT_FLAGS = "test_only";
				eslint = new ESLint({
					cwd: getFixturePath(),
				});
				assert.strictEqual(eslint.hasFlag("test_only"), true);
			});

			it("should merge flags passed through API with flags passed through ESLINT_FLAGS", () => {
				process.env.ESLINT_FLAGS = "test_only";
				eslint = new ESLint({
					cwd: getFixturePath(),
					flags: ["test_only_2"],
				});
				assert.strictEqual(eslint.hasFlag("test_only"), true);
				assert.strictEqual(eslint.hasFlag("test_only_2"), true);
			});

			it("should return true for multiple flags in ESLINT_FLAGS if the flag is present and active and one is duplicated in the API", () => {
				process.env.ESLINT_FLAGS = "test_only,test_only_2";

				eslint = new ESLint({
					cwd: getFixturePath(),
					flags: ["test_only"], // intentional duplication
				});

				assert.strictEqual(eslint.hasFlag("test_only"), true);
				assert.strictEqual(eslint.hasFlag("test_only_2"), true);
			});

			it("should return true for multiple flags in ESLINT_FLAGS if the flag is present and active and there is leading and trailing white space", () => {
				process.env.ESLINT_FLAGS = " test_only, test_only_2 ";