{"id":"04f53955892e307b","repo":"vitest-dev/vitest","slug":"msg-stripped-matching-stripped-1-p","errorCode":null,"errorMessage":"${msg}\n(${stripped} matching ${stripped === 1 ? 'property' : 'properties'} omitted from actual)","messagePattern":"(.+?)\n\\((.+?) matching (.+?) omitted from actual\\)","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"error","filePath":"packages/expect/src/jest-expect.ts","lineNumber":217,"sourceCode":"      expected,\n      customTesters,\n    )\n    if ((pass && isNot) || (!pass && !isNot)) {\n      const msg = utils.getMessage(this, [\n        pass,\n        'expected #{this} to match object #{exp}',\n        'expected #{this} to not match object #{exp}',\n        expected,\n        actualSubset,\n        false,\n      ])\n      const message\n        = stripped === 0\n          ? msg\n          : `${msg}\\n(${stripped} matching ${\n            stripped === 1 ? 'property' : 'properties'\n          } omitted from actual)`\n      throw new AssertionError(message, {\n        showDiff: true,\n        expected,\n        actual: actualSubset,\n      })\n    }\n  })\n  def('toMatch', function (expected: string | RegExp) {\n    const actual = this._obj as string\n    if (typeof actual !== 'string') {\n      throw new TypeError(\n        `.toMatch() expects to receive a string, but got ${typeof actual}`,\n      )\n    }\n\n    return this.assert(\n      typeof expected === 'string'\n        ? actual.includes(expected)\n        : actual.match(expected),","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/expect/src/jest-expect.ts#L199-L235","documentation":"Failure message emitted by the toMatchObject matcher when, during subset equality comparison, some properties that were also present on the actual object were 'stripped' (omitted) from the diff output because they matched. The (N matching property|properties omitted from actual) suffix tells the developer how many keys were elided from the visible diff so the message stays readable.","triggerScenarios":"expect(actual).toMatchObject(expected) (or the .not form) fails the subsetEquality check AND stripped > 0. 'stripped' counts keys that exist on actual but were matched-and-removed by the subsetEquality tester before diffing. Fires whenever the assertion does not pass and at least one actual-side key matched the expected subset.","commonSituations":"Large actual objects compared against smaller expected subsets — common when matching a partial response payload from an API or DB row. The omission note surprises developers who think properties are missing when they are actually just hidden for brevity.","solutions":["Inspect the full diff: the matched properties are intentionally hidden; use expect(actual).toEqual(expected) if you want a complete comparison.","If you expected the omitted properties to differ, verify the actual value actually differs — subsetEquality may have treated them as equal due to deep equality semantics.","Narrow the expected object to only the fields under test to reduce noise."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const matchedKeys = Object.keys(expected).filter(k => k in actual);\n// 'stripped' will equal matchedKeys.length; pass it to a custom logger if needed","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use toEqual when you need the full object compared; toMatchObject intentionally hides matched keys.","When debugging subsetEquality, log Object.keys(actual) vs Object.keys(expected) to see what is elided."],"tags":["assertion","tomatchobject","diff","subset-equality"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}