[Pkg-javascript-commits] [node-acorn-jsx] 315/484: Clone test options object since calling `parse` is destructive for it.

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit c26fd33826de858c1edfbea66db31984002664e0
Author: Ingvar Stepanyan <me at rreverser.com>
Date:   Sun Oct 26 19:20:00 2014 +0200

    Clone test options object since calling `parse` is destructive for it.
---
 test/driver.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/driver.js b/test/driver.js
index 8b812bf..5c71b1e 100644
--- a/test/driver.js
+++ b/test/driver.js
@@ -32,8 +32,9 @@
       var test = tests[i];
       try {
         comments = [];
-        if (test.options && !test.options.onComment) test.options.onComment = onComment;
-        var ast = parse(test.code, test.options || opts);
+        var testOpts = JSON.parse(JSON.stringify(test.options || opts));
+        if (!testOpts.onComment) testOpts.onComment = onComment;
+        var ast = parse(test.code, testOpts);
         if (test.error) {
           if (config.loose) {
             callback("ok", test.code);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list