-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.js
46 lines (41 loc) · 1.03 KB
/
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
// @flow
'use strict';
const path = require('path');
const query = require('./');
const DIRNAME = new RegExp(path.dirname(__dirname), 'g');
const fixturePath = path.join(__dirname, 'fixture');
function serialize(obj) {
return JSON.stringify(obj, null, 2).replace(DIRNAME, '/..');
}
test('fixture', () => {
return query({
cwd: fixturePath,
projectFiles: {
readme: 'README.md',
releases: 'releases/**/*.md',
},
workspaceFiles: {
readme: 'README.md',
docs: 'docs/**/*.md',
examples: 'examples/**/*.js',
},
}).then(results => {
expect(serialize(results)).toMatchSnapshot();
});
});
test('fixture from nested folder', () => {
return query({
cwd: path.join(fixturePath, 'packages', 'bar'),
projectFiles: {
readme: 'README.md',
releases: 'releases/**/*.md',
},
workspaceFiles: {
readme: 'README.md',
docs: 'docs/**/*.md',
examples: 'examples/**/*.js',
},
}).then(results => {
expect(serialize(results)).toMatchSnapshot();
});
});