chore(test): migrate Dart tests to package:test
Instead of running with karma and the karma-dart shim, run dart tests directly using the new package:test runner. This migrates away from package:unittest. Fixes a couple tests, mostly associated with depending on absolute URLs or editing the test providers after an injector had already been created. Remove karma-dart and associated files. Change gupfiles to run tests via `pub run test` instead.
This commit is contained in:
21
tools/build/create_dart_test_main.js
Normal file
21
tools/build/create_dart_test_main.js
Normal file
@ -0,0 +1,21 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = function(dir, files) {
|
||||
var filename = 'main_test.dart';
|
||||
var imports = [
|
||||
'@TestOn("browser")',
|
||||
'import "package:guinness2/guinness2.dart";'];
|
||||
var executes = [];
|
||||
|
||||
files.forEach(function(match) {
|
||||
var varName = match.replace(/[\/.]/g, '_');
|
||||
imports.push('import "' + match + '" as ' + varName +';');
|
||||
executes.push(' ' + varName + '.main();');
|
||||
});
|
||||
|
||||
var output = imports.join('\n') + '\n\nmain() {\n' + executes.join('\n') + '\n}';
|
||||
|
||||
fs.writeFileSync(path.join(dir, filename), output);
|
||||
return filename;
|
||||
};
|
Reference in New Issue
Block a user