{"name":"mocha-expect-snapshot","version":"8.0.0","keywords":["mocha","expect","snapshot","jest-snapshot","test","jest","jest-image-snapshot"],"bugs":{"url":"https://github.com/mshima/mocha-expect-snapshot/issues"},"repository":{"type":"git","url":"git://github.com/mshima/mocha-expect-snapshot.git"},"exports":{".":{"types":"./lib/jest-snapshot-types.d.ts","default":"./lib/jest-snapshot.js"},"./old-format":{"types":"./lib/jest-snapshot-types.d.ts","default":"./lib/jest-snapshot-old-format.js"},"./new-format":{"types":"./lib/jest-snapshot-types.d.ts","default":"./lib/jest-snapshot-new-format.js"},"./combined":{"types":"./lib/jest-snapshot-types.d.ts","default":"./lib/combined.js"},"./image":"./lib/jest-image-snapshot.js"},"main":"./lib/jest-snapshot.js","types":"./lib/jest-snapshot-types.d.ts","scripts":{"fix":"prettier --write . && eslint . --fix","mocha:parallel":"nyc --reporter=text mocha --parallel","mocha:serial":"mocha --no-parallel","pretest":"prettier --check . && eslint .","test":"npm run mocha:serial && npm run mocha:parallel","update":"UPDATE_TEST_SNAPSHOT=true mocha && UPDATE_EXPECTED_SNAPSHOT=true mocha"},"dependencies":{"@jest/expect":"^30.0.5","expect":"^30.0.5","jest-snapshot":"^30.0.5","picocolors":"^1.1.1"},"devDependencies":{"@types/mocha":"^10.0.9","eslint":"^7.26.0","eslint-plugin-import":"^2.22.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","expect":"^30.0.5","jest-image-snapshot":"^6.5.1","mocha":"^11.0.0","nyc":"^15.1.0","prettier":"^3.6.2","prettier-plugin-packagejson":"^2.5.6","proxyquire":"^2.1.3"},"peerDependencies":{"expect":"^30.0.5","mocha":"^8.4.0 || ^9.0.0 || ^10.0.0 || ^11.0.0"},"peerDependenciesMeta":{"mocha":{"optional":true}},"engines":{"node":"^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"},"_id":"mocha-expect-snapshot@8.0.0","gitHead":"b4c6292c5b68c7ef4b224402ed56ebbf5f0948ef","description":"Mocha plugin to use `expect` with `jest-snapshot` and derived projects like `jest-image-snapshot`.","homepage":"https://github.com/mshima/mocha-expect-snapshot#readme","_nodeVersion":"22.18.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-31opd7KERtCmfOYmRq1Ij2QqnUDdQFLhrg1Bzv4arpJSZ1i5WBnsOuTHsbydZ9TKvI2gn8fKwVe+73lfwL/cOA==","shasum":"44302a551b9e4769a5ff6dd1245bd0a57b85625f","tarball":"http://registry-npm.ywwl.com/mocha-expect-snapshot/download/mocha-expect-snapshot-8.0.0.tgz","fileCount":12,"unpackedSize":17469,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD55XnexlLgu+3PGIVmZwVeykNGHDTcB+jWZvcdTfvlyAIhAPIzyxOD3VMHyXrgy9Vt536DbKgEMdH0UOnYrFGShRsW"}],"size":5008,"noattachment":false,"key":"/mocha-expect-snapshot/-/mocha-expect-snapshot-8.0.0.tgz"},"_npmUser":{"name":"mshima","email":"marceloshima@gmail.com"},"directories":{},"maintainers":[{"name":"mshima","email":"marceloshima@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mocha-expect-snapshot_8.0.0_1755053620572_0.6379049790742652"},"_hasShrinkwrap":false,"readme":"# mocha-expect-snapshot\n\nMocha plugin to use `expect` with `jest-snapshot` and derived projects like `jest-image-snapshot`.\n\n## Usage\n\nConfigure as a mocha [module](https://mochajs.org/#-require-module-r-module).\n\n```json\n{\n  \"require\": \"mocha-expect-snapshot\"\n}\n```\n\nImplement test.\n\n```js\nconst { expect } = require('expect');\n\ndescribe('foo', function () {\n  it('matches the snapshot', function () {\n    expect({ foo: 'bar' }).toMatchSnapshot();\n\n    expect({ foo: 'bar' }).toMatchInlineSnapshot(`\nObject {\n  \"foo\": \"bar\",\n}\n`);\n  });\n});\n```\n\nTyped expect\n\n```js\nimport { jestExpect as expect } from 'mocha-expect-snapshot';\n\ndescribe('foo', function () {\n  it('matches the snapshot', function () {\n    expect({ foo: 'bar' }).toMatchSnapshot();\n\n    expect({ foo: 'bar' }).toMatchInlineSnapshot(`\nObject {\n  \"foo\": \"bar\",\n}\n`);\n  });\n});\n```\n\nUpdate snapshots by passing --updateSnapshot option to mocha (not compatible with parallel mode).\n\n```sh\nmocha --updateSnapshot\n```\n\nOr by passing `UPDATE_SNAPSHOT` environment variable with value `all` or `new`.\n\n```sh\nUPDATE_SNAPSHOT=all mocha\n```\n\n### jest-image-snapshot\n\nInstall.\n\n```sh\nnpm install jest-image-snapshot --save-dev\n```\n\nConfigure as a mocha [module](https://mochajs.org/#-require-module-r-module).\n\n```json\n{\n  \"require\": [\"mocha-expect-snapshot/image\"]\n}\n```\n\nFor both:\n\n```json\n{\n  \"require\": [\"mocha-expect-snapshot/combined\"]\n}\n```\n\nCreate tests.\n\n```js\nconst { expect } = require('expect');\n\nit('test image', () => {\n  const image = ...\n  expect(image).toMatchImageSnapshot();\n});\n```\n\n### Custom configuration\n\nFile specific configuration must be set at top-level before, SnapshotState is created once per file:\n\n```js\nconst { expect } = require('expect');\n\ndescribe('foo', function () {\n  before(function () {\n    // https://github.com/facebook/jest/blob/817d8b6aca845dd4fcfd7f8316293e69f3a116c5/packages/jest-snapshot/src/State.ts#L25-L30\n    this.snapshotStateOptions = { updateSnapshot: 'new' };\n    this.snapshotFile = '/foo';\n  });\n\n  it('matches the snapshot', function () {\n    expect({ foo: 'bar' }).toMatchSnapshot();\n  });\n\n  it('matches the inline snapshot', function () {\n    expect({ foo: 'bar' }).toMatchInlineSnapshot(`\nObject {\n  \"foo\": \"bar\",\n}\n`);\n  });\n});\n```\n\nGlobal configuration must be implemented with a custom [hook plugin](https://mochajs.org/#defining-a-root-hook-plugin]\n\n```js\n// test/hooks.js\nconst {\n  setSnapshotResolver,\n  getSnapshotResolver,\n  setSnapshotResolverOptions,\n  getSnapshotResolverOptions,\n  setSnapshotStateOptions,\n  getSnapshotStateOptions,\n  mochaHooks,\n} = require('mocha-expect-snapshot');\n\n// set your custom config\n\nmodule.exports = {\n  mochaHooks,\n};\n```\n\n```json\n{\n  \"require\": \"./test/hooks.js\"\n}\n```\n\nThis module is a reimplementation of [expect-mocha-snapshot](https://github.com/blogfoster/expect-mocha-snapshot).\n\n## License\n\nMIT\n","publish_time":1755053620915,"_cnpm_publish_time":1755053620915,"dist-tags":{"latest":"8.0.0"}}