{"name":"mocha-expect-snapshot","version":"7.2.0","keywords":["mocha","expect","snapshot","jest-snapshot","test","jest","jest-image-snapshot"],"_id":"mocha-expect-snapshot@7.2.0","maintainers":[{"name":"mshima","email":"marceloshima@gmail.com"}],"homepage":"https://github.com/mshima/mocha-expect-snapshot#readme","bugs":{"url":"https://github.com/mshima/mocha-expect-snapshot/issues"},"dist":{"shasum":"5fa2e3f494686f00a6186dbe5b92a5e2744e4f55","tarball":"http://registry-npm.ywwl.com/mocha-expect-snapshot/download/mocha-expect-snapshot-7.2.0.tgz","fileCount":12,"integrity":"sha512-76m3P1ozasF6bqxIIqdrYRZ6fnRBsUZoao+bYULFx3l0lj5xDsRUX2Xp0s2aKlmddgW8FkL/KkBE0xbiizn4aA==","signatures":[{"sig":"MEUCIQCKaX+VDMV28CKbZmiAJxqJqrZDlA/WKoDdsc7RV4V+vgIgcguKP0ZbsLDerD88ogpUH1SkT3Ya6fJkbPsnuqmPYLk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17436,"size":4999,"noattachment":false,"key":"/mocha-expect-snapshot/-/mocha-expect-snapshot-7.2.0.tgz"},"main":"./lib/jest-snapshot.js","types":"./lib/jest-snapshot-types.d.ts","engines":{"node":">=14.15.0"},"exports":{".":{"types":"./lib/jest-snapshot-types.d.ts","default":"./lib/jest-snapshot.js"},"./image":"./lib/jest-image-snapshot.js","./combined":{"types":"./lib/jest-snapshot-types.d.ts","default":"./lib/combined.js"},"./new-format":{"types":"./lib/jest-snapshot-types.d.ts","default":"./lib/jest-snapshot-new-format.js"},"./old-format":{"types":"./lib/jest-snapshot-types.d.ts","default":"./lib/jest-snapshot-old-format.js"}},"gitHead":"5511f1e7a434473b206926380a8f21109127a1e5","scripts":{"fix":"prettier --write . && eslint . --fix","test":"npm run mocha:serial && npm run mocha:parallel","update":"UPDATE_TEST_SNAPSHOT=true mocha && UPDATE_EXPECTED_SNAPSHOT=true mocha","pretest":"prettier --check . && eslint .","mocha:serial":"mocha --no-parallel","mocha:parallel":"nyc --reporter=text mocha --parallel"},"_npmUser":{"name":"mshima","email":"marceloshima@gmail.com"},"repository":{"url":"git://github.com/mshima/mocha-expect-snapshot.git","type":"git"},"_npmVersion":"11.1.0","description":"Mocha plugin to use `expect` with `jest-snapshot` and derived projects like `jest-image-snapshot`.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"expect":"^29.0.0","picocolors":"^1.1.1","@jest/expect":"^29.0.0","jest-snapshot":"^29.0.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","mocha":"^11.0.0","eslint":"^7.26.0","expect":"^29.0.0","prettier":"^2.3.1","proxyquire":"^2.1.3","@types/mocha":"^10.0.9","eslint-plugin-node":"^11.1.0","jest-image-snapshot":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-promise":"^5.1.0","prettier-plugin-packagejson":"^2.5.6"},"peerDependencies":{"mocha":"^8.4.0 || ^9.0.0 || ^10.0.0 || ^11.0.0","expect":"^29.0.0"},"peerDependenciesMeta":{"mocha":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/mocha-expect-snapshot_7.2.0_1739984135198_0.9566405051884392","host":"s3://npm-registry-packages-npm-production"},"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":1739984135388,"_cnpm_publish_time":1739984135388,"dist-tags":{"latest":"8.0.0"}}