HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/f/r/e/frenchy/www/french-american.org/current/node_modules/gulp-uglyfly/test/comments.js
'use strict';
var test = require('tape'),
		Vinyl = require('vinyl'),
		gulpUglyfly = require('../');
	

test('should preserve all comments', function(t) {
	t.plan(3);

	var testFile1 = new Vinyl({
		cwd: "/home/terin/broken-promises/",
		base: "/home/terin/broken-promises/test",
		path: "/home/terin/broken-promises/test/test1.js",
		contents: new Buffer('/* comment one *//*! comment two *//* comment three */')
	});

	var stream = gulpUglyfly({ preserveComments: 'all' });

	stream.on('data', function(newFile) {
		var contents = newFile.contents.toString();
		t.ok(/one/.test(contents), 'has comment one');
		t.ok(/two/.test(contents), 'has comment two');
		t.ok(/three/.test(contents), 'has comment three');
	});

	stream.write(testFile1);
	stream.end();
});

test('should preserve important comments', function(t) {
	t.plan(3);

	var testFile1 = new Vinyl({
		cwd: "/home/terin/broken-promises/",
		base: "/home/terin/broken-promises/test",
		path: "/home/terin/broken-promises/test/test1.js",
		contents: new Buffer('/* comment one *//*! comment two *//* comment three */')
	});

	var stream = gulpUglyfly({ preserveComments: 'some' });

	stream.on('data', function(newFile) {
		var contents = newFile.contents.toString();
		t.false(/one/.test(contents), 'does not have comment one');
		t.ok(/two/.test(contents), 'has comment two');
		t.false(/three/.test(contents), 'does not have comment three');
	});

	stream.write(testFile1);
	stream.end();
});

test('should preserve comments that fn returns true for', function(t) {
	t.plan(3);

	var testFile1 = new Vinyl({
		cwd: "/home/terin/broken-promises/",
		base: "/home/terin/broken-promises/test",
		path: "/home/terin/broken-promises/test/test1.js",
		contents: new Buffer('/* comment one *//*! comment two *//* comment three */')
	});

	var stream = gulpUglyfly({
		preserveComments: function(node, comment) {
			return /three/.test(comment.value);
		}
	});

	stream.on('data', function(newFile) {
		var contents = newFile.contents.toString();
		t.false(/one/.test(contents), 'does not have comment one');
		t.false(/two/.test(contents), 'does not have comment two');
		t.true(/three/.test(contents), 'has comment three');
	});

	stream.write(testFile1);
	stream.end();
});