forked from marko-js/marko
-
Notifications
You must be signed in to change notification settings - Fork 0
/
taglib-finder-test.js
49 lines (36 loc) · 1.37 KB
/
taglib-finder-test.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
40
41
42
43
44
45
46
47
48
49
'use strict';
require('./util/patch-module');
var chai = require('chai');
chai.config.includeStack = true;
require('chai').should();
var nodePath = require('path');
require('../compiler');
var autotest = require('./autotest');
var taglibFinder = require('../compiler/taglib-finder');
describe('taglib-finder' , function() {
var autoTestDir = nodePath.join(__dirname, 'autotests/taglib-finder');
autotest.scanDir(autoTestDir, function run(dir, helpers, done) {
var test = require(nodePath.join(dir, 'test.js'));
if (test.check) {
test.check(taglibFinder, helpers);
} else {
if (test.before) {
test.before(taglibFinder);
}
var finderDir = nodePath.join(dir, test.dir);
var found = taglibFinder.find(finderDir, [])
.map((taglib) => {
if (taglib.path.startsWith(dir)) {
return taglib.path.substring(dir.length).replace(/[\\]/g, '/');
} else {
return 'BAD:' + taglib.path;
}
});
helpers.compare(found, '.json');
if (test.after) {
test.after(taglibFinder);
}
}
return done();
});
});