evanw/esbuild · warning · Error

UPDATE NEEDED: expected failure for ${basename}: ${test.name

Error message

UPDATE NEEDED: expected failure for ${basename}: ${test.name}, please remove this test from known failure list

What it means

Thrown at scripts/uglify-tests.js:296 inside the stdout-comparison step. A uglifyJS test is listed in the hardcoded known-failure list (lines 245-270) and `isExpectingFailure` is true, yet `sandbox.same_stdout(test.expect_stdout, actual)` now returns true — i.e. esbuild produces matching output where it previously differed. This is a positive signal: esbuild fixed the case, so the entry must be pruned from the list.

Source

Thrown at scripts/uglify-tests.js:296

      log([
        "!!! failed",
        "---INPUT---",
        "{input}",
        "---EXPECTED {expected_type}---",
        "{expected}",
        "---ACTUAL {actual_type}---",
        "{actual}",
        "",
        "",
      ].join("\n"), {
        input: input_formatted,
        expected_type: typeof test.expect_stdout == "string" ? "STDOUT" : "ERROR",
        expected: test.expect_stdout,
        actual_type: typeof actual == "string" ? "STDOUT" : "ERROR",
        actual: actual,
      });
    } else if (isExpectingFailure) {
      throw new Error(`UPDATE NEEDED: expected failure for ${basename}: ${test.name}, please remove this test from known failure list`);
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// The code below was copied verbatim from "uglify/demo/test/compress.js"
//
// UglifyJS is released under the BSD license:
//
// Copyright 2012-2019 (c) Mihai Bazon <mihai.bazon@gmail.com>
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
//     * Redistributions of source code must retain the above
//       copyright notice, this list of conditions and the following
//       disclaimer.

View on GitHub (pinned to f6058f8364)

Solutions

  1. Copy the `${basename}: ${test.name}` string from the error message.
  2. Delete the matching quoted entry from the known-failure array in scripts/uglify-tests.js (around lines 246-270).
  3. Re-run the uglify test suite to confirm a clean pass.

Example fix

// before (entry still present in known-failure list)
'classes.js: issue_4722_1',
'classes.js: issue_4722_2',

// after (remove the now-passing entry)
'classes.js: issue_4722_2',
Defensive patterns

Strategy: validation

Validate before calling

// Before committing, locally force the known-failure path off to detect now-passing tests
process.env.CI = ''; // run uglify-tests.js with isExpectingFailure disabled to see what passes
// Then, with CI set, ensure no entry in the list still passes:
// (manual: remove any basename:name that no longer fails)

Try / catch

try { runUglifyTests(); }
catch (e) {
  if (/UPDATE NEEDED: expected failure/.test(e.message)) {
    const m = e.message.match(/expected failure for ([^:]+): ([^,]+)/);
    console.log(`Remove '${m[1]}: ${m[2]}' from the known-failure list in scripts/uglify-tests.js`);
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the uglify test suite (typically under CI, since the known-failure list is only consulted when process.env.CI is set) after an esbuild change that makes a previously-failing test pass. The exact `basename: test.name` string to remove is included in the message.

Common situations: An esbuild minification/transform improvement lands and a test like `classes.js: issue_4722_1` starts passing. The CI run then fails this assertion until the matching string is deleted from the array at lines 245-270.

Related errors


AI-assisted analysis of evanw/esbuild@f6058f8364 (2026-08-09). Data as JSON: /api/errors/87cbf7966b75485a. Report an issue: GitHub.