diff --git a/dist/index.js b/dist/index.js
index 820109f..4c377f5 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,8 +1,8 @@
///
var ts = require("typescript");
-var chai_1 = require("chai");
var fs = require("fs");
var _ = require("lodash");
+var AssertionError = require("assertion-error");
var defaultCompilerOptions = {
noEmitOnError: true,
noImplicitAny: true,
@@ -13,7 +13,9 @@ function handleDiagnostics(type, diagnostics) {
diagnostics.forEach(function (diagnostic) {
var _a = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start), line = _a.line, character = _a.character;
var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
- chai_1.assert.fail(diagnostic, undefined, type + ": " + diagnostic.file.fileName + " (" + (line + 1) + "," + (character + 1) + "): " + message);
+ throw new AssertionError(type + ": " + diagnostic.file.fileName + " (" + (line + 1) + "," + (character + 1) + "): " + message, {
+ actual: diagnostic
+ });
});
}
function compile(fileNames, options, done) {
@@ -42,7 +44,9 @@ function compileDirectory(path, filter, options, done) {
options = _.merge(defaultCompilerOptions, (options || {}));
walk(path, filter, function (err, results) {
if (err) {
- chai_1.assert.fail(err, undefined, 'Error while walking directory for files.');
+ throw new AssertionError('Error while walking directory for files.', {
+ actual: err
+ });
done();
}
else {
diff --git a/package.json b/package.json
index 763199b..36afc6d 100644
--- a/package.json
+++ b/package.json
@@ -24,14 +24,17 @@
"license": "MIT",
"devDependencies": {
"bluebird": "^2.9.24",
- "chai": "^2.2.0",
"typescript": "^1.5.0-alpha"
},
"typescript": {
"definition": "./dist/typescript-definition-tester.d.ts"
},
"dependencies": {
+ "assertion-error": "^1.0.1",
"dts-bundle": "^0.2.0",
"lodash": "^3.6.0"
+ },
+ "peerDependencies": {
+ "typescript": "1.x"
}
}
diff --git a/src/index.ts b/src/index.ts
index c5883e9..7c96a21 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,10 +1,9 @@
///
import * as ts from "typescript";
-import * as chai from "chai";
-import {assert} from "chai";
import * as fs from "fs";
import * as _ from "lodash";
+import AssertionError = require("assertion-error");
var defaultCompilerOptions = {
noEmitOnError: true,
@@ -17,8 +16,9 @@ function handleDiagnostics(type: string, diagnostics: ts.Diagnostic[]) {
diagnostics.forEach(diagnostic => {
var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
-
- assert.fail(diagnostic, undefined, `${type}: ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
+ throw new AssertionError(`${type}: ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`, {
+ actual: diagnostic
+ });
});
}
@@ -55,7 +55,9 @@ export function compileDirectory(path: string, filter?: any, options?: any, done
walk(path, filter, (err, results) => {
if (err) {
- assert.fail(err, undefined, 'Error while walking directory for files.');
+ throw new AssertionError('Error while walking directory for files.', {
+ actual: err
+ });
done();
} else {
compile(results, options, done);
@@ -96,4 +98,4 @@ export function walk(dir: string, filter?: (fileName: string) => boolean, done?:
});
})();
});
-};
\ No newline at end of file
+};
diff --git a/test/index.ts b/test/index.ts
index 381a727..5996a4a 100644
--- a/test/index.ts
+++ b/test/index.ts
@@ -3,7 +3,6 @@
import * as ts from "typescript";
import * as tt from "../src/index";
import * as fs from "fs";
-import * as chai from "chai";
describe('ambient declaration tests', () => {
it('should compile examples successfully against typescript-definition-tester.d.ts', (done) => {
@@ -13,4 +12,4 @@ describe('ambient declaration tests', () => {
() => done()
);
});
-});
\ No newline at end of file
+});
diff --git a/tsd.json b/tsd.json
index 5176428..480c233 100644
--- a/tsd.json
+++ b/tsd.json
@@ -8,9 +8,6 @@
"typescript/typescript.d.ts": {
"commit": "8f16b0fd1acd81a555b74f912da849dccc7c9a42"
},
- "chai/chai.d.ts": {
- "commit": "8f16b0fd1acd81a555b74f912da849dccc7c9a42"
- },
"mocha/mocha.d.ts": {
"commit": "8f16b0fd1acd81a555b74f912da849dccc7c9a42"
},
@@ -22,6 +19,9 @@
},
"lodash/lodash.d.ts": {
"commit": "8f16b0fd1acd81a555b74f912da849dccc7c9a42"
+ },
+ "assertion-error/assertion-error.d.ts": {
+ "commit": "99c4fb76b5d941939ba53e61d0daee4bd74f150f"
}
}
}
diff --git a/typings/assertion-error/assertion-error.d.ts b/typings/assertion-error/assertion-error.d.ts
new file mode 100644
index 0000000..08217c9
--- /dev/null
+++ b/typings/assertion-error/assertion-error.d.ts
@@ -0,0 +1,15 @@
+// Type definitions for assertion-error 1.0.0
+// Project: https://github.com/chaijs/assertion-error
+// Definitions by: Bart van der Schoor
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module 'assertion-error' {
+ class AssertionError implements Error {
+ constructor(message: string, props?: any, ssf?: Function);
+ name: string;
+ message: string;
+ showDiff: boolean;
+ stack: string;
+ }
+ export = AssertionError;
+}
diff --git a/typings/chai/chai.d.ts b/typings/chai/chai.d.ts
deleted file mode 100644
index 4b9d313..0000000
--- a/typings/chai/chai.d.ts
+++ /dev/null
@@ -1,285 +0,0 @@
-// Type definitions for chai 2.0.0
-// Project: http://chaijs.com/
-// Definitions by: Jed Hunsaker , Bart van der Schoor
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-declare module chai {
- export class AssertionError {
- constructor(message: string, _props?: any, ssf?: Function);
- name: string;
- message: string;
- showDiff: boolean;
- stack: string;
- }
-
- export function expect(target: any, message?: string): Expect;
-
- export var assert: Assert;
- export var config: Config;
-
- export interface Config {
- includeStack: boolean;
- }
-
- // Provides a way to extend the internals of Chai
- function use(fn: (chai: any, utils: any) => void): any;
-
- interface ExpectStatic {
- (target: any): Expect;
- }
-
- interface Assertions {
- attr(name: string, value?: string): any;
- css(name: string, value?: string): any;
- data(name: string, value?: string): any;
- class(className: string): any;
- id(id: string): any;
- html(html: string): any;
- text(text: string): any;
- value(value: string): any;
- visible: any;
- hidden: any;
- selected: any;
- checked: any;
- disabled: any;
- empty: any;
- exist: any;
- }
-
- interface Expect extends LanguageChains, NumericComparison, TypeComparison, Assertions {
- not: Expect;
- deep: Deep;
- a: TypeComparison;
- an: TypeComparison;
- include: Include;
- contain: Include;
- ok: Expect;
- true: Expect;
- false: Expect;
- null: Expect;
- undefined: Expect;
- exist: Expect;
- empty: Expect;
- arguments: Expect;
- Arguments: Expect;
- equal: Equal;
- equals: Equal;
- eq: Equal;
- eql: Equal;
- eqls: Equal;
- property: Property;
- ownProperty: OwnProperty;
- haveOwnProperty: OwnProperty;
- length: Length;
- lengthOf: Length;
- match(RegularExpression: RegExp, message?: string): Expect;
- string(string: string, message?: string): Expect;
- keys: Keys;
- key(string: string): Expect;
- throw: Throw;
- throws: Throw;
- Throw: Throw;
- respondTo(method: string, message?: string): Expect;
- itself: Expect;
- satisfy(matcher: Function, message?: string): Expect;
- closeTo(expected: number, delta: number, message?: string): Expect;
- members: Members;
- }
-
- interface LanguageChains {
- to: Expect;
- be: Expect;
- been: Expect;
- is: Expect;
- that: Expect;
- which: Expect;
- and: Expect;
- have: Expect;
- has: Expect;
- with: Expect;
- at: Expect;
- of: Expect;
- same: Expect;
- }
-
- interface NumericComparison {
- above: NumberComparer;
- gt: NumberComparer;
- greaterThan: NumberComparer;
- least: NumberComparer;
- gte: NumberComparer;
- below: NumberComparer;
- lt: NumberComparer;
- lessThan: NumberComparer;
- most: NumberComparer;
- lte: NumberComparer;
- within(start: number, finish: number, message?: string): Expect;
- }
-
- interface NumberComparer {
- (value: number, message?: string): Expect;
- }
-
- interface TypeComparison {
- (type: string, message?: string): Expect;
- instanceof: InstanceOf;
- instanceOf: InstanceOf;
- }
-
- interface InstanceOf {
- (constructor: Object, message?: string): Expect;
- }
-
- interface Deep {
- equal: Equal;
- property: Property;
- }
-
- interface Equal {
- (value: any, message?: string): Expect;
- }
-
- interface Property {
- (name: string, value?: any, message?: string): Expect;
- }
-
- interface OwnProperty {
- (name: string, message?: string): Expect;
- }
-
- interface Length extends LanguageChains, NumericComparison {
- (length: number, message?: string): Expect;
- }
-
- interface Include {
- (value: Object, message?: string): Expect;
- (value: string, message?: string): Expect;
- (value: number, message?: string): Expect;
- keys: Keys;
- members: Members;
- }
-
- interface Keys {
- (...keys: string[]): Expect;
- (keys: any[]): Expect;
- }
-
- interface Members {
- (set: any[], message?: string): Expect;
- }
-
- interface Throw {
- (): Expect;
- (expected: string, message?: string): Expect;
- (expected: RegExp, message?: string): Expect;
- (constructor: Error, expected?: string, message?: string): Expect;
- (constructor: Error, expected?: RegExp, message?: string): Expect;
- (constructor: Function, expected?: string, message?: string): Expect;
- (constructor: Function, expected?: RegExp, message?: string): Expect;
- }
-
- export interface Assert {
- (express: any, msg?: string):void;
-
- fail(actual?: any, expected?: any, msg?: string, operator?: string):void;
-
- ok(val: any, msg?: string):void;
- notOk(val: any, msg?: string):void;
-
- equal(act: any, exp: any, msg?: string):void;
- notEqual(act: any, exp: any, msg?: string):void;
-
- strictEqual(act: any, exp: any, msg?: string):void;
- notStrictEqual(act: any, exp: any, msg?: string):void;
-
- deepEqual(act: any, exp: any, msg?: string):void;
- notDeepEqual(act: any, exp: any, msg?: string):void;
-
- isTrue(val: any, msg?: string):void;
- isFalse(val: any, msg?: string):void;
-
- isNull(val: any, msg?: string):void;
- isNotNull(val: any, msg?: string):void;
-
- isUndefined(val: any, msg?: string):void;
- isDefined(val: any, msg?: string):void;
-
- isFunction(val: any, msg?: string):void;
- isNotFunction(val: any, msg?: string):void;
-
- isObject(val: any, msg?: string):void;
- isNotObject(val: any, msg?: string):void;
-
- isArray(val: any, msg?: string):void;
- isNotArray(val: any, msg?: string):void;
-
- isString(val: any, msg?: string):void;
- isNotString(val: any, msg?: string):void;
-
- isNumber(val: any, msg?: string):void;
- isNotNumber(val: any, msg?: string):void;
-
- isBoolean(val: any, msg?: string):void;
- isNotBoolean(val: any, msg?: string):void;
-
- typeOf(val: any, type: string, msg?: string):void;
- notTypeOf(val: any, type: string, msg?: string):void;
-
- instanceOf(val: any, type: Function, msg?: string):void;
- notInstanceOf(val: any, type: Function, msg?: string):void;
-
- include(exp: string, inc: any, msg?: string):void;
- include(exp: any[], inc: any, msg?: string):void;
-
- notInclude(exp: string, inc: any, msg?: string):void;
- notInclude(exp: any[], inc: any, msg?: string):void;
-
- match(exp: any, re: RegExp, msg?: string):void;
- notMatch(exp: any, re: RegExp, msg?: string):void;
-
- property(obj: Object, prop: string, msg?: string):void;
- notProperty(obj: Object, prop: string, msg?: string):void;
- deepProperty(obj: Object, prop: string, msg?: string):void;
- notDeepProperty(obj: Object, prop: string, msg?: string):void;
-
- propertyVal(obj: Object, prop: string, val: any, msg?: string):void;
- propertyNotVal(obj: Object, prop: string, val: any, msg?: string):void;
-
- deepPropertyVal(obj: Object, prop: string, val: any, msg?: string):void;
- deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string):void;
-
- lengthOf(exp: any, len: number, msg?: string):void;
- //alias frenzy
- throw(fn: Function, msg?: string):void;
- throw(fn: Function, regExp: RegExp):void;
- throw(fn: Function, errType: Function, msg?: string):void;
- throw(fn: Function, errType: Function, regExp: RegExp):void;
-
- throws(fn: Function, msg?: string):void;
- throws(fn: Function, regExp: RegExp):void;
- throws(fn: Function, errType: Function, msg?: string):void;
- throws(fn: Function, errType: Function, regExp: RegExp):void;
-
- Throw(fn: Function, msg?: string):void;
- Throw(fn: Function, regExp: RegExp):void;
- Throw(fn: Function, errType: Function, msg?: string):void;
- Throw(fn: Function, errType: Function, regExp: RegExp):void;
-
- doesNotThrow(fn: Function, msg?: string):void;
- doesNotThrow(fn: Function, regExp: RegExp):void;
- doesNotThrow(fn: Function, errType: Function, msg?: string):void;
- doesNotThrow(fn: Function, errType: Function, regExp: RegExp):void;
-
- operator(val: any, operator: string, val2: any, msg?: string):void;
- closeTo(act: number, exp: number, delta: number, msg?: string):void;
-
- sameMembers(set1: any[], set2: any[], msg?: string):void;
- includeMembers(set1: any[], set2: any[], msg?: string):void;
-
- ifError(val: any, msg?: string):void;
- }
-}
-
-declare module "chai" {
- export = chai;
-}
diff --git a/typings/tsd.d.ts b/typings/tsd.d.ts
index 776639b..f1d0585 100644
--- a/typings/tsd.d.ts
+++ b/typings/tsd.d.ts
@@ -1,7 +1,7 @@
///
-///
///
///
///
///
+///