Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 62646cd

Browse files
committed
refactor: Changed tests to mocha
1 parent a54511e commit 62646cd

File tree

9 files changed

+690
-10
lines changed

9 files changed

+690
-10
lines changed

Diff for: package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"scripts": {
1010
"build": "tsc",
1111
"pretest": "npm run build",
12-
"test": "node -r babel-register ./node_modules/.bin/tape 'tests/**/*-test.js' |tap-spec",
12+
"test": "mocha -r babel-register 'tests/**/*-test.js'",
1313
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -w",
1414
"preversion": "npm test",
1515
"version": "npm run build && conventional-changelog -p angular -v -r 0 > CHANGELOG.md && git add -A .",
@@ -26,13 +26,14 @@
2626
},
2727
"license": "MIT",
2828
"devDependencies": {
29+
"babel-core": "6.3.17",
2930
"babel-preset-es2015": "6.3.13",
3031
"babel-register": "6.3.13",
32+
"chai": "3.4.1",
3133
"cz-conventional-changelog": "1.1.5",
3234
"in-publish": "2.0.0",
35+
"mocha": "2.3.4",
3336
"react": "0.14.3",
34-
"tap-spec": "4.1.1",
35-
"tape": "4.2.2",
3637
"tslint": "3.2.1",
3738
"typescript": "1.7.5"
3839
},

Diff for: tests/component-test.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import test from 'tape';
1+
import { assert } from 'chai';
22
import * as fs from 'fs';
33
import * as path from 'path';
44

55
import * as react2dts from '../index';
66

7-
test('create definition from simple component', function(t) {
8-
t.equals(
9-
react2dts.generateFromFile('simple-component', path.join(__dirname, 'simple-component.jsx')),
10-
fs.readFileSync(path.join(__dirname, 'simple-component.d.ts')).toString());
11-
t.end();
7+
describe('Parsing', function() {
8+
it('should create definition from simple component', function() {
9+
assert.equal(
10+
react2dts.generateFromFile('simple-component', path.join(__dirname, 'simple-component.jsx')),
11+
fs.readFileSync(path.join(__dirname, 'simple-component.d.ts')).toString()
12+
);
13+
});
1214
});

Diff for: tests/simple-component.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default class SimpleComponent extends React.Component {
1111
optionalObject: React.PropTypes.object,
1212
optionalString: React.PropTypes.string,
1313
optionalNode: React.PropTypes.node,
14-
optionalElement: React.PropTypes.element,
14+
optionalElement: React.PropTypes.element
1515
};
1616

1717
render() {

Diff for: tsd.json

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
},
1111
"react/react.d.ts": {
1212
"commit": "715df764419937a75a25dcd76bfc954157bc7b96"
13+
},
14+
"mocha/mocha.d.ts": {
15+
"commit": "8ea42cd8bb11863ed6f242d67c502288ebc45a7b"
16+
},
17+
"chai/chai.d.ts": {
18+
"commit": "8ea42cd8bb11863ed6f242d67c502288ebc45a7b"
19+
},
20+
"assertion-error/assertion-error.d.ts": {
21+
"commit": "8ea42cd8bb11863ed6f242d67c502288ebc45a7b"
1322
}
1423
}
1524
}

Diff for: typings/assertion-error/assertion-error.d.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Type definitions for assertion-error 1.0.0
2+
// Project: https://github.com/chaijs/assertion-error
3+
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
declare module 'assertion-error' {
7+
class AssertionError implements Error {
8+
constructor(message: string, props?: any, ssf?: Function);
9+
name: string;
10+
message: string;
11+
showDiff: boolean;
12+
stack: string;
13+
}
14+
export = AssertionError;
15+
}

0 commit comments

Comments
 (0)