{"_id":"@dvkiin/ts-mocha","_rev":"2-bb3a94b67e2ec796c75f36fe51eb3160","name":"@dvkiin/ts-mocha","dist-tags":{"latest":"8.8.2"},"versions":{"8.0.0":{"name":"@dvkiin/ts-mocha","version":"8.0.0","description":"Mocha thin wrapper that allows running TypeScript tests with TypeScript runtime (ts-node) to get rid of compilation complexity","repository":{"type":"git","url":"git+https://github.com/piotrwitek/ts-mocha.git"},"author":{"name":"Piotr Witek","email":"piotrek.witek@gmail.com","url":"http://piotrwitek.github.io"},"license":"MIT","main":"src/index.js","bin":{"ts-mocha":"./bin/ts-mocha"},"engines":{"node":">= 6.X.X"},"scripts":{"clean":"rm -rf node_modules/","reinstall":"npm run clean && npm install","pretest:baseline":"npm install --peer","test:baseline":"./bin/ts-mocha -p test/baseline/tsconfig.json test/baseline/**/*.spec.ts && node test/baseline/programmatic-use-test.js","pretest:paths":"npm install --optional","test:paths":"./bin/ts-mocha --paths -p test/paths/tsconfig.json test/paths/**/*.spec.ts && node test/paths/programmatic-use-test.js","test":"npm run test:baseline & npm run test:paths","prepublishOnly":"npm run clean && npm install --production && npm install -D mocha && npm test"},"dependencies":{"ts-node":"8.8.2","tsconfig-paths":"^3.9.0"},"devDependencies":{"@types/expect":"24.3.0","@types/mocha":"7.0.2","@types/node":"^13.11.0","expect":"^25.2.7","husky":"4.2.3","mocha":"^6.2.3","tslint":"6.1.1","typescript":"3.8.3"},"peerDependencies":{"mocha":"^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X"},"optionalDependencies":{"tsconfig-paths":"^3.9.0"},"keywords":["ts","mocha","typescript","ts-node","test"],"greenkeeper":{"ignore":["@types/expect","@types/mocha","@types/node","expect","husky","tslint"]},"gitHead":"c9dd16d4c14c988a0fd80cd3d8e1a97fbb74d7d5","bugs":{"url":"https://github.com/piotrwitek/ts-mocha/issues"},"homepage":"https://github.com/piotrwitek/ts-mocha#readme","_id":"@dvkiin/ts-mocha@8.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-UsWBhCcWp+4+xgDLnMTiwJM17MoexXIrh65PlC9i8DVC9ySG6ztMHvJZnCtxscg2gRuVRC3SU7gdGAwuy80e0g==","shasum":"49c14714ef6709069227ec54997fa9e058f8f9b9","tarball":"https://registry.npmjs.org/@dvkiin/ts-mocha/-/ts-mocha-8.0.0.tgz","fileCount":7,"unpackedSize":81654,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJejDgMCRA9TVsSAnZWagAAjwwP/RYycvT8VrSVgcSlQ12N\nEThlgHXrLuCjb9bKOslUXXyrMAgaaU7CbJj+Mgg6e2vQuf/3ZMh84RyFbkBY\nmV6TWtmpEXEHp+pojDTyV0gTpeIEwYS3p1R/Qg9AeS6DHXJgXlddHbEVmy8D\nuWrRa2O9sxRIhP1ps7PwLysumUThWjNEgFWym9OC2R2G38utUwX8j6jSF8F/\nF0NB09bbzcUf/slzogPvvuyzHYP+5SHeTJuP+hJ2PcabAFsljwwIQaZ7mz15\nasm3CUU2DBYnePKxmb5iYW5QtAtVpacp3bK3FL208Ch74yvvyPUH67MGVJxw\n/I3GyrOOzEc+7Kc1GI87cD5WkMvOHxzoKA9x9/YWJG81yuMTNO5SNvitbdkg\nj+ZVdIZCpfES+dLV0sslGLH/j4U7EVlUjWpUi/8Q9P4iywwdlcKjr+LtVWrB\nQ4Wwz88kWoYaVlC89UCrooSULLPkls7jajlw3fGzGV6v43tTe0ZlHH1B/1S6\nzZoFLD5dOs14wr6G1Jivuz7M7gxGL51n2q6NHoKgoyPq94a5DQOMWn4gXpDv\nxb24CRhvffJiaa0S1Z+OUWusiQweN4oUc1qZ+SFrD7x84A8cYULNSeWCTQJ7\ncg5ahj+k06y9qwbRjoxXxqD63rK0z56Mr8Tgq2rPoCD/Yjr50mWeVLR5g2yL\nNIKS\r\n=V3d4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZwm/Tao1aL7ZxkCmTWRF7VDZ45F+oYRvMovGHephUowIgAVFE8K0HhSnclJys/Y9tYCQ64t7kEZYHIYsLQNwET0s="}]},"maintainers":[{"name":"bogdibota","email":"bogdan.bota@optioffer.com"}],"_npmUser":{"name":"bogdibota","email":"bogdan.bota@optioffer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-mocha_8.0.0_1586247691747_0.7396826738406324"},"_hasShrinkwrap":false},"8.8.2":{"name":"@dvkiin/ts-mocha","version":"8.8.2","description":"Mocha thin wrapper that allows running TypeScript tests with TypeScript runtime (ts-node) to get rid of compilation complexity","repository":{"type":"git","url":"git+https://github.com/piotrwitek/ts-mocha.git"},"author":{"name":"Piotr Witek","email":"piotrek.witek@gmail.com","url":"http://piotrwitek.github.io"},"license":"MIT","main":"src/index.js","bin":{"ts-mocha":"./bin/ts-mocha"},"engines":{"node":">= 6.X.X"},"scripts":{"clean":"rm -rf node_modules/","reinstall":"npm run clean && npm install","pretest:baseline":"npm install --peer","test:baseline":"./bin/ts-mocha -p test/baseline/tsconfig.json test/baseline/**/*.spec.ts && node test/baseline/programmatic-use-test.js","pretest:paths":"npm install --optional","test:paths":"./bin/ts-mocha --paths -p test/paths/tsconfig.json test/paths/**/*.spec.ts && node test/paths/programmatic-use-test.js","test":"npm run test:baseline & npm run test:paths","prepublishOnly":"npm run clean && npm install --production && npm install -D mocha && npm test"},"dependencies":{"ts-node":"8.8.2","tsconfig-paths":"^3.9.0"},"devDependencies":{"@types/expect":"24.3.0","@types/mocha":"7.0.2","@types/node":"^13.11.0","expect":"^25.2.7","husky":"4.2.3","mocha":"^6.2.3","tslint":"6.1.1","typescript":"3.8.3"},"peerDependencies":{"mocha":"^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X"},"optionalDependencies":{"tsconfig-paths":"^3.9.0"},"keywords":["ts","mocha","typescript","ts-node","test"],"greenkeeper":{"ignore":["@types/expect","@types/mocha","@types/node","expect","husky","tslint"]},"gitHead":"c9dd16d4c14c988a0fd80cd3d8e1a97fbb74d7d5","bugs":{"url":"https://github.com/piotrwitek/ts-mocha/issues"},"homepage":"https://github.com/piotrwitek/ts-mocha#readme","_id":"@dvkiin/ts-mocha@8.8.2","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-OfnBMy2UkwWXhsW6LN36WY4uijaqFu+Yk9GPQJn5Ra9Cku5WMYA8ff32cLjkMmYIHcAUQH+ViVo4GlG648IOrw==","shasum":"f861d61b0ea3761aeee27a6bcb027b6edf00f900","tarball":"https://registry.npmjs.org/@dvkiin/ts-mocha/-/ts-mocha-8.8.2.tgz","fileCount":7,"unpackedSize":81654,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJejEesCRA9TVsSAnZWagAAYKYP/iHZ+DyFeTS8ABk3jIsO\n6Uq7uQmLfljBl7K5ZVwUKKcgTLsAszE3+eyQ2i/K3JgBNfMC2GZrYD+YtIcI\nsG2z90AStocf/H+3KZfVveRLf43SRn5AYuiHCdt9GE/gTOucDIdYgZhvDOk8\nJ3VcZ50XswjaQZPUISd6yBQSCAS0rqg6Bmp6+lat9uuUWqQf6Mte3KCbuHpv\nw4FZwS9hfFCjcQ/gnYUchgryIAFtBdmT1hiFscRWL7613Bjl040vyihuHPUg\nGmP4piv46CxgmrlUEooucD6iWwa4jaS2nWoRI/DmQTjqotHa3md8Q0PVJrWL\nGJh7r/fWFW2jK0C28y1U/64e+TxtzVPGCosHw+8+FdTfSIzjlZfHKuaNi27c\nJYobLAPkXlNBFt77ENfZbVUBxo1ylDnn8jUXmNEilVzGM5Op521ABHdJbOvA\n8gp7cIim7PVOGxhNU/N1PiNUB9WR5UB2dGWOYtv5RyfzdQ/8AxR+c1C9+bbV\nvWJ+sPmuu3BoH2/MKuXnN1gWrz6ilNmHYZxcV20faNqwUe5DPlbCswie0eA5\nK7oQqU/g+CGKVFlqgqsKgnYc8yVtzORMg8TVw9lLN3zRoIdbJxnckd4rsixK\n5C9hlMbcLQHXnhi2UjKeFi+uhSn6G5XEA9NY/j0qF6eFg5dE0pPiyuU23Nk7\nIWQT\r\n=M1sB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbWRN7EI6xis6jk7ay0IBSRiZaYjVLQ/hAQg1BuV7oFgIgFzLeNOVYc4XAKhuCApIlCAMVLf/Q8ExMmX/FYVoHBmo="}]},"maintainers":[{"name":"bogdibota","email":"bogdan.bota@optioffer.com"}],"_npmUser":{"name":"bogdibota","email":"bogdan.bota@optioffer.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-mocha_8.8.2_1586251691993_0.2277263397545899"},"_hasShrinkwrap":false}},"time":{"created":"2020-04-07T08:21:31.550Z","8.0.0":"2020-04-07T08:21:31.935Z","modified":"2022-04-05T06:10:23.908Z","8.8.2":"2020-04-07T09:28:12.117Z"},"maintainers":[{"name":"bogdibota","email":"bogdan.bota@optioffer.com"}],"description":"Mocha thin wrapper that allows running TypeScript tests with TypeScript runtime (ts-node) to get rid of compilation complexity","homepage":"https://github.com/piotrwitek/ts-mocha#readme","keywords":["ts","mocha","typescript","ts-node","test"],"repository":{"type":"git","url":"git+https://github.com/piotrwitek/ts-mocha.git"},"author":{"name":"Piotr Witek","email":"piotrek.witek@gmail.com","url":"http://piotrwitek.github.io"},"bugs":{"url":"https://github.com/piotrwitek/ts-mocha/issues"},"license":"MIT","readme":"[![Latest Stable Version](https://img.shields.io/npm/v/ts-mocha.svg)](https://www.npmjs.com/package/ts-mocha)\n[![NPM Downloads](https://img.shields.io/npm/dt/ts-mocha.svg)](https://www.npmjs.com/package/ts-mocha)\n[![NPM Downloads](https://img.shields.io/npm/dm/ts-mocha.svg)](https://www.npmjs.com/package/ts-mocha)\n\n[![Codeship Status for piotrwitek/ts-mocha](https://app.codeship.com/projects/cb8cc460-1719-0137-28fd-3a09a0997096/status?branch=master)](https://app.codeship.com/projects/328034)\n[![Greenkeeper badge](https://badges.greenkeeper.io/piotrwitek/ts-mocha.svg)](https://greenkeeper.io/)\n[![Dependency Status](https://img.shields.io/david/piotrwitek/ts-mocha.svg)](https://david-dm.org/piotrwitek/ts-mocha)\n[![peerDependency Status](https://img.shields.io/david/peer/piotrwitek/ts-mocha.svg)](https://david-dm.org/piotrwitek/ts-mocha#info=devDependencies)\n\n# TS-Mocha\n> Mocha thin wrapper that allows running TypeScript tests with TypeScript runtime (ts-node) to get rid of compilation complexity.\n> All Mocha features are available without any limitation.\n\n## Why?\nTo setup Mocha with TypeScript you have to figure out how to integrate them to work together, it's not an easy task and require some advanced knowledge.\nThis package handles for you this complexity and let you use ts-mocha just as regular mocha that will handle TypeScript `.ts` and `.tsx` files. Also added some useful options, you can find them below.\n\n## How?\nTS-Mocha has one only dependency - ts-node, which is used as a TypeScript runtime to execute tests that can import and run imported TypeScript source files as well. It is as a thin wrapper that run local mocha package and set up ts-node environment to handle `.ts` and `.tsx` files. To speed up TypeScript tests execution type-checking is disabled, using only transpile module.\n\n> __NOTE__: This package does not include Mocha - I have set Mocha as peer dependency on purpose, so I don't lock consumer to a specific Mocha version but most importantly, I don't have to update this package when Mocha is updated, and all the new features will be available automatically from your local Mocha package. Also integration with your existing Mocha setup is non-invasive.\n\n> __PRO TIP__: To make your developer experience better I recommend to run type-checking in a separate process by starting TSC compiler (preferably in watch mode) in you terminal with --noEmit and --project flags.\n\n## Installation\n\n```bash\n# remember to install mocha if you don't have it already (npm i -D mocha)\n\nnpm i -D ts-mocha\n\n# install recent Mocha and Expect @types packages for best DX\nnpm i -D @types/mocha @types/expect\n```\n\n## Usage\n\n### - CLI Usage:\n\nCLI options consist of all the options of regular Mocha plus extra options below:\n\n`-p, --project <value>` - relative or absolute path to a `tsconfig.json` file (equivalent of `tsc -p <value>`) [default: \"./tsconfig.json\"]\n\nExample:\n```bash\nts-mocha -p src/tsconfig.json src/**/*.spec.ts\n```\n\n`--paths` - feature toggle flag to enable [`tsconfig-paths`](https://www.npmjs.com/package/tsconfig-paths) integration [default: false]\n> `tsconfig-paths` is an optional dependency, make sure to install it locally in your project\n\nWhen using [path mapping](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping) via the `paths` compiler option in `tsconfig.json` this library utilizes the [`tsconfig-paths`](https://www.npmjs.com/package/tsconfig-paths) package, allowing for automatic resolution of aliased modules locations during test execution.\n\nCheck our test suite for a reference implementation: [Link](./test/paths/tsconfig.json)\n\n**Example:**\n```bash\nts-mocha --paths -p src/ src/**/*.spec.ts\n```\n\n### Watch Mode:\nIf you want your tests to be automatically rerun when your code changes, add both the `-w` flag and the `--watch-extensions` flag telling it to watch for typescript files.\n\n**Example:**\n```bash\nts-mocha --paths -p src/ src/**/*.spec.ts -w --watch-extensions ts\n```\n\n### - Programmatic usage:\n\nIn code you can use ts-mocha by adding a single require at the beginning of your script:\n\n```javascript\n// set env variable to the `tsconfig.json` path before loading mocha (default: './tsconfig.json')\nprocess.env.TS_NODE_PROJECT = './src/tsconfig.json'\n\n// Optional: set env variable to enable `tsconfig-paths` integration\nprocess.env.TS_CONFIG_PATHS = true;\n\n// register mocha wrapper\nrequire('ts-mocha');\n```\n\nFor example:\n\n```javascript\nprocess.env.TS_NODE_PROJECT = './src/tsconfig.json';\nrequire('ts-mocha');\nconst Mocha = require('mocha');\n\nconst mocha = new Mocha();\nmocha.addFile(`./src/file.spec.ts`);\nmocha.run((failures) => {\n  process.on('exit', () => {\n    process.exit(failures); // exit with non-zero status if there were failures\n  });\n});\n```\n","readmeFilename":"README.md"}