mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
966e3d3493
PR-URL: https://github.com/nodejs/node/pull/49128 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
19 lines
454 B
JavaScript
19 lines
454 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
|
|
const filePath = tmpdir.resolve('test-module-cache.json');
|
|
assert.throws(
|
|
() => require(filePath),
|
|
{ code: 'MODULE_NOT_FOUND' }
|
|
);
|
|
|
|
fs.writeFileSync(filePath, '[]');
|
|
|
|
const content = require(filePath);
|
|
assert.strictEqual(Array.isArray(content), true);
|
|
assert.strictEqual(content.length, 0);
|