Unverified Commit 0f7ce4c0 authored by Seth Thompson's avatar Seth Thompson Committed by GitHub
Browse files

support files without extensions in assets (#462)

parent c855dae6
......@@ -4,13 +4,8 @@ var Debug = require('debug')
var path = require('path')
// Figure out what directory the file is in.
// Does nothing if a directory is passed.
exports.dirname = function (pathname) {
if (!path.extname(pathname)) {
return pathname
} else {
return path.dirname(pathname)
}
return path.dirname(pathname)
}
// Figure out what directory the file is in.
......
......@@ -28,6 +28,26 @@ tape('run a JS pipeline', function (assert) {
})
})
tape('use a folder as an entry point', function (assert) {
assert.plan(2)
var file = dedent`
console.log(1 + 1)
`
var dirname = 'js-pipeline-' + (Math.random() * 1e4).toFixed()
var tmpDirname = path.join(os.tmpdir(), dirname)
var tmpScriptname = path.join(tmpDirname, 'index.js')
fs.mkdirSync(tmpDirname)
fs.writeFileSync(tmpScriptname, file)
var compiler = bankai(tmpDirname, { watch: false })
compiler.scripts('bundle.js', function (err, res) {
assert.error(err, 'no error writing script')
assert.notEqual(res.buffer.toString('utf8').indexOf('console.log'), -1, 'contains js')
rimraf.sync(tmpDirname)
})
})
tape('return an error if an incorrect script is selected', function (assert) {
assert.plan(1)
var file = dedent`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment