Fix test running around loading assertCleanState

This commit is contained in:
Alexandru Dima 2021-10-19 11:09:47 +02:00
parent 699bb8768e
commit 7dfe2e33ea
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9

View file

@ -109,6 +109,12 @@ function createCoverageReport(opts) {
return Promise.resolve(undefined);
}
function loadWorkbenchTestingModule() {
return new Promise((resolve, reject) => {
loader.require(['vs/workbench/test/electron-browser/testing'], resolve, reject);
})
}
function loadTestModules(opts) {
if (opts.run) {
@ -166,34 +172,34 @@ function loadTests(opts) {
});
});
let assertCleanState;
loader.require(['vs/workbench/test/electron-browser/testing'], function(testing) {
assertCleanState = testing.assertCleanState;
return loadWorkbenchTestingModule().then((workbenchTestingModule) => {
const assertCleanState = workbenchTestingModule.assertCleanState;
suite('Tests are using suiteSetup and setup correctly', () => {
test('assertCleanState - check that registries are clean at the start of test running', () => {
assertCleanState();
});
});
});
return loadTestModules(opts).then(() => {
suite('Unexpected Errors & Loader Errors', function () {
test('should not have unexpected errors', function () {
const errors = _unexpectedErrors.concat(_loaderErrors);
if (errors.length) {
errors.forEach(function (stack) {
console.error('');
console.error(stack);
});
assert.ok(false, errors);
}
});
return loadTestModules(opts).then(() => {
suite('Unexpected Errors & Loader Errors', function () {
test('should not have unexpected errors', function () {
const errors = _unexpectedErrors.concat(_loaderErrors);
if (errors.length) {
errors.forEach(function (stack) {
console.error('');
console.error(stack);
});
assert.ok(false, errors);
}
});
test('assertCleanState - check that registries are clean and objects are disposed at the end of test running', () => {
assertCleanState();
test('assertCleanState - check that registries are clean and objects are disposed at the end of test running', () => {
assertCleanState();
});
});
});
});
})
}
function serializeSuite(suite) {