aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-module-binding.js
blob: a3ebaf9e7266d24c63aa84baca6d79b24aadad01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict';
require('../common');
const fixtures = require('../common/fixtures');
const { internalModuleReadJSON } = process.binding('fs');
const { readFileSync } = require('fs');
const { strictEqual } = require('assert');

strictEqual(internalModuleReadJSON('nosuchfile'), undefined);
strictEqual(internalModuleReadJSON(fixtures.path('empty.txt')), undefined);
strictEqual(internalModuleReadJSON(fixtures.path('empty-with-bom.txt')),
            undefined);
{
  const filename = fixtures.path('require-bin/package.json');
  strictEqual(internalModuleReadJSON(filename), readFileSync(filename, 'utf8'));
}