[6a3a178] | 1 | var path = require('path');
|
---|
| 2 | var test = require('tape');
|
---|
| 3 | var resolve = require('../');
|
---|
| 4 |
|
---|
| 5 | test('dotdot', function (t) {
|
---|
| 6 | t.plan(4);
|
---|
| 7 | var dir = path.join(__dirname, '/dotdot/abc');
|
---|
| 8 |
|
---|
| 9 | resolve('..', { basedir: dir }, function (err, res, pkg) {
|
---|
| 10 | t.ifError(err);
|
---|
| 11 | t.equal(res, path.join(__dirname, 'dotdot/index.js'));
|
---|
| 12 | });
|
---|
| 13 |
|
---|
| 14 | resolve('.', { basedir: dir }, function (err, res, pkg) {
|
---|
| 15 | t.ifError(err);
|
---|
| 16 | t.equal(res, path.join(dir, 'index.js'));
|
---|
| 17 | });
|
---|
| 18 | });
|
---|
| 19 |
|
---|
| 20 | test('dotdot sync', function (t) {
|
---|
| 21 | t.plan(2);
|
---|
| 22 | var dir = path.join(__dirname, '/dotdot/abc');
|
---|
| 23 |
|
---|
| 24 | var a = resolve.sync('..', { basedir: dir });
|
---|
| 25 | t.equal(a, path.join(__dirname, 'dotdot/index.js'));
|
---|
| 26 |
|
---|
| 27 | var b = resolve.sync('.', { basedir: dir });
|
---|
| 28 | t.equal(b, path.join(dir, 'index.js'));
|
---|
| 29 | });
|
---|