Skip to content

Commit

Permalink
moved chai-assert into main chai definition
Browse files Browse the repository at this point in the history
renamed chai-fuzzy-assert to chai-fuzzy
  • Loading branch information
Bartvds committed Jul 19, 2014
1 parent 298b893 commit dfab9f5
Show file tree
Hide file tree
Showing 7 changed files with 741 additions and 791 deletions.
4 changes: 2 additions & 2 deletions chai-datetime/chai-datetime-tests.ts
@@ -1,8 +1,8 @@
/// <reference path="../chai/chai.d.ts" />
/// <reference path="../chai/chai-assert.d.ts" />
/// <reference path="chai-datetime.d.ts" />

var expect = chai.expect;
var assert = chai.assert;

function test_equalTime(){
var date: Date = new Date(2014, 1, 1);
Expand Down Expand Up @@ -44,4 +44,4 @@ function test_afterDate(){
expect(date).to.afterDate(date);
date.should.afterDate(date);
assert.afterDate(date, date);
}
}
Expand Up @@ -3,7 +3,7 @@
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

///<reference path="../chai/chai-assert.d.ts" />
///<reference path="../chai/chai.d.ts" />

declare module chai {
interface Assert {
Expand All @@ -14,4 +14,4 @@ declare module chai {
jsonOf(act:any, exp:any, msg?:string);
notJsonOf(act:any, exp:any, msg?:string);
}
}
}
File renamed without changes.

3 comments on commit dfab9f5

@derekcicerone-zz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change broke our usage of chai. Previously we were using chai-assert.d.ts and accessing the assertions via the global "assert" variable. After upgrading the global variable is missing and using "chai.assert" to access assertions doesn't work. There is also one other negative aspect to this change: previously we only used the assert library but now the expect library is also exposed to developers.

@Bartvds
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having them separate file was not according to the DT style ("chai.assert" was an artifact and doesn't exists as separate entity in chai itself).

Adding them to the main chai definition matches the way the JS code is distributed. This matches the usage pattern in chai's docs and works:

import chai = require('chai');
var assert = chai.assert;

And afaik there is no global 'assert' variable in chai; it is an artifact of how people use it (by assigning it to a global somehwere and then in the test assume it is there), so doesn't belong in the definitions either.

@derekcicerone-zz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, you are right - I was looking to see if we had a global assignment somewhere and I totally missed it. Thanks for the explanation - that makes sense.

Please sign in to comment.