{"name":"mocha-expect-snapshot","version":"7.1.0","keywords":["mocha","expect","snapshot","jest-snapshot","test","jest","jest-image-snapshot"],"_id":"mocha-expect-snapshot@7.1.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":"515a5d6d322032e324ce78bb7e273d0d3f5b3d40","tarball":"http://registry-npm.ywwl.com/mocha-expect-snapshot/download/mocha-expect-snapshot-7.1.0.tgz","fileCount":12,"integrity":"sha512-ROFkMmps9iU3igILichwQF9svk84FcECIaWt39K7khb+sEE9MS2aOOS3J4vJRUWpisDHts38EXzm66Y4O/9b2A==","signatures":[{"sig":"MEQCIH27a/vD7whK/2GZz6npUZewBNuCDj/fr+vRZD25TuWGAiBZYTS96xg+baIWcRYAChqiau8eBIjkjRD4p5yCPBVvpA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17402,"size":4986,"noattachment":false,"key":"/mocha-expect-snapshot/-/mocha-expect-snapshot-7.1.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":"c3b7b097a15fd013c2218d0d83d2beeea701f2dc","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":"10.8.2","description":"Mocha plugin to use `expect` with `jest-snapshot` and derived projects like `jest-image-snapshot`.","directories":{},"_nodeVersion":"18.20.5","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","expect":"^29.0.0"},"acceptDependencies":{"mocha":"^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mocha-expect-snapshot_7.1.0_1733509497512_0.27581991743103695","host":"s3://npm-registry-packages"},"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":1733509497699,"_cnpm_publish_time":1733509497699,"dist-tags":{"latest":"8.0.0"}}