Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
807 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var test = require('tape');
|
---|
| 2 | var path = require('path');
|
---|
| 3 | var resolve = require('../');
|
---|
| 4 |
|
---|
| 5 | test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) {
|
---|
| 6 | t.plan(1);
|
---|
| 7 |
|
---|
| 8 | var resolverDir = 'C:\\a\\b\\c\\d';
|
---|
| 9 |
|
---|
| 10 | resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) {
|
---|
| 11 | t.equal(!!err, true);
|
---|
| 12 | });
|
---|
| 13 | });
|
---|
| 14 |
|
---|
| 15 | test('non-existent basedir should not throw when preserveSymlinks is false', function (t) {
|
---|
| 16 | t.plan(2);
|
---|
| 17 |
|
---|
| 18 | var opts = {
|
---|
| 19 | basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'),
|
---|
| 20 | preserveSymlinks: false
|
---|
| 21 | };
|
---|
| 22 |
|
---|
| 23 | var module = './dotdot/abc';
|
---|
| 24 |
|
---|
| 25 | resolve(module, opts, function (err, res) {
|
---|
| 26 | t.equal(err.code, 'MODULE_NOT_FOUND');
|
---|
| 27 | t.equal(res, undefined);
|
---|
| 28 | });
|
---|
| 29 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.