forked from pattern-lab/patternlab-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwatchPatternLabFiles_tests.js
More file actions
44 lines (36 loc) · 998 Bytes
/
watchPatternLabFiles_tests.js
File metadata and controls
44 lines (36 loc) · 998 Bytes
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
'use strict';
const _ = require('lodash');
const tap = require('tap');
const rewire = require('rewire');
const path = require('path');
const util = require('./util/test_utils.js');
const watchPatternLabFiles = rewire('../core/lib/watchPatternLabFiles');
const patterns_dir = './test/files/_patterns';
tap.test(
'watchPatternLabFiles - adds watcher to patternlab.watchers for given patternWatchPath',
test => {
const pl = util.fakePatternLab(patterns_dir, {
watchers: [],
engines: {},
});
pl.engines.getSupportedFileExtensions = () => {
return ['.mustache'];
};
watchPatternLabFiles(
pl,
{
source: {
data: '_data',
meta: '_meta',
patterns: 'patterns',
},
},
'/foo',
true
);
// should have two for _data and _meta
// should have five for '.json', '.yml', '.yaml', '.md' and '.mustache'
test.equals(Object.keys(pl.watchers).length, 7);
test.end();
}
);