-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtests.js
39 lines (32 loc) · 959 Bytes
/
tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var test = require('tape'),
lint = require('jshint').JSHINT;
test('returns false if lint is found', function(t) {
t.plan(1)
t.false(lint('var no_semicolon'));
});
test('jshint errors are properties of itself', function(t) {
t.plan(9);
var expected = {
id: '(error)',
raw: 'Missing semicolon.',
evidence: 'var no_semicolon',
line: 1,
character: 17,
scope: '(main)',
reason: 'Missing semicolon.'
};
t.false(lint('var no_semicolon'));
t.same(lint.errors.length, 1);
Object.keys(expected).forEach(function (key) {
t.same(lint.errors[0][key], expected[key]);
});
});
test('returns true if lint-free', function(t) {
t.plan(1)
t.false(lint('var no_semicolon'));
});
test('lint-free jshint errors property is an empty array', function(t) {
t.plan(2);
t.true(lint('var isok;'));
t.same(lint.errors, []);
});