1 | var parser = require('../');
|
2 | var test = require('tap').test;
|
3 | var through = require('through2');
|
4 | var path = require('path');
|
5 |
|
6 |
|
7 |
|
8 | test('row is exposed with a name equal to the path, and transformed', function (t) {
|
9 | t.plan(2);
|
10 | var exposed_path = path.join(__dirname, '/files/main.js');
|
11 | var found_exposed_path = false;
|
12 | var opts = {
|
13 | expose: {},
|
14 | transform: function(file) {
|
15 | if (file === exposed_path) {
|
16 | found_exposed_path = true;
|
17 | }
|
18 | return through();
|
19 | }
|
20 | };
|
21 |
|
22 | var p = parser(opts);
|
23 | p.end({ file: exposed_path, expose: exposed_path });
|
24 | p.on('error', t.fail.bind(t));
|
25 |
|
26 | p.pipe(through.obj());
|
27 |
|
28 | p.on('end', function () {
|
29 | t.equal(opts.expose[exposed_path], exposed_path);
|
30 | t.ok(found_exposed_path);
|
31 | });
|
32 | });
|