Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
fixing file_list_modified callback, getting rid of extra promise (old…
Browse files Browse the repository at this point in the history
… filesPromise was removed in karma 0.13)
  • Loading branch information
hikirsch committed Aug 27, 2015
1 parent 9c15c65 commit 66744f3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
60 changes: 29 additions & 31 deletions lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,39 @@ var initClosureDependencyResolver = function(emitter, fileList, resolver, iit, f
});

// whenever file list changes, resolve the deps - update files.included
emitter.on('file_list_modified', function(promise) {
promise.then(function(files) {
var includedPaths = files.included.map(function(file) {
return file.originalPath;
});

if (iit.isInclusive()) {
includedPaths = includedPaths.filter(iit.filter);
}
emitter.on('file_list_modified', function(files) {
var includedPaths = files.included.map(function(file) {
return file.originalPath;
});

var resolvedPaths = resolver.resolveFiles(includedPaths);
var servedFiles = files.served;
if (iit.isInclusive()) {
includedPaths = includedPaths.filter(iit.filter);
}

// TODO(vojta): change files.served to be a map, rather than an array
files.included = resolvedPaths.map(function(filepath) {
for (var i = 0, length = servedFiles.length; i < length; i++) {
if (servedFiles[i].originalPath === filepath) {
return servedFiles[i];
}
var resolvedPaths = resolver.resolveFiles(includedPaths);
var servedFiles = files.served;

// TODO(vojta): change files.served to be a map, rather than an array
files.included = resolvedPaths.map(function(filepath) {
for (var i = 0, length = servedFiles.length; i < length; i++) {
if (servedFiles[i].originalPath === filepath) {
return servedFiles[i];
}
}

console.error('NOT SERVED FILE', filepath);
var externalFile = {
path: filepath,
originalPath: filepath,
contentPath: filepath,
isUrl: false,
// TODO(vojta): cache mtime and restat when deps.js changes ?
// TODO(votja): use the last synced CL number in google3 ?
mtime: new Date()
};

files.served.push(externalFile);
return externalFile;
});
console.error('NOT SERVED FILE', filepath);
var externalFile = {
path: filepath,
originalPath: filepath,
contentPath: filepath,
isUrl: false,
// TODO(vojta): cache mtime and restat when deps.js changes ?
// TODO(votja): use the last synced CL number in google3 ?
mtime: new Date()
};

files.served.push(externalFile);
return externalFile;
});
});

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"grunt-coffeelint": "~0.0.6",
"grunt-contrib-jshint": "~0.6.0",
"grunt-simple-mocha": "~0.4.0",
"karma": "~0.9.4",
"karma-jasmine": "~0.0.1",
"karma": "~0.13",
"karma-jasmine": "~0.3",
"grunt-auto-release": "~0.0.3"
},
"peerDependencies": {
"karma": ">=0.9"
"karma": ">=0.13"
},
"license": "MIT",
"contributors": [
Expand Down

0 comments on commit 66744f3

Please sign in to comment.