{"_id":"fs-teardown","_rev":"11-e94bcb7c9bc1ce64d9d5412bf24f2a1c","name":"fs-teardown","dist-tags":{"latest":"0.3.2","beta":"0.3.1-beta.2"},"versions":{"0.1.0":{"name":"fs-teardown","version":"0.1.0","description":"Tear down a directory structure written to disk. Clean up afterwards.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"test":"jest","clean":"rimraf lib/**/*","build":"rollup -c rollup.config.ts","prepublishOnly":"yarn test && yarn clean && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^15.0.0","@rollup/plugin-node-resolve":"^9.0.0","@types/fs-extra":"^9.0.1","@types/jest":"^26.0.10","@types/node":"^14.6.0","jest":"^26.4.2","rimraf":"^3.0.2","rollup":"^2.26.5","rollup-plugin-typescript2":"^0.27.2","ts-jest":"^26.2.0","typescript":"^4.0.2"},"dependencies":{"fs-extra":"^9.0.1"},"_id":"fs-teardown@0.1.0","dist":{"shasum":"2e6df13995ed2733f58c9a97c1ca06fa0f72e94a","integrity":"sha512-BedRX7AdcWyjMNHKSeZlzprqmGxq0+10jD7WPFWj/5b+c4WYeB6QFeDXTEBvjuW6Y9Zd3z/E6uGSjyF1ZPOHOg==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.1.0.tgz","fileCount":7,"unpackedSize":89671,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRTyWCRA9TVsSAnZWagAAO1sP+gLkLDCJmRpjMudCknb5\nvaSRGTS7+YhqVyNl7ZHSoUjvkbMCuUF+/Wd0eO2fVyXM8UB0FFBAdaie5OCj\nYGv7D3otvrcfTU1kehBK1u+ZTl7wRugxxexpT6EWfuEBhcgYxqtaB942isZL\nMxxWyxQ/JuzAR/myBvEVP/SqZ0Ck9JJwzqYYUzYPEb2IZRq8nsnlNQQu8v7V\nabDT7Nx1Ll/XpwbmiRP3GsIHmh2jzZJ9hfsbor90Ckw4bLJKkE+qq5J2Gd8j\nvDrj+XAfIk3P/MG6GFo9/cEctRbVpB43c7KrtCawmqsK4fDqFmNwEkd4NWaY\nTg2lc3PvRimpuG3l0v0NRelt+eCKA4N5wF93QdwzS7K2GKDv+yubhI3OG6Uq\n/J64FJ1Od0spi6vl1dnyWhqBbZosggq1j4PBNp6X10GKY0HVbMVnBUZ3Vu9t\n3bYZoBRkUMByjSMlRuwwUZliR3uCOV2XoZKBcclz0tDpVO1IV/LE0g+JNNb5\nxJu5r5qTcXyjqyxuc9USNE453oNHXLRKsyqcO1wULbXZ9zv2xQjXobqie5jb\n6z5jnbdaEzM5snWoetVZoBom3JPDtU1pbXLgoNurWQ1n8i3P7PUF91krwvk5\napw6/Hw64oZdFQ8h+cJBUmoifXx3lrq5+pIBcHW9CcihXhArRjptyH2Hj261\nhOM2\r\n=atBT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICmiO7aTD95bhz1H/jrXnE2Ta+VHcIbONkL/j6aUFaxdAiANVSXhlmCeTtMbrxb7T10bQC+0AITyNFzFGUc4Q6PnGQ=="}]},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.1.0_1598373014485_0.10678320688731757"},"_hasShrinkwrap":false},"0.1.1":{"name":"fs-teardown","version":"0.1.1","description":"Tear down a directory structure written to disk. Clean up afterwards.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"test":"jest","clean":"rimraf lib/**/*","build":"rollup -c rollup.config.ts","prepublishOnly":"yarn test && yarn clean && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^15.0.0","@rollup/plugin-node-resolve":"^9.0.0","@types/fs-extra":"^9.0.1","@types/jest":"^26.0.10","@types/node":"^14.6.0","jest":"^26.4.2","rimraf":"^3.0.2","rollup":"^2.26.5","rollup-plugin-typescript2":"^0.27.2","ts-jest":"^26.2.0","typescript":"^4.0.2"},"dependencies":{"fs-extra":"^9.0.1"},"_id":"fs-teardown@0.1.1","dist":{"shasum":"cf23e42b4116e7bd820c97600d546a653b8caec0","integrity":"sha512-HYSlpbUspcsnkbONTpkD7XZ8akPiR0Gty9m83wM0faXOGo3Z0N5poPhMxyWEKxz2cCrKu6tgHaD7+gEMSEb04g==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.1.1.tgz","fileCount":7,"unpackedSize":90938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgCad5CRA9TVsSAnZWagAAkegP/3gBaYJBi31oXPCaaQhE\nbuNKzA+hdB/ONJHJdl+SaW1wXdjufwpE68QM00jFu0jWIY1td8z0T6tANlI/\nE1v5MfqHgcizeMkxQmlGiyb2riZ38diCP18rv8SFbkxDTVkqf+ooBpet2MJR\nSrSkFvY8k8zBiehwOZUy1CdsQ7LxWxe0XBPYHrc1Qr8QAgJXmBkAR1FJP3+B\n99m5MyWkAt2AfAP4P5sQB5jBkN3wZpf/Y3g/vin2LTQ22kdOkDjbYLz/kV4j\nqe6rMug0ZKKH1xZIL8vjO+K4UkuWsu1YJ2GA5kenFBUFUkHgfW9XHH1JdhiC\n0EYUynf6ImU0/lgSDPHWcWPfEqEN4Mm03b0ViFTQ8Y+IEs5DC4JY5RdIKw+z\nXBaSGVz0eRsfWh9xoRPPXSVdG1bvhlWLysctF/QNYKcs8Z7lQLMtqYTUc1Bu\n6AkHK4bureLNMeqk20DoVWdEaBNikGOp7uOr3VDprGiVJhgObFp7JkCiR8Am\nvaoC8ZzzT3boSH/YiBWZ0D5bGpdV1w8BdFN8AuQbHG3rjNCQF6dQoHLKPvgh\neHUYiBKPlJg3YIAHloqg6a2G5MlBptwcEs3Qiz3d9NSQVAJUHihZfkK1drkm\n376bHRrbzF+WuB5tJT3dtJHUmCPLLVhExt1QEPUd4+rFkXFT2wCXjxcInZOi\nb+Gp\r\n=H+J6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHxhs4Ixx/zF4ivb2uOPGzAogJuoUnFjfd7HrUaSgfkEAiEA8vb+GdNcYu2m7bl4ykhXwvqGUqoMNn7BmbWELtz9U4s="}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.1.1_1611245433454_0.6997663463858101"},"_hasShrinkwrap":false},"0.1.2":{"name":"fs-teardown","version":"0.1.2","description":"Tear down a directory structure written to disk. Clean up afterwards.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"test":"jest","clean":"rimraf lib/**/*","build":"rollup -c rollup.config.ts","prepublishOnly":"yarn test && yarn clean && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^17.1.0","@rollup/plugin-node-resolve":"^11.2.0","@types/fs-extra":"^9.0.7","@types/jest":"^26.0.20","@types/node":"^14.14.31","jest":"^26.6.3","rimraf":"^3.0.2","rollup":"^2.39.0","rollup-plugin-typescript2":"^0.27.2","ts-jest":"^26.5.1","typescript":"^4.1.5"},"dependencies":{"fs-extra":"^9.1.0"},"_id":"fs-teardown@0.1.2","dist":{"shasum":"cc330fee766408b136cf9b15a46240391825912e","integrity":"sha512-1nUF6YyCbQw1NDr2I+UHToxsxYITz9ONggSWYEc3BN5nqsBetLc6mhwX8jfYvaABm1cdPDFF3Fkysjf8UDVZuw==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.1.2.tgz","fileCount":7,"unpackedSize":91599,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgxOToCRA9TVsSAnZWagAA1goP/2dMGEk4Lw1Rq9lrqZJ0\ndPnhXmRo36QGizG2PSFvwbJgrOi6f7pmgWgmYaoKWfDKgagRm55XzijMjbJ/\n/K86lRj77cbwn729s2QlfxxYPwmyMj3VclmM88lTLrCa8jiuAtMxPLsFDJEt\nZQiKwZOowMPTCF/o63PuMsSGNltr7taoAlszBms8TIYOQVaCZW7Ea/jV17LE\n8FsFbX92kPgzq9UhZvIoZaR5r6VRthnAGOsrZPyGUbqhdz38fa9SEPr00MLn\n9Z0tM9Sw4IE/SoeIf3RV2boEKwSyzAxakIl0AFOzI8I3rVntS2+H6ZqYHpOt\n2TTLQQe4UxTYgwIKYikvqNoh4S1Q0bXpKcI01GMUGoo7+R5j2a60OKadcmhg\nlJ7etGqF22qp82Yjs/lTgNkkO7YPBamBmTUogKV8XFkktXX2S/WyiZ0KWoXU\nErUwliN4sXFvvwiLctGqVCOUGFIYiMUFHnw85S26m2/TUP2KIi/nDYQ1pCls\n7MCV+JGeWLRiumGR4EfqXFMyE6IP8lugGkOvZ53y6KIF+Fs6swS8IqTXtLNw\nB3WeyA/kxufK2HIqPiKl0HTdyHb5MdtRE6AqeHquTJ6VlWVcLgsPYB+pz0Z7\nhgjqWNl5lRlHobYLH3XoPDVLro4TPHiI3MMQtxN5aDe0Pe4cpCD3MYbazICq\nCGkj\r\n=taCi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCq84EsfmBrKjn6hjtxUPrXryBeuxbGkvvB9pU33xNRlwIgD6/oQFeNaJV5bbJbp03SkGIXwkYGDvU0+uv3m+g7v3s="}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.1.2_1623516392110_0.5050238441133572"},"_hasShrinkwrap":false},"0.1.3":{"name":"fs-teardown","version":"0.1.3","description":"File-system directory structure mock for your tests. Define, bootstrap, cleanup.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"lint":"ctl-scripts lint","test":"ctl-scripts test","clean":"rimraf ./lib","build":"yarn clean && rollup -c rollup.config.ts","prepublishOnly":"yarn lint && yarn test && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^19.0.0","@rollup/plugin-node-resolve":"^13.0.0","@types/fs-extra":"^9.0.11","@types/jest":"^26.0.23","@types/node":"^15.12.2","ctl-scripts":"^0.0.6","jest":"^27.0.4","rimraf":"^3.0.2","rollup":"^2.51.2","rollup-plugin-typescript2":"^0.30.0","ts-jest":"^27.0.3","tslib":"^2.3.0","typescript":"^4.3.2"},"dependencies":{"fs-extra":"^10.0.0"},"_id":"fs-teardown@0.1.3","dist":{"shasum":"8376c677b60f989e3de67cabfe353d1c82e2288f","integrity":"sha512-Z84BPdaEeFI+SGiq/TKZgSVSgAsrNhbZ62cWmIpL2z9Ly40W6PKAzafnytJk0Wg2qnoXMA7gPyEXgnLjAi63iA==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.1.3.tgz","fileCount":7,"unpackedSize":89846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg4kCNCRA9TVsSAnZWagAAy2kP+wQE/pJ9TCMcZ05Ql4hE\nN8I0XyCDIm57cW3eX/XuyjX7Ao4Re5G2ZevMX48qe46CUE2sU8gqDZiokEgI\nBMlC1U+pdzVnACsJRoP01wFPUuCuBM1RuWaCSjRwTkvWaySvBJe3F2xZZpdQ\n2AJYnswdtfQT9nYspGvWc9LzuaAqfcVGyVRdYbfY4j+bUg7LxBedsDlHodrQ\nstaqRVECyKSHMS5jUbIGbBl7xi40aLttBkbEzxYYRhiPLGSvRXLD1/vTzaHg\nnNisi7aCYZJeQhFgIpdFUTsgnAPnFfnxwbJ7iJA7Bc+o6MgTSTw14AKx3pAD\nOo+Mct8TM5MkhwoY83M8S2NuYtpHqHGyachniqr3gCrpj7/xbPQ3QXc2DK1q\nboOxRULST5GhzfXg7C+3EJ7e3ZFtgC47gXdRNQXC01AEd6Lj77xWbHpVVmR9\n9ykUmbggbiqOzJLBILdHamksZP2R8oja/+SZVhKSyCegxgo7ByQsiqcopRPS\nlE1bqpj+5u9VqXseaMkLBvLZ27nO1FDKwUWi75OshMb8XEIRHqHTAzHICu7U\ngddKZhMr5gaieIKN9aRkVWtzlKgnAzCDXso6chgBIEklceixFk6n9Tg9xOY8\n6W/ZVJKpQR6h6oaR4itIcQluUlCy3EgXWVmXK97dmkCppx7cTUk/QFtmvPS0\nj3xT\r\n=8FBl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGtlHqLxZAGkhAPcfRaaA3WzMC/UFI262HVxxa00zUKAAiEAvqP5O/oQA3r4fmhB0t0wo8EKN/bQ8ylsqXv5n69J3n4="}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.1.3_1625440397137_0.8191964918639612"},"_hasShrinkwrap":false},"0.2.0":{"name":"fs-teardown","version":"0.2.0","description":"File-system directory structure mock for your tests. Define, bootstrap, cleanup.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"lint":"ctl-scripts lint","test":"ctl-scripts test","clean":"rimraf ./lib","build":"yarn clean && rollup -c rollup.config.ts","prepublishOnly":"yarn lint && yarn test && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^19.0.0","@rollup/plugin-node-resolve":"^13.0.0","@types/fs-extra":"^9.0.11","@types/jest":"^26.0.23","@types/node":"^15.12.2","ctl-scripts":"^0.0.6","jest":"^27.0.4","rimraf":"^3.0.2","rollup":"^2.51.2","rollup-plugin-typescript2":"^0.30.0","ts-jest":"^27.0.3","tslib":"^2.3.0","typescript":"^4.3.2"},"dependencies":{"fs-extra":"^10.0.0"},"_id":"fs-teardown@0.2.0","dist":{"shasum":"7a8cbd3dda865c3e8e41c1bea1c756fd5f35d6c5","integrity":"sha512-RhTjM4P636UB8w0mU1lS62e8MOtBdf/SK5k88BT70mUgyin6xOTrkrEkigfMBuRtJAKx4fk2NbuxE83IFgmRYA==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.2.0.tgz","fileCount":7,"unpackedSize":89918,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJjsICRA9TVsSAnZWagAAFqUQAJYHkbps4XzUcduSniK1\n5HIRgwgvMRJz4TWzTERmBS62+TfD6P722ZYCf7lez8suFxm6n2urSTmMecFd\nlaIl9bYxr+lk2SFIUJ0FUXYzDV7zm8qLKk1mwgDlM+s6UF1IlQXsta3MGQfq\nPQCqMcpq/hAQrBGPgj7EP2VmoDGjRUavVuolujl2CL7waxt7X+O3PpTtal73\nZTqlqlgPkZgGTaJaEhuz70TSk4aRaLJQRvSEc0ej24aCaxcs5Sj33YEtGj3m\nZ6q0+HVK4fBB+2l5XGNBXzUHIGrET70GWqaOITSqT0XM0jKdnNy2U1s92yS/\niPoa0BQzVJff3tChXKWX64hm//cDeGQBeIsQZGfVZ7u54P6ZjB7juoWLEW4q\nRq+3Bdw46gWACituU+BFA2rA5+QjL23rdl+HSvzOHitQDLKXKSuVpbWLk2xt\nT32QNmomvbxZDzBLkI4iqUi1PogJb1lf0tbwoNxiZIJ8tPXSR4XAmV4clG+f\nD//i4jjJRX3fAfovy9rSHXxzh5j5S3Dmp1p48NSQqG+OvwLjUSwyA/xlZ2AU\nFNbGOEfDqYHt3C253BLw6pKbu8jO1hhoimkulhg8DZJlEEgXeTc7l1xbIM8k\nWw3ay9uN6ebgVo8j5/O3pJ8E6ZpSenWho4iuXMafnFG3FLjAQVhXrBjhgEWG\nmqZZ\r\n=q3TD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDBqKWK6/bCJH1heZB1JGyq6nyRoqwwH8fwfgDTnWxBhQIhAKFpDfG3gZzg9PpGuYGuhPj+gnckdoatnhDiKmZHyE3z"}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.2.0_1629895432146_0.3022408611290093"},"_hasShrinkwrap":false},"0.3.0-beta":{"name":"fs-teardown","version":"0.3.0-beta","description":"File-system directory structure mock for your tests. Prepare, modify, clean up.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"lint":"ctl-scripts lint","test":"ctl-scripts test","clean":"rimraf ./lib","build":"yarn clean && rollup -c rollup.config.ts","prepublishOnly":"yarn lint && yarn test && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^19.0.0","@rollup/plugin-node-resolve":"^13.0.0","@types/fs-extra":"^9.0.11","@types/jest":"^26.0.23","@types/node":"^15.12.2","ctl-scripts":"^0.3.2","cz-conventional-changelog":"3.3.0","jest":"^27.0.4","rimraf":"^3.0.2","rollup":"^2.51.2","rollup-plugin-typescript2":"^0.30.0","ts-jest":"^27.0.3","tslib":"^2.3.0","typescript":"^4.3.2"},"dependencies":{"fs-extra":"^10.0.0","outvariant":"^1.2.1"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"keywords":["fs","mock","tree","prepare","cleanup","file","directory","test"],"readmeFilename":"README.md","readme":"# `fs-teardown`\n\nFile-system directory structure mock for your tests. Prepare, modify, clean up.\n\n## Getting started\n\n```sh\n$ npm install fs-teardown -D\n# or\n$ yan add fs-teardown -D\n```\n\n## API\n\n### `fsTeardown(options: TeardownOptions): TeardownAPI`\n\nCalling the `fsTeardown` function returns you a control API to create the specified file system structure and clean it up on demand.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n})\n```\n\nYou can specify an optional `paths` property to create an initial file tree.\n\n```js\nfsTeardown({\n  rootDir: './example',\n  paths: {\n    'empty.txt': null,\n    'file.txt': 'hello world',\n    'src/hooks': {\n      'useField.js': null,\n    },\n  },\n})\n```\n\n### `prepare(): Promise<string>`\n\nCreates files and directories specified in the `operations` of the teardown. Returns a `Promise` that resolves once all the operations have been executed.\n\n### `create(tree: FileTree): Promise<void>`\n\nCreates a file tree relative to the root directory after the initial setup.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n})\n\nawait fsMock.create({\n  'file.txt': 'hello world',\n  'directory/another-file.txt': 'hello to you',\n})\n```\n\n### `resolve(...segments: string[]): string`\n\nReturns an absolute path to the given file or directory relative to the `rootDir` of the teardown. Useful to reference a certain file or directory in the created file structure.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n  },\n})\n\nconst filePath = fsMock.resolve('file.txt')\n// \"/Users/admin/example/file.txt\"\n```\n\n### `edit(filePath: string): Promise<void>`\n\nEdits a file at the given path. Throws an error if the given file doesn't exist.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n  },\n})\n\nawait fsMock.edit('file.txt', 'welcome to the jungle')\n```\n\n### `reset(): Promise<void>`\n\nResets the root directory to its initial state.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n    'dir/nested.txt': null,\n  },\n})\n\n// Runtime actions.\nawait fsMock.edit('file.txt', 'welcome to the jungle')\nawait fsMock.remove('dir')\n\nawait fsMock.restore()\n// - \"file.txt\" was restored to \"hello world\";\n// - \"dir\" and \"dir/nested.txt\" were restored.\n```\n\n### `cleanup(): Promise<void>`\n\nRemoves the root directory of the teardown. Returns a `Promise` that resolves once the directory is removed.\n\n```js\nawait fsMock.cleanup()\n```\n\n## Recipes\n\n### Create empty file\n\n```js\nfsMocks.create({\n  'filename.ext': null,\n})\n```\n\n### Create file with text content\n\n```js\nfsMock.create({\n  'file.txt': 'hello world',\n})\n```\n\n### Create file with JSON content\n\n```js\nfsMock.create({\n  'file.json': JSON.stringify({ a: 1 }, null, 2),\n})\n```\n\n### Create empty directory\n\n```js\nfsMock.create({\n  'empty-dir': null,\n})\n```\n\n> Keys without extensions are treated as directories.\n\n### Create nested directories\n\n```js\nfsMock.create({\n  'one/to/three': null,\n})\n```\n\n### Create directory with multiple files\n\n```js\nfsMock.create({\n  'deeply/nested/directory': {\n    'one.txt': 'first file',\n    'two.txt': 'second file',\n  },\n})\n```\n","_id":"fs-teardown@0.3.0-beta","dist":{"shasum":"a34bb659b2d56ed320412f590ae132c3de7fdbad","integrity":"sha512-GbfG15EK2L+aO4uETrC6g4WhGjlStKUjPwBfJlE7djhY+mQ/acuPMWlbc1Ccs9s6YSFLKhXURQ0aVsp20mNMmA==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.3.0-beta.tgz","fileCount":7,"unpackedSize":100386,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhLkBsCRA9TVsSAnZWagAAkaMP/jIMcUqxi8BPEb0A65NL\nyg95XGS1KNC6laBuUq2YUgQLB7lxHWXYvU0u2AV+uyZBVkuxEMpfHVXPMV2u\nKiFReKeKYR7lRwW30tpIsqlknvDqFwwyakiCgL17EkODwqhln/qQwidlM5vY\nUAVMYEh+zQah+QbKwLAWGUYDARPbsWcrI3G27pPAY1/gxkKjiXHFnZFrC0Be\nol5kDt6wdWgui9402xOPEu9dMp+gAQ/Ngywn8WKTyJE3+tvgRq3xDtA2Bf/S\nsOSMsSwX9Ogt0c/kNC23Gpyw1dvkzhvrgp7Ts7/KNX8fI9/IR37f/OzmEWSQ\njpOubpBcKStIXvPlxsDf5C4NjBLwGkxx+I5+EC9c6MbDCpR9vPezMcGnD4HN\n+c/dxLNnT6RgprQm89ffu/GqC4i+5Qdac9JPv/UGv19tVSmz6LW4E+grqW9j\nsf6szKWskdObiQr0hTUZOdmZ1YH2ktSqskF5ychpwyHE5ag1GNmQpRdPR5wT\nKVDKUgVTM8nKoXVE7mdtK4C7+8I9BSsL+nJbuHHVWNrSNDidTE2fPrpK8Sy8\nedLUoiEKcOf/2JGGcSXTuxPjGmf7DrXBEISMskT3Lqhkn0ri0vOQjD6Rr1w9\nRlGWuvsfSns4DBq2myqoL1LVDPjIVFqUDfa9ezzGQHSaRgdgMPMaIOEYwac4\nT1bH\r\n=dEKF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDnHY/KCdwS4Ch9ug+qaCJIGuU342oKsU3MYp4BXMGETwIgYHeQul7/oUdWkwUf5GulwYa/RQ8SGDhHyCprJslJ7jE="}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.3.0-beta_1630421100098_0.6208470103777244"},"_hasShrinkwrap":false},"0.3.1-beta":{"name":"fs-teardown","version":"0.3.1-beta","description":"File-system directory structure mock for your tests. Prepare, modify, clean up.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"lint":"ctl-scripts lint","test":"ctl-scripts test","clean":"rimraf ./lib","build":"yarn clean && rollup -c rollup.config.ts","prepublishOnly":"yarn lint && yarn test && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^19.0.0","@rollup/plugin-node-resolve":"^13.0.0","@types/fs-extra":"^9.0.11","@types/jest":"^26.0.23","@types/node":"^15.12.2","ctl-scripts":"^0.3.2","cz-conventional-changelog":"3.3.0","jest":"^27.0.4","rimraf":"^3.0.2","rollup":"^2.51.2","rollup-plugin-typescript2":"^0.30.0","ts-jest":"^27.0.3","tslib":"^2.3.0","typescript":"^4.3.2"},"dependencies":{"fs-extra":"^10.0.0","outvariant":"^1.2.1"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"keywords":["fs","mock","tree","prepare","cleanup","file","directory","test"],"readmeFilename":"README.md","readme":"# `fs-teardown`\n\nFile-system directory structure mock for your tests. Prepare, modify, clean up.\n\n## Getting started\n\n```sh\n$ npm install fs-teardown -D\n# or\n$ yan add fs-teardown -D\n```\n\n## API\n\n### `fsTeardown(options: TeardownOptions): TeardownAPI`\n\nCalling the `fsTeardown` function returns you a control API to create the specified file system structure and clean it up on demand.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n})\n```\n\nYou can specify an optional `paths` property to create an initial file tree.\n\n```js\nfsTeardown({\n  rootDir: './example',\n  paths: {\n    'empty.txt': null,\n    'file.txt': 'hello world',\n    'src/hooks': {\n      'useField.js': null,\n    },\n  },\n})\n```\n\n### `prepare(): Promise<string>`\n\nCreates files and directories specified in the `operations` of the teardown. Returns a `Promise` that resolves once all the operations have been executed.\n\n### `create(tree: FileTree): Promise<void>`\n\nCreates a file tree relative to the root directory after the initial setup.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n})\n\nawait fsMock.create({\n  'file.txt': 'hello world',\n  'directory/another-file.txt': 'hello to you',\n})\n```\n\n### `resolve(...segments: string[]): string`\n\nReturns an absolute path to the given file or directory relative to the `rootDir` of the teardown. Useful to reference a certain file or directory in the created file structure.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n  },\n})\n\nconst filePath = fsMock.resolve('file.txt')\n// \"/Users/admin/example/file.txt\"\n```\n\n### `edit(filePath: string): Promise<void>`\n\nEdits a file at the given path. Throws an error if the given file doesn't exist.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n  },\n})\n\nawait fsMock.edit('file.txt', 'welcome to the jungle')\n```\n\n### `reset(): Promise<void>`\n\nResets the root directory to its initial state.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n    'dir/nested.txt': null,\n  },\n})\n\n// Runtime actions.\nawait fsMock.edit('file.txt', 'welcome to the jungle')\nawait fsMock.remove('dir')\n\nawait fsMock.restore()\n// - \"file.txt\" was restored to \"hello world\";\n// - \"dir\" and \"dir/nested.txt\" were restored.\n```\n\n### `cleanup(): Promise<void>`\n\nRemoves the root directory of the teardown. Returns a `Promise` that resolves once the directory is removed.\n\n```js\nawait fsMock.cleanup()\n```\n\n## Recipes\n\n### Create empty file\n\n```js\nfsMocks.create({\n  'filename.ext': null,\n})\n```\n\n### Create file with text content\n\n```js\nfsMock.create({\n  'file.txt': 'hello world',\n})\n```\n\n### Create file with JSON content\n\n```js\nfsMock.create({\n  'file.json': JSON.stringify({ a: 1 }, null, 2),\n})\n```\n\n### Create empty directory\n\n```js\nfsMock.create({\n  'empty-dir': null,\n})\n```\n\n> Keys without extensions are treated as directories.\n\n### Create nested directories\n\n```js\nfsMock.create({\n  'one/to/three': null,\n})\n```\n\n### Create directory with multiple files\n\n```js\nfsMock.create({\n  'deeply/nested/directory': {\n    'one.txt': 'first file',\n    'two.txt': 'second file',\n  },\n})\n```\n","_id":"fs-teardown@0.3.1-beta","dist":{"shasum":"7652370a28a6c004be9eb84134ca51002e02af3e","integrity":"sha512-x6vnmUHsApqyTSD4PYkYQohsaeiIraxBgRofIJtBHQwQa/5eTeRptakG4AR1g7YDmPm7Du+uQ6yAnhvCjGzFNQ==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.3.1-beta.tgz","fileCount":7,"unpackedSize":100610,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhLkxFCRA9TVsSAnZWagAAp14P/3QE3CVWUWFwJMtd3ckM\nHauQUqP7tPGwgU/YnOeqnb6dAE2UDbp1Y8CWOtRdz/v2jMEwoAScw53zFrbY\ngmGLj2Zw9khdacU5vqaUGMjWPXy+g5OuKSOFnwcqLoMkUG0/geh2GP2Kab13\nGqKltlLZNoOvjf/GmQU9dNuJvgNkLItxCaOkMAowhPOsabAks3aMHg3OEPQp\nYUx+xD7yMumwn/ERdYDrhe7d3th3mq4/KZtaVj4+aAkiML/Ykt1f+9d6xOyi\ncVEpDheTD/fBCLOTdnlWYPFNiepsU1iG25F8QUFBpFgU7mUdWQGjkYQQEN8N\nyivYHE55qcklMs+qNSukJvutHrZ4pFVHoHcyuE8WENggAnG4hFMc36MgdO4E\nRt0vXrY1/DbLd5S7JwXtxJW8ZH6t6IveSJk/JeS7qyKVac9NvCmYroKyzLbX\nWks6rpsfnMprnM9LSu/dxh5Mswa99JSz0YsJe3Zej5ZFDMK/FQU/TkesaUPB\nqJA0ZQ+e/CLCQrRxF3Gi7qdilb+0lPS+yD5ZIWimM6zu3kTOI1Ez6Zi2n6zF\nMSUcI69P+JCIIYcsuo/C2T4E6YL7pgcepYzI4piqdstORtwqmUyiNIQ21y2G\ndMpIOt4QhnpfFRES+5sNlf6FCkuAWh/F74wJRu0H3UrcqKzGW035UKag5ewZ\nzQ7H\r\n=aVkj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH3tjWsMRJ2elmq4z0W6mAZN8jkX+Y5EvHwnafP6Slf6AiAUWT6hDzb3DY9Ze60rANUhOc/JgN05iUAUAT18O9/TIA=="}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.3.1-beta_1630424133727_0.8579729854913956"},"_hasShrinkwrap":false},"0.3.1-beta.2":{"name":"fs-teardown","version":"0.3.1-beta.2","description":"File-system directory structure mock for your tests. Prepare, modify, clean up.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"lint":"ctl-scripts lint","test":"ctl-scripts test","clean":"rimraf ./lib","build":"yarn clean && rollup -c rollup.config.ts","prepublishOnly":"yarn lint && yarn test && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^19.0.0","@rollup/plugin-node-resolve":"^13.0.0","@types/fs-extra":"^9.0.11","@types/jest":"^26.0.23","@types/node":"^15.12.2","ctl-scripts":"^0.3.4","cz-conventional-changelog":"3.3.0","jest":"^27.0.4","rimraf":"^3.0.2","rollup":"^2.51.2","rollup-plugin-typescript2":"^0.30.0","ts-jest":"^27.0.3","tslib":"^2.3.0","typescript":"^4.3.2"},"dependencies":{"fs-extra":"^10.0.0","outvariant":"^1.2.1"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"keywords":["fs","mock","tree","prepare","cleanup","file","directory","test"],"readmeFilename":"README.md","readme":"# `fs-teardown`\n\nFile-system directory structure mock for your tests. Prepare, modify, clean up.\n\n## Getting started\n\n```sh\n$ npm install fs-teardown -D\n# or\n$ yan add fs-teardown -D\n```\n\n## API\n\n### `fsTeardown(options: TeardownOptions): TeardownAPI`\n\nCalling the `fsTeardown` function returns you a control API to create the specified file system structure and clean it up on demand.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n})\n```\n\nYou can specify an optional `paths` property to create an initial file tree.\n\n```js\nfsTeardown({\n  rootDir: './example',\n  paths: {\n    'empty.txt': null,\n    'file.txt': 'hello world',\n    'src/hooks': {\n      'useField.js': null,\n    },\n  },\n})\n```\n\n### `prepare(): Promise<string>`\n\nCreates files and directories specified in the `operations` of the teardown. Returns a `Promise` that resolves once all the operations have been executed.\n\n### `create(tree: FileTree): Promise<void>`\n\nCreates a file tree relative to the root directory after the initial setup.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n})\n\nawait fsMock.create({\n  'file.txt': 'hello world',\n  'directory/another-file.txt': 'hello to you',\n})\n```\n\n### `resolve(...segments: string[]): string`\n\nReturns an absolute path to the given file or directory relative to the `rootDir` of the teardown. Useful to reference a certain file or directory in the created file structure.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n  },\n})\n\nconst filePath = fsMock.resolve('file.txt')\n// \"/Users/admin/example/file.txt\"\n```\n\n### `edit(filePath: string): Promise<void>`\n\nEdits a file at the given path. Throws an error if the given file doesn't exist.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n  },\n})\n\nawait fsMock.edit('file.txt', 'welcome to the jungle')\n```\n\n### `reset(): Promise<void>`\n\nResets the root directory to its initial state.\n\n```js\nconst fsMock = fsTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n    'dir/nested.txt': null,\n  },\n})\n\n// Runtime actions.\nawait fsMock.edit('file.txt', 'welcome to the jungle')\nawait fsMock.remove('dir')\n\nawait fsMock.restore()\n// - \"file.txt\" was restored to \"hello world\";\n// - \"dir\" and \"dir/nested.txt\" were restored.\n```\n\n### `cleanup(): Promise<void>`\n\nRemoves the root directory of the teardown. Returns a `Promise` that resolves once the directory is removed.\n\n```js\nawait fsMock.cleanup()\n```\n\n## Recipes\n\n### Create empty file\n\n```js\nfsMocks.create({\n  'filename.ext': null,\n})\n```\n\n### Create file with text content\n\n```js\nfsMock.create({\n  'file.txt': 'hello world',\n})\n```\n\n### Create file with JSON content\n\n```js\nfsMock.create({\n  'file.json': JSON.stringify({ a: 1 }, null, 2),\n})\n```\n\n### Create empty directory\n\n```js\nfsMock.create({\n  'empty-dir': null,\n})\n```\n\n> Keys without extensions are treated as directories.\n\n### Create nested directories\n\n```js\nfsMock.create({\n  'one/to/three': null,\n})\n```\n\n### Create directory with multiple files\n\n```js\nfsMock.create({\n  'deeply/nested/directory': {\n    'one.txt': 'first file',\n    'two.txt': 'second file',\n  },\n})\n```\n","_id":"fs-teardown@0.3.1-beta.2","dist":{"shasum":"c083bbc383ed0c2022906004ab476173f88b5a92","integrity":"sha512-TS6JUtj88HfUWwiXDw9WanjgbJWh/+vKLeJxMBu43bNLWujztUEt1xZNDL3cgqBAiJuSYC7VqPgq7Qf2nmULQA==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.3.1-beta.2.tgz","fileCount":7,"unpackedSize":101322,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuJnbWnl9GFq1YOUf8M/p8pfYDpwWjQPPRy1kwujC+NQIhAKUQg/T8rHzrPSZrXV5tGDNIUcf6aJE3Aqv01QjdGao0"}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.3.1-beta.2_1635942813260_0.2213284956660011"},"_hasShrinkwrap":false},"0.3.0":{"name":"fs-teardown","version":"0.3.0","description":"Teardown API for testing file system-dependent code.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"lint":"ctl-scripts lint","test":"ctl-scripts test","clean":"rimraf ./lib","build":"yarn clean && rollup -c rollup.config.ts","prepublishOnly":"yarn lint && yarn test && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-node-resolve":"^13.0.6","@types/fs-extra":"^9.0.13","@types/jest":"^27.0.2","@types/node":"^15.12.2","ctl-scripts":"^0.3.4","cz-conventional-changelog":"3.3.0","jest":"^27.3.1","rimraf":"^3.0.2","rollup":"^2.60.0","rollup-plugin-typescript2":"^0.31.0","ts-jest":"^27.0.7","tslib":"^2.3.1","typescript":"^4.3.2"},"dependencies":{"fs-extra":"^10.0.0","outvariant":"^1.2.1"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"keywords":["fs","mock","tree","prepare","cleanup","file","directory","test"],"_id":"fs-teardown@0.3.0","dist":{"shasum":"327bce538393b66d54a14ee9dd58b034ce947df6","integrity":"sha512-iA1/y4aDBHCKcinWwdzY4WecDyYkXuUuKQkIGBJpdedOLHsoxTOQaFg2B1DvIUJJnu6JKmPMaPfRPYy/CNu2UA==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.3.0.tgz","fileCount":7,"unpackedSize":102353,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhlZSxCRA9TVsSAnZWagAA2LgP/Aya95F32nwbSFZC0cyf\nk+vhfti1BB0usUPWjCdLNPkK82dQBbeWa5UdyA+1n+WCZgC+CW5rkbfzQcqh\nVfQ3ur+SDPqjGWdLrLacpu1fbY5AJezjK3j6xmsNAxrPLjyQYcSkQSGgocsC\nPR7kRm7ny9G2XWVIoaBO4qILV0Z76kw6909iXq4IUCiM/L47mvm1oTuNlCYB\nc3CQn3xZRxFc9wxgKad3a/xufYZkhpBVlqNkRTKzRr2PnVMM71m32tpnZC4+\ns73Z/4PGS1mIK6p+sJDnDFNhGZJ6FKCMzS/oXVe6FK6L8geNsoe31p1PgkI9\njO0cAnLzR448uScMzq1oA87HvsAgfm1nRkqOga350myL4GgxMFQ4TR6oeh9r\nNCad3Ssu3JFUsvDA4e9zqop2b1zRijmzmK25w/Gu6MFsxi6zyWgd5MPE7d6w\nkLFqi8yniQrxkDySz8zHgLgHwV1/kZfz9N+wzDIV2xGnePpSxJnOsGxmcuzf\ngS2vyXkVas86BZ0m2i2SgZOFBLI3jwEdCUGBLlYCKvH1esHb2B5w1kdHayzd\nFHgFUp8mD6E8dnADS/5fkxT2wMV1R8No4k4snTgGlHWCULgRu3zVizmZigGx\nRz7VeTpls9uZaTHjliOGQPsaW4J2cGzWgX9b5p/nyCXfkbrBdNQlpwoK/VYD\nwzeP\r\n=+az8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCd2ZizwHZ41LRrvPEfzXxxMlLEcsi29N5UDETY60lDMgIhAJUE3qPDnX+g9s1ujj1kmv+VzMDyxEl4iZqQrO6F+X2X"}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.3.0_1637192880858_0.49668638259493125"},"_hasShrinkwrap":false},"0.3.1":{"name":"fs-teardown","version":"0.3.1","description":"Teardown API for testing file system-dependent code.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"lint":"ctl-scripts lint","test":"ctl-scripts test","clean":"rimraf ./lib","build":"yarn clean && rollup -c rollup.config.ts","prepublishOnly":"yarn lint && yarn test && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-node-resolve":"^13.0.6","@types/fs-extra":"^9.0.13","@types/jest":"^27.0.2","@types/node":"^15.12.2","ctl-scripts":"^0.3.4","cz-conventional-changelog":"3.3.0","jest":"^27.3.1","rimraf":"^3.0.2","rollup":"^2.60.0","rollup-plugin-typescript2":"^0.31.0","ts-jest":"^27.0.7","tslib":"^2.3.1","typescript":"^4.3.2"},"dependencies":{"fs-extra":"^10.0.0","outvariant":"^1.2.1"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"keywords":["fs","mock","tree","prepare","cleanup","file","directory","test"],"_id":"fs-teardown@0.3.1","dist":{"shasum":"f0765d53296807cebdecc626272e5938f046b888","integrity":"sha512-Mtx4GODDLn0v8eP+orEhPqH/M6nPLKfzbQ6V0oCUw9kaTdhSvGwxcFAGzmxSplAaX1duO6VyVa3T1WFWlg/Kow==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.3.1.tgz","fileCount":7,"unpackedSize":103838,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiMga0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDwRAAnhR9AsLeC6NDZgAYf/9BtBafqa9Uf1JMAIcI4ZvfLp/3tJyj\r\nTKsVsOD/VKgRHs94s9kfm8ZrL9cwUkIfaLowWeyioZwhJf4BtSITj/gUMCEw\r\nBybBJ/LWA9UTYo9AA564QEMC9h2dtZZoHnv1C6SmQlIatS4nToRAUnJb/uff\r\ntUO6LAeXyX/ajj+ETn1ljlQcjxbCVRpGOR8uozyjl0A5Qjihs/9HtaOILzx7\r\nAe7eXeqSTpgs5EzyVI2/MvaEO32ZQhfh3T7cL0XZ3MvObSFU78tq/N3ZWUCm\r\nDbbSkbG8FjQPCCypzqH94cf4F5E7MHhdZ6CJWHVBKljVTNWdl+eURkN87GWx\r\nHIniaRCgscWvd3qVPUOxneM8fdPJp+xkRAxeyxGrQ4NqVEVzlflTedMCLmjS\r\nlm8uk2vljAbPwMvtgivbAw+CKpWO0fToQfwXS/X8SeI1HUN75gv9lGn7c401\r\npW103O8Fa2ppNJSbscqeDjY7eEsK3j9C29/3gxSuPy341tjBMyFf0GnlXHAT\r\nSH2EfLfwikY60RmK4EG0TxBcWYeQieGeV5XK/kIQeGVisiWlYavHQ2QYhNCn\r\n6cMUh0oQ873Ga0cgKCXJarlkNSiHcr15M0dJJOYwusai9ZADggVT7iy7VX/4\r\nwA2oQNWOx3qc3SQfgtEUJXKx6zd8Rh5aSN4=\r\n=q42j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGGyroUyapNv3Fjd9Pwr+b+zbTXRyMlmEWnt60oF4WUxAiAgtYHC+6NK1B8SQCCIBayqC7UNtwjsYyYZfm8dfdtgPA=="}]},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.3.1_1647445684363_0.6033843317336416"},"_hasShrinkwrap":false},"0.3.2":{"name":"fs-teardown","version":"0.3.2","description":"Teardown API for testing file system-dependent code.","main":"lib/index.js","types":"lib/index.d.ts","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","scripts":{"lint":"ctl-scripts lint","test":"ctl-scripts test","clean":"rimraf ./lib","build":"yarn clean && rollup -c rollup.config.ts","prepublishOnly":"yarn lint && yarn test && yarn build"},"devDependencies":{"@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-node-resolve":"^13.0.6","@types/fs-extra":"^9.0.13","@types/jest":"^27.0.2","@types/node":"^15.12.2","ctl-scripts":"^0.3.4","cz-conventional-changelog":"3.3.0","jest":"^27.3.1","rimraf":"^3.0.2","rollup":"^2.60.0","rollup-plugin-typescript2":"^0.31.0","ts-jest":"^27.0.7","tslib":"^2.3.1","typescript":"^4.3.2"},"dependencies":{"fs-extra":"^10.0.0","outvariant":"^1.2.1"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"keywords":["fs","mock","tree","prepare","cleanup","file","directory","test"],"_id":"fs-teardown@0.3.2","dist":{"shasum":"47cc1d0e229401a63eb46d30c43523915a45a6c6","integrity":"sha512-5xJQGMsGjHdZJ5yw/eyZEkAIHYwQQA6T34PfXUCl5JOeizfLWnz3gBEVfEidgrnnYZKTBW3L7aPrB3aI8f0Vqw==","tarball":"https://registry.npmjs.org/fs-teardown/-/fs-teardown-0.3.2.tgz","fileCount":7,"unpackedSize":103901,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCIs2dykydtL9dKodC0+0VzxPqwaiXlO71HIBEVbKmmSAIgYb+hXyED4UE3ZGnC5+kK1Re76DBoz59Re3EKcXwgUbs="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiYWcxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmox3g/+KiGgwgZ5Q3kA4bfZd7LHtEzE2F8uTeaCCpWBJTIZ6LIKs18K\r\nJXSU/V287b9NYdROyKczqD4kL7bOBmxBba5Dsq1+mcSkZqgLG5OHH/hDk1ZF\r\nN+GXIfvwiA9ermdxsR8mWNOmu03JAAJiC1lg4VKtsFlQttLDRBElXxXavkAJ\r\nrRmbvVkcdijmUnXW2/6QfVyv9uKhXb5t7fchjk6I1LaSFSPkQ0sasXmq883l\r\nIFC66iHzZA7j5Ngjrxq3loazMjSO2tmJyyHtUrUkgwCujbFr2axi7INtOUhY\r\nMjpbpc197aIknq8G9WdsHss/CqF2UIUqZ8WBb9mINnebEGmwSJcnreUR7W0G\r\nJ+ksmj3yRgnoGZshRtWlknvQMQL4dPVEdjs28aa6JxRtt3YfxGzUw+1dZQXN\r\n340FYplMty9cYSnz3tYboN32+PV81CvABKkEeK2Qvq5vJNXEPZsIRk+FxKYc\r\nZscGD7fHH73dWDs0tJ/C412eWrLtwd80ZVownkVzGLaR7tu4kfGVziYCOeFH\r\n2hES64zCnqfMK1+ItzIKYN5TX7D4YiAO/s8/4dmQbnzohj4B2fSvCo0idVQa\r\nzazcDigeh7txIgXemQWrZodNaRct69ht96hLqZP6naQq9MhH6zPeKFY236Rt\r\ntWy4yDsWOo/rNH61mqgdLta0lgQDnfyllfE=\r\n=lhBF\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fs-teardown_0.3.2_1650550576812_0.9414873249575519"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-25T16:30:14.485Z","0.1.0":"2020-08-25T16:30:14.586Z","modified":"2022-05-02T23:35:52.820Z","0.1.1":"2021-01-21T16:10:33.586Z","0.1.2":"2021-06-12T16:46:32.255Z","0.1.3":"2021-07-04T23:13:17.247Z","0.2.0":"2021-08-25T12:43:52.276Z","0.3.0-beta":"2021-08-31T14:45:00.241Z","0.3.1-beta":"2021-08-31T15:35:33.911Z","0.3.1-beta.2":"2021-11-03T12:33:33.444Z","0.3.0":"2021-11-17T23:48:01.031Z","0.3.1":"2022-03-16T15:48:04.481Z","0.3.2":"2022-04-21T14:16:16.977Z"},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"description":"Teardown API for testing file system-dependent code.","repository":{"type":"git","url":"git@github.com:kettanaito/fs-teardown.git"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","readme":"# `fs-teardown`\n\nTeardown API for testing file system-dependent code.\n\n## Getting started\n\n```sh\n$ npm install fs-teardown -D\n# or\n$ yan add fs-teardown -D\n```\n\n## API\n\n### `createTeardown(options: CreateTeardownOptions): TeardownAPI`\n\nCalling the `createTeardown` function returns you the API to create the specified file system structure and clean it up on demand.\n\n```js\nconst api = createTeardown({\n  rootDir: './example',\n})\n```\n\nYou can specify an optional `paths` property to describe an initial directory/file tree.\n\n```js\ncreateTeardown({\n  rootDir: './example',\n  paths: {\n    'empty.txt': null,\n    'file.txt': 'hello world',\n    'src/hooks': {\n      'useField.js': null,\n    },\n  },\n})\n```\n\n> Providing a relative path to the `rootDir` creates the given path at the system's default directory for temporary files ([`os.tmpdir`](https://nodejs.org/api/os.html#ostmpdir)). Absolute paths are used as-is.\n\n### `prepare(): Promise<string>`\n\nCreates files and directories specified in the `operations` of the teardown. Returns a `Promise` that resolves once all the operations have been executed.\n\n### `create(tree: FileTree): Promise<void>`\n\nCreates a file tree relative to the root directory after the initial setup.\n\n```js\nconst api = createTeardown({\n  rootDir: './example',\n})\n\nawait api.create({\n  'file.txt': 'hello world',\n  'directory/another-file.txt': 'hello to you',\n})\n```\n\n### `resolve(...segments: string[]): string`\n\nReturns an absolute path to the given file or directory relative to the `rootDir` of the teardown. Useful to reference a certain file or directory in the created file structure.\n\n```js\nconst api = createTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n  },\n})\n\nconst filePath = api.resolve('file.txt')\n// \"/Users/admin/example/file.txt\"\n```\n\n### `readFile(filePath: string, encoding?: BufferEncoding): Promise<Buffer | string>`\n\nReads a file at the given path.\n\nBy default, returns the `Buffer` of the read file. Provide the second `encoding` argument to convert the buffer to the given encoding.\n\n```js\nconst api = createTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world'\n  }\n})\n\n// Read the \"file.txt\" content as Buffer.\nconst buffer = await api.readFile('file.txt')\n\n// Read the \"file.txt\" content as text.\nconst text = await api.readFile('file.txt', 'utf8)\n```\n\n### `edit(filePath: string): Promise<void>`\n\nEdits a file at the given path. Throws an error if the given file doesn't exist.\n\n```js\nconst api = createTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n  },\n})\n\nawait api.edit('file.txt', 'welcome to the jungle')\n```\n\n### `exec(command: string, options: ExecOptions?): Promise<{ stdout, stderr }>`\n\nExecutes the given command in the mocked directory.\n\n```js\nconst api = createTeardown({\n  rootDir: 'exec',\n})\n\n// Initiates a new Git repository at the mocked directory.\nawait api.exec('git init')\n```\n\n### `reset(): Promise<void>`\n\nResets the root directory to its initial state.\n\n```js\nconst api = createTeardown({\n  rootDir: './example',\n  paths: {\n    'file.txt': 'hello world',\n    'dir/nested.txt': null,\n  },\n})\n\n// Runtime actions.\nawait api.edit('file.txt', 'welcome to the jungle')\nawait api.remove('dir')\n\nawait api.restore()\n// - \"file.txt\" was restored to \"hello world\";\n// - \"dir\" and \"dir/nested.txt\" were restored.\n```\n\n### `cleanup(): Promise<void>`\n\nRemoves the root directory of the teardown. Returns a `Promise` that resolves once the directory is removed.\n\n```js\nawait api.cleanup()\n```\n\n## Recipes\n\n### Empty file\n\n```js\nfsMocks.create({\n  'filename.ext': null,\n})\n```\n\n### Text file\n\n```js\napi.create({\n  'file.txt': 'hello world',\n})\n```\n\n### JSON file\n\n```js\napi.create({\n  'file.json': JSON.stringify({ a: 1 }, null, 2),\n})\n```\n\n> Note that the JSON file's content must be a string. Object values are treated as [nested files](#directory-with-multiple-files).\n\n### Empty directory\n\n```js\napi.create({\n  'empty-dir': null,\n})\n```\n\n> Keys without extensions are treated as directories.\n\n### Nested directories\n\n```js\napi.create({\n  'one/to/three': null,\n})\n```\n\n### Directory with multiple files\n\n```js\napi.create({\n  'deeply/nested/directory': {\n    'one.txt': 'first file',\n    'two.txt': 'second file',\n  },\n})\n```\n","readmeFilename":"README.md","keywords":["fs","mock","tree","prepare","cleanup","file","directory","test"]}