mocha-typescript
Advanced tools
Comparing version 1.1.5 to 1.1.7
@@ -252,11 +252,11 @@ import * as Mocha from "mocha"; | ||
suiteDecorator(... traits: SuiteTrait[]): ClassDecorator { | ||
return function(ctor: SuiteCtor) { | ||
return function<TFunction extends Function>(ctor: TFunction): void { | ||
ctor[traitsSymbol] = traits; | ||
suiteFunc(ctor)(ctor.name, suiteClassCallback(ctor, context)); | ||
suiteFunc(<any>ctor)(ctor.name, suiteClassCallback(<any>ctor, context)); | ||
} | ||
}, | ||
suiteDecoratorNamed(name: string, ... traits: SuiteTrait[]): ClassDecorator { | ||
return function(ctor: SuiteCtor) { | ||
return function<TFunction extends Function>(ctor: TFunction): void { | ||
ctor[traitsSymbol] = traits; | ||
suiteFunc(ctor)(name, suiteClassCallback(ctor, context)); | ||
suiteFunc(<any>ctor)(name, suiteClassCallback(<any>ctor, context)); | ||
} | ||
@@ -263,0 +263,0 @@ } |
{ | ||
"name": "mocha-typescript", | ||
"version": "1.1.5", | ||
"version": "1.1.7", | ||
"description": "TypeScript decorators based wrapper over mocha's interface", | ||
@@ -34,3 +34,3 @@ "main": "index.js", | ||
"source-map-support": "^0.4.15", | ||
"typescript": "^2.4.0" | ||
"typescript": "^2.4.1" | ||
}, | ||
@@ -37,0 +37,0 @@ "files": [ |
@@ -22,2 +22,4 @@ Writing mocha tests with style - OOP style: | ||
- [Setting up New Project With Custom UI](#setting-up-new-project-with-custom-ui) | ||
- [mocha-typescript-seed](#mocha-typescript-seed) | ||
- [Manual Steps](#manual-steps) | ||
- [Setting Up Dev Test Watcher](#setting-up-dev-test-watcher) | ||
@@ -81,6 +83,22 @@ - [Test UI API](#test-ui-api) | ||
## Setting up New Project With Custom UI | ||
### mocha-typescript-seed | ||
[Fork the mocha-typescript-seed repo](https://github.com/pana-cc/mocha-typescript-seed), or clone it: | ||
``` | ||
git clone https://github.com/pana-cc/mocha-typescript-seed.git | ||
``` | ||
Don't forget to edit the package.json, and check the license. | ||
From that point on, you could: | ||
``` | ||
npm i | ||
npm test | ||
npm run watch | ||
``` | ||
### Manual Steps | ||
Create a folder, `cd` in the folder, npm init, npm install: | ||
``` | ||
npm init | ||
npm install mocha typescript mocha-typescript @types/mocha source-map-support --save-dev | ||
npm install mocha typescript mocha-typescript @types/mocha chai @types/chai source-map-support nyc --save-dev | ||
``` | ||
@@ -90,6 +108,11 @@ Edit the package.json and set the `sripts` section to: | ||
"scripts": { | ||
"test": "tsc && mocha", | ||
"watch": "mocha-typescript-watch" | ||
"pretest": "tsc", | ||
"test": "nyc mocha", | ||
"watch": "mocha-typescript-watch", | ||
"prepare": "tsc" | ||
}, | ||
``` | ||
You may omit the `nyc` tool and have `"test": "mocha"` instead, | ||
`nic` is the instanbul code coverage reporting tool. | ||
Add a `tsconfig.json` file with settings similar to: | ||
@@ -101,2 +124,3 @@ ``` | ||
"module": "commonjs", | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
@@ -107,7 +131,7 @@ "lib": [ "es6" ] | ||
``` | ||
Create `tests` folder and add `tests/mocha.opts` file. | ||
Create `test` folder and add `test/mocha.opts` file. | ||
``` | ||
--ui mocha-typescript | ||
--require source-map-support/register | ||
test/tests.js | ||
test/test.js | ||
``` | ||
@@ -117,3 +141,3 @@ - Sets the mocha-typescript as custom ui | ||
- Optionally provide test files list, point to specific dist fodler, or skip this to use mocha's defaults | ||
Add your first test file `tests/tests.ts`: | ||
Add your first test file `test/test.ts`: | ||
``` | ||
@@ -120,0 +144,0 @@ // Reference mocha-typescript's global definitions: |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90216
338