Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80540 views
1
var parser = require('../');
2
var test = require('tap').test;
3
var through = require('through2');
4
var path = require('path');
5
6
// Test that p.options.expose is defined and that the row is properly exposed
7
// (resolved to the absolute pathname corresponding to the `file` value passed
8
// in the row, and set in opts.expose).
9
test('row is exposed', function (t) {
10
t.plan(1);
11
var common_path = path.join(__dirname, '/files/main');
12
var opts = { expose: {} };
13
var p = parser(opts);
14
// Note pathname without extension.
15
p.end({ file: common_path, expose: "whatever" });
16
p.on('error', t.fail.bind(t));
17
18
p.pipe(through.obj());
19
20
p.on('end', function () {
21
// Note pathname with extension.
22
t.equal(opts.expose.whatever, common_path + '.js');
23
});
24
});
25
26