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

The tap skipping output is so prevalent yet obscure in nature that we ought to move it into it's own function in test/common.js PR-URL: https://github.com/nodejs/node/pull/6697 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
39 lines
863 B
JavaScript
39 lines
863 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
console.error('load test-module-loading-error.js');
|
|
|
|
var 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']
|
|
};
|
|
var 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.notEqual(e.toString().indexOf('missing path'), -1);
|
|
}
|
|
|
|
try {
|
|
require({});
|
|
} catch (e) {
|
|
assert.notEqual(e.toString().indexOf('path must be a string'), -1);
|
|
}
|