karma-dart
Advanced tools
Comparing version 0.2.0 to 0.2.1
var path = require('path'); | ||
var fs = require('fs'); | ||
var dart2jsaas = require('dart2jsaas'); | ||
@@ -16,6 +17,22 @@ var format = require('util').format; | ||
var initDartUnittest = function(emitter, /* config.files */ files, /* config.basePath */ basePath, | ||
/* config.karmaDartImports */ customImports, logger) { | ||
/* config.karmaDartImports */ customImports, /* config.hostname */ hostname, /* config.port */ port, | ||
logger, customFileHandlers) { | ||
var log = logger.create('dart'); | ||
var dart2js = dart2jsaas.setupSystem({ | ||
fetcherBaseUrl: 'http://' + hostname + ':' + port + '/base/' | ||
}); | ||
customFileHandlers.push({ | ||
urlRegex: /.*dart.js(\?[0-9]*)?$/, | ||
handler: function(request, response, fa, fb, basePath) { | ||
var base = '/base/'; | ||
dart2js(request.url.replace(base, '').replace(/\.js(\?[0-9]*)?$/, '')).then(function(outjs) { | ||
response.writeHead(200); | ||
response.end(outjs); | ||
}); | ||
} | ||
}); | ||
// include the adapter.js | ||
@@ -39,5 +56,7 @@ files.unshift({pattern: __dirname + '/adapter.js', included: true, served: true, watched: false}); | ||
var randomUid = random(); | ||
var dartAdapterFile = { | ||
path: basePath + '/__adapter_dart_unittest.dart', | ||
contentPath: path.normalize(TEMP_DIR + '/karma-dart-adapter-' + random() + '.dart'), | ||
contentPath: path.normalize(TEMP_DIR + '/karma-dart-adapter-' + randomUid + '.dart'), | ||
isUrl: false, | ||
@@ -79,5 +98,5 @@ mtime: new Date() | ||
if (filePath.indexOf(basePath) === 0) { | ||
filePath = '/base' + filePath.substr(basePath.length); | ||
filePath = filePath.substr(basePath.length + 1); | ||
} else { | ||
filePath = '/absolute' + filePath; | ||
filePath = 'absolute' + filePath; | ||
} | ||
@@ -84,0 +103,0 @@ testImports.push(format(DART_IMPORT, filePath, 'test_' + index)); |
{ | ||
"name": "karma-dart", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A Karma plugin - adapter for Dart unittest testing framework.", | ||
@@ -20,3 +20,5 @@ "main": "lib/index.js", | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"dart2jsaas": "~0.0.1" | ||
}, | ||
"devDependencies": { | ||
@@ -23,0 +25,0 @@ "grunt-npm": "~0.0.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
218
0
24597
2
15
+ Addeddart2jsaas@~0.0.1
+ Addedcollections@0.2.2(transitive)
+ Addeddart2jsaas@0.0.16(transitive)
+ Addedmime@1.2.11(transitive)
+ Addedmimeparse@0.1.4(transitive)
+ Addedmkdirp@0.3.5(transitive)
+ Addedq@0.9.7(transitive)
+ Addedq-io@1.10.9(transitive)
+ Addedqs@0.1.0(transitive)
+ Addedurl2@0.0.0(transitive)
+ Addedweak-map@1.0.0(transitive)