nodejs/test/parallel/test-module-loading-error.js
Roman Reiss f29762f4dd test: enable linting for tests
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.

test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.

PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-19 21:21:27 +02:00

37 lines
747 B
JavaScript

'use strict';
var common = require('../common');
var assert = require('assert');
common.debug('load test-module-loading-error.js');
var error_desc = {
win32: '%1 is not a valid Win32 application',
linux: 'file too short',
sunos: 'unknown file type'
};
var dlerror_msg = error_desc[process.platform];
if (!dlerror_msg) {
console.error('Skipping test, platform not supported.');
process.exit();
}
try {
require('../fixtures/module-loading-error.node');
} catch (e) {
assert.notEqual(e.toString().indexOf(dlerror_msg), -1);
}
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);
}