Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use path.join in more places in tests so they can run on windows - Fix noParse check on windows - Fix regex in multi_entry test for windows paths - Skip symlink tests on windows - Fix ignore check on windows - Fix paths in noparse and ignore tests on windows.
- Loading branch information
1 parent
2d896a9
commit c5120b7
Showing
16 changed files
with
124 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,91 @@ | ||
var browserify = require('../'); | ||
var test = require('tap').test; | ||
var vm = require('vm'); | ||
|
||
test('ignore', function (t) { | ||
t.plan(1); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/main.js'); | ||
b.ignore( __dirname + '/ignore/skip.js'); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) t.fail(err); | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
}); | ||
|
||
test('ignore array', function(t) { | ||
t.plan(2); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/array.js'); | ||
b.ignore([ | ||
__dirname + '/ignore/skip.js', | ||
__dirname + '/ignore/skip2.js' | ||
]); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) { | ||
t.fail(err); | ||
} | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
}); | ||
|
||
test('ignore by package or id', function (t) { | ||
t.plan(3); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/by-id.js'); | ||
b.ignore('events'); | ||
b.ignore('beep'); | ||
b.ignore('bad id'); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) t.fail(err); | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
}); | ||
|
||
test('ignore files referenced by relative path', function (t) { | ||
// Change the current working directory relative to this file | ||
var cwd = process.cwd(); | ||
process.chdir(__dirname); | ||
|
||
t.plan(1); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/by-relative.js'); | ||
b.ignore('./ignore/ignored/skip.js'); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) t.fail(err); | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
|
||
// Revert CWD | ||
process.chdir(cwd); | ||
}); | ||
|
||
test('do not ignore files with relative paths that do not resolve', function (t) { | ||
// Change the current working directory to the ignore folder | ||
var cwd = process.cwd(); | ||
process.chdir(__dirname + '/ignore'); | ||
|
||
t.plan(2); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/double-skip.js'); | ||
|
||
b.ignore('./skip.js'); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) t.fail(err); | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
|
||
// Revert CWD | ||
process.chdir(cwd); | ||
}); | ||
var browserify = require('../'); | ||
var test = require('tap').test; | ||
var vm = require('vm'); | ||
var path = require('path'); | ||
|
||
test('ignore', function (t) { | ||
t.plan(1); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/main.js'); | ||
b.ignore(path.join(__dirname, 'ignore/skip.js')); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) t.fail(err); | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
}); | ||
|
||
test('ignore array', function(t) { | ||
t.plan(2); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/array.js'); | ||
b.ignore([ | ||
path.join(__dirname, 'ignore/skip.js'), | ||
path.join(__dirname, 'ignore/skip2.js') | ||
]); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) { | ||
t.fail(err); | ||
} | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
}); | ||
|
||
test('ignore by package or id', function (t) { | ||
t.plan(3); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/by-id.js'); | ||
b.ignore('events'); | ||
b.ignore('beep'); | ||
b.ignore('bad id'); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) t.fail(err); | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
}); | ||
|
||
test('ignore files referenced by relative path', function (t) { | ||
// Change the current working directory relative to this file | ||
var cwd = process.cwd(); | ||
process.chdir(__dirname); | ||
|
||
t.plan(1); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/by-relative.js'); | ||
b.ignore('./ignore/ignored/skip.js'); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) t.fail(err); | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
|
||
// Revert CWD | ||
process.chdir(cwd); | ||
}); | ||
|
||
test('do not ignore files with relative paths that do not resolve', function (t) { | ||
// Change the current working directory to the ignore folder | ||
var cwd = process.cwd(); | ||
process.chdir(__dirname + '/ignore'); | ||
|
||
t.plan(2); | ||
|
||
var b = browserify(); | ||
b.add(__dirname + '/ignore/double-skip.js'); | ||
|
||
b.ignore('./skip.js'); | ||
|
||
b.bundle(function (err, src) { | ||
if (err) t.fail(err); | ||
vm.runInNewContext(src, { t: t }); | ||
}); | ||
|
||
// Revert CWD | ||
process.chdir(cwd); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.