Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Files are no longer cached in debug mode

  • Loading branch information...
commit 60c7e34150a6271babfb3b7a71def07eae8274a3 1 parent 8510f86
@serby authored
Showing with 40 additions and 7 deletions.
  1. +1 −1  lib/compact.js
  2. +1 −1  package.json
  3. +38 −5 test/compact.test.js
View
2  lib/compact.js
@@ -182,7 +182,7 @@ module.exports.createCompact = function(options, globalUglifyOptions) {
var compressFunction = options.debug ? copyJavaScript : compressAndWriteJavascript;
var hash = namespaceGroups.join('|');
- if (!namespaceGroupsCache[hash]) {
+ if (options.debug || !namespaceGroupsCache[hash]) {
async.map(namespaceGroups, compressFunction, function(error, results) {
if (error) {
return callback(error);
View
2  package.json
@@ -2,7 +2,7 @@
"author": "Paul Serby <paul@serby.net>",
"name": "compact",
"description": "A JavaScript compacting middleware for express",
- "version": "0.0.6",
+ "version": "0.0.7",
"repository": {
"type": "git",
"url": "git://github.com/serby/compact.git"
View
43 test/compact.test.js
@@ -256,11 +256,7 @@ describe('compact.js', function() {
, res;
compactDebug.js(['global'])(req, res, function() {
-
- fs.readFile(destPath + '/global.js', function(error, data) {
- // data.toString().should.equal('var a=1;a=10;var b=3,c=5');
- done();
- });
+ done();
});
});
@@ -486,5 +482,42 @@ describe('compact.js', function() {
});
+
+ it('should not cache namespace when in debug mode', function (done) {
+
+ var content = 'var test = 1';
+ fs.writeFileSync(srcPath + '/tmp.js', content);
+
+ compactDebug.addNamespace('global')
+ .addJs('/tmp.js')
+ ;
+
+
+
+ var
+ results = [content, ''],
+ i = 0,
+ req = {
+ app: {
+ helpers: function(helper) {
+ fs.readFileSync(destPath + '/0b93b4310e-tmp.js').toString().should.equal(results[i++]);
+ },
+ configure: function(fn) {
+ fn();
+ }
+
+ }
+ }
+ , res;
+
+ compactDebug.js(['global'])(req, res, function() {
+ fs.unlinkSync(srcPath + '/tmp.js');
+ compactDebug.js(['global'])(req, res, function() {
+ done();
+ });
+ });
+ });
+
+
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.