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

file_list_modified callback changed in karma 0.13 #25

Merged
merged 2 commits into from
Sep 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.idea
*.iml

node_modules
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install -g grunt-cli
- npm install karma-firefox-launcher
- ln -s .. node_modules/karma-closure

script:
Expand Down
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