babel-resolver
Advanced tools
Comparing version 0.0.8 to 0.0.9
v0.0.9 / 2015-11-11 | ||
=================== | ||
* move test-app to example-app | ||
v0.0.8 / 2015-11-11 | ||
@@ -3,0 +8,0 @@ =================== |
{ | ||
"name": "babel-resolver", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Resolve modules from any directory.", | ||
@@ -5,0 +5,0 @@ "main": "lib/createBabelResolver.js", |
@@ -30,3 +30,3 @@ # Babel Resolver [![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![Coverage status][coveralls-image]][coveralls-url] | ||
``` | ||
**Note:** Run `rm -rf ~/.babel.json` before use to clear babel's cache. If you're seeing errors, try this again. | ||
**Note:** Run `rm -rf ~/.babel.json` if you're seeing errors. | ||
@@ -33,0 +33,0 @@ **Note2:** Babel's `resolveModuleSource` is currently only called when you use `import 'module'`, not when use `require('module')` |
@@ -15,32 +15,32 @@ var assert = require('assert'); | ||
it('existing dir', function () { | ||
assert(pathExists(getFullPath('test-app/lib'))); | ||
assert(pathExists(getFullPath('../example-app/lib'))); | ||
}); | ||
it('non-existing dir', function () { | ||
assert(!pathExists(getFullPath('test-app/foo'))); | ||
assert(!pathExists(getFullPath('../example-app/foo'))); | ||
}); | ||
it('existing file with no extension', function () { | ||
assert(pathExists(getFullPath('test-app/lib/relativeImport'))); | ||
assert(pathExists(getFullPath('../example-app/lib/relativeImport'))); | ||
}); | ||
it('non-existing file with no extension', function () { | ||
assert(!pathExists(getFullPath('test-app/lib/foo'))); | ||
assert(!pathExists(getFullPath('../example-app/lib/foo'))); | ||
}); | ||
it('existing file with .js extension', function () { | ||
assert(pathExists(getFullPath('test-app/models/User.js'))); | ||
assert(pathExists(getFullPath('../example-app/models/User.js'))); | ||
}); | ||
it('non-existing file with .js extension', function () { | ||
assert(!pathExists(getFullPath('test-app/models/foo.js'))); | ||
assert(!pathExists(getFullPath('../example-app/models/foo.js'))); | ||
}); | ||
it('existing file with .json', function () { | ||
assert(pathExists(getFullPath('test-app/models/data.json'))); | ||
assert(pathExists(getFullPath('../example-app/models/data.json'))); | ||
}); | ||
it('non-existing file with .json extension', function () { | ||
assert(!pathExists(getFullPath('test-app/models/foo.json'))); | ||
assert(!pathExists(getFullPath('../example-app/models/foo.json'))); | ||
}); | ||
}); |
describe('babelResolver()', function () { | ||
it('works', function () { | ||
require('./test-app'); | ||
require('../example-app'); | ||
}); | ||
}); |
@@ -11,24 +11,24 @@ var assert = require('assert'); | ||
it('existing dir', function () { | ||
assert(pathExists(getFullPath('test-app/lib'))); | ||
assert(pathExists(getFullPath('../example-app/lib'))); | ||
}); | ||
it('non-existing dir', function () { | ||
assert(!pathExists(getFullPath('test-app/foo'))); | ||
assert(!pathExists(getFullPath('../example-app/foo'))); | ||
}); | ||
it('existing file with .js extension', function () { | ||
assert(pathExists(getFullPath('test-app/models/User.js'))); | ||
assert(pathExists(getFullPath('../example-app/models/User.js'))); | ||
}); | ||
it('non-existing file with .js extension', function () { | ||
assert(!pathExists(getFullPath('test-app/models/foo.js'))); | ||
assert(!pathExists(getFullPath('../example-app/models/foo.js'))); | ||
}); | ||
it('existing file with .json', function () { | ||
assert(pathExists(getFullPath('test-app/models/data.json'))); | ||
assert(pathExists(getFullPath('../example-app/models/data.json'))); | ||
}); | ||
it('non-existing file with .json extension', function () { | ||
assert(!pathExists(getFullPath('test-app/models/foo.json'))); | ||
assert(!pathExists(getFullPath('../example-app/models/foo.json'))); | ||
}); | ||
}); |
var assert = require('assert'); | ||
var resolve = require('path').resolve; | ||
var resolveModuleSource = require('../lib/resolveModuleSource'); | ||
var testAppDir = resolve(__dirname, 'test-app'); | ||
var testAppLibDir = resolve(__dirname, 'test-app/lib'); | ||
var exampleAppDir = resolve(__dirname, '../example-app'); | ||
var exampleAppLibDir = resolve(__dirname, '../example-app/lib'); | ||
var nodeModulesDir = resolve(__dirname, '../node_modules'); | ||
@@ -11,3 +11,3 @@ | ||
source, | ||
[nodeModulesDir, testAppDir, testAppLibDir], | ||
[nodeModulesDir, exampleAppDir, exampleAppLibDir], | ||
['.js', '.json'] | ||
@@ -36,5 +36,5 @@ ); | ||
it('returns local path for local module', function () { | ||
assert(resolveSource('models/User') === resolve(testAppDir, 'models/User')); | ||
assert(resolveSource('utils') === resolve(testAppLibDir, 'utils')); | ||
assert(resolveSource('models/User') === resolve(exampleAppDir, 'models/User')); | ||
assert(resolveSource('utils') === resolve(exampleAppLibDir, 'utils')); | ||
}); | ||
}); |
12258