-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
executable file
·46 lines (42 loc) · 862 Bytes
/
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
#!/usr/bin/env node
const assert = require('assert').strict;
const path = require('path');
const { spawnSync } = require('child_process');
const main = () => {
testCLI();
testAPI();
};
const testAPI = () => require('./tests');
const testCLI = () => {
const { stdout, stderr } = spawnSync(
path.join(__dirname, 'cli.js'),
['--stdin-filepath', 'test.js'],
{
encoding: 'utf8',
input:
'html`<div id="foo" class="bar" data-foo="foo" data-bar="bar" data-baz="baz" data-qux="qux">foo</div>`',
},
);
if (stderr) {
// eslint-disable-next-line no-console
console.error(stderr);
}
assert.equal(
stdout,
'\
html`\n\
<div\n\
id="foo"\n\
class="bar"\n\
data-foo="foo"\n\
data-bar="bar"\n\
data-baz="baz"\n\
data-qux="qux"\n\
>\n\
foo\n\
</div>\n\
`;\n\
',
);
};
main();