mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 22:56:06 +00:00

Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
39 lines
851 B
JavaScript
39 lines
851 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
console.error('load test-module-loading-error.js');
|
|
|
|
const error_desc = {
|
|
win32: ['%1 is not a valid Win32 application'],
|
|
linux: ['file too short', 'Exec format error'],
|
|
sunos: ['unknown file type', 'not an ELF file'],
|
|
darwin: ['file too short']
|
|
};
|
|
const dlerror_msg = error_desc[process.platform];
|
|
|
|
if (!dlerror_msg) {
|
|
common.skip('platform not supported.');
|
|
return;
|
|
}
|
|
|
|
try {
|
|
require('../fixtures/module-loading-error.node');
|
|
} catch (e) {
|
|
assert.strictEqual(dlerror_msg.some((errMsgCase) => {
|
|
return e.toString().indexOf(errMsgCase) !== -1;
|
|
}), true);
|
|
}
|
|
|
|
try {
|
|
require();
|
|
} catch (e) {
|
|
assert.ok(e.toString().includes('missing path'));
|
|
}
|
|
|
|
try {
|
|
require({});
|
|
} catch (e) {
|
|
assert.ok(e.toString().includes('path must be a string'));
|
|
}
|