Index: test/browser/language_tests.js |
diff --git a/test/browser/language_tests.js b/test/browser/language_tests.js |
index 64af69b041fc22b4d92a67b7a8e4128eb8f41323..2d98eb462ac7f0325bc0a1ff71b3f512c11cffd9 100644 |
--- a/test/browser/language_tests.js |
+++ b/test/browser/language_tests.js |
@@ -2,13 +2,13 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-(function() { |
+define(['dart_sdk', 'async_helper', 'unittest', 'require'], |
+ function(dart_sdk, async_helper, unittest, require) { |
'use strict'; |
- let dart_sdk = dart_library.import('dart_sdk'); |
+ async_helper = async_helper.async_helper; |
+ |
dart_sdk._isolate_helper.startRootIsolate(function() {}, []); |
- let async_helper = dart_library.import('async_helper').async_helper; |
- let unittest = dart_library.import('unittest'); |
let html_config = unittest.html_config; |
// Test attributes are a list of strings, or a string for a single |
// attribute. Valid attributes are: |
@@ -2526,9 +2526,6 @@ |
// TODO(jmesserly): this is in an inconsistent state between our old and |
// newer SDKs. |
- 'html_escape_test': skip_fail, |
- |
- // TODO(jmesserly): seems to fail or pass based on SDK version? |
'html_escape_test': ['skip'], |
// TODO(rnystrom): If this test is enabled, karma gets confused and |
@@ -2743,12 +2740,13 @@ |
let unittest_tests = []; |
- let languageTestPattern = new RegExp('(.*)/([^/]*_test[^/]*)'); |
+ let languageTestPattern = |
+ new RegExp('gen/codegen_output/(.*)/([^/]*_test[^/]*)'); |
html_config.useHtmlConfiguration(); |
// We need to let Dart unittest control when tests are run not mocha. |
// mocha.allowUncaught(true); |
let dartUnittestsLeft = 0; |
- for (let testFile of dart_library.libraries()) { |
+ for (let testFile of allTestFiles) { |
let match = languageTestPattern.exec(testFile); |
if (match != null) { |
let status_group = match[1] |
@@ -2761,9 +2759,7 @@ |
let expectation = status[name]; |
if (expectation == null) expectation = []; |
if (typeof expectation == 'string') expectation = [expectation]; |
- function has(tag) { |
- return expectation.indexOf(tag) >= 0; |
- } |
+ let has = (tag) => expectation.indexOf(tag) >= 0; |
if (has('helper')) { |
// These are not top-level tests. They are used by other tests. |
@@ -2783,25 +2779,25 @@ |
if (has('unittest')) { |
unittest_tests.push(() => { |
console.log('Running unittest test ' + testFile); |
- dart_library.import(module)[name].main(); |
+ require(module)[name].main(); |
}); |
continue; |
} |
- function protect(f) { // Returns the exception, or `null`. |
+ let protect = (f) => { // Returns the exception, or `null`. |
try { |
f(); |
return null; |
} catch (e) { |
return e; |
} |
- } |
+ }; |
test(name, function(done) { // 'function' to allow `this.timeout`. |
async_helper.asyncTestInitialize(done); |
console.debug('Running test: ' + name); |
- let mainLibrary = dart_library.import(module)[name]; |
+ let mainLibrary = require(module)[name]; |
let negative = /negative_test/.test(name); |
if (has('slow')) this.timeout(10000); |
if (has('notyetstrong')) { |
@@ -2848,6 +2844,8 @@ |
// In practice we are really just suppressing all mocha test behavior while |
// Dart unittests run and then re-enabling it when the dart tests complete. |
test('run all dart unittests', function(done) { // 'function' to allow `this.timeout` |
+ if (unittest_tests.length == 0) return done(); |
+ |
this.timeout(100000000); |
this.enableTimeouts(false); |
// Suppress mocha on-error handling because it will mess up unittests. |
@@ -2888,4 +2886,4 @@ |
} |
} |
}); |
-})(); |
+}); |