[Pkg-javascript-commits] [node-module-deps] 415/444: test `opts._flags` being passed to transforms
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:48:19 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-module-deps.
commit d79c2371813db7f6d1c0245405a6bd385ce494f8
Author: Michael Williams <michael.williams at enspiral.com>
Date: Mon Dec 28 03:15:55 2015 +1300
test `opts._flags` being passed to transforms
---
test/tr_flags.js | 44 ++++++++++++++++++++++++++++++++++++++++++++
test/tr_flags/empty.js | 0
2 files changed, 44 insertions(+)
diff --git a/test/tr_flags.js b/test/tr_flags.js
new file mode 100644
index 0000000..eda5987
--- /dev/null
+++ b/test/tr_flags.js
@@ -0,0 +1,44 @@
+var through = require('through2');
+var mdeps = require('../');
+var test = require('tap').test;
+
+test('--debug passed to transforms', function (t) {
+ var empty = require.resolve('./tr_flags/empty.js');
+
+ t.plan(5);
+
+ var p
+ [true, false].forEach(function(debug) {
+ p = mdeps({
+ debug: debug,
+ transform: function (file, opts) {
+ t.equal(opts._flags.debug, debug, 'debug: ' + debug);
+ return through();
+ }
+ })
+ p.on('error', function (err) { return t.fail(err.message) })
+ p.end(empty);
+
+ p = mdeps({ debug: debug })
+ p.write({
+ transform: function (file, opts) {
+ t.equal(opts._flags.debug, debug, 'debug: ' + debug);
+ return through();
+ },
+ options: {}
+ })
+ p.on('error', function (err) { return t.fail(err.message) })
+ p.end(empty);
+ });
+
+ p = mdeps({ debug: true })
+ p.write({
+ transform: function (file, opts) {
+ t.equal(opts._flags, Infinity, 'transform arguents are preserved');
+ return through();
+ },
+ options: { _flags: Infinity }
+ })
+ p.on('error', function (err) { return t.fail(err.message) })
+ p.end(empty);
+});
diff --git a/test/tr_flags/empty.js b/test/tr_flags/empty.js
new file mode 100644
index 0000000..e69de29
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-module-deps.git
More information about the Pkg-javascript-commits
mailing list