Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing: Fix failure to run non-web translators' tests in debug build. #429

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
5 changes: 1 addition & 4 deletions src/common/cachedTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ Zotero.Connector_Types = new function() {
}
};

/**
* Passes schema to a callback
*/
this.getSchema = async function() {
return TypeSchema;
};
}
}
5 changes: 2 additions & 3 deletions src/common/tools/testTranslators/testTranslators.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="/browser-polyfill.js"></script>
<script type="text/javascript" src="/node_modules.js"></script>
<script type="text/javascript" src="/zotero_config.js"></script>
<script type="text/javascript" src="/zotero.js"></script>
<script type="text/javascript" src="/translate/promise.js"></script>
<script type="text/javascript" src="/translate/resource/zoteroTypeSchemaData.js"></script>
<script type="text/javascript" src="/utilities/resource/zoteroTypeSchemaData.js"></script>
<script type="text/javascript" src="/utilities/schema.js"></script>
<script type="text/javascript" src="/cachedTypes.js"></script>
<script type="text/javascript" src="/schema.js"></script>
Expand Down Expand Up @@ -65,4 +64,4 @@
</head>
<body>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions src/common/tools/testTranslators/translatorTester_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Zotero_TranslatorTester.prototype.runTests = function(callback) {
} else {
// other translators get passed right through, after we get schema and preferences
var me = this;
Zotero.Connector_Types.getSchema(function(schema) {
Zotero.Connector_Types.getSchema().then(function(schema) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the "minimally invasive" change that I can think of. It did make the tests work again, however, I can definitely use some illumination about Zotero.Connector_Types and what it actually does.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I even tried hooking the access to the "schema" property on the Zotero.Connector_Types object so as to catch any code that tries to get the value of "schema", but I didn't find anything while running the tests. A search into the code seems to confirm that nothing else makes use of Zotero.Connector_Types.schema. So I don't know why this "schema" property is created and passed to the context of the test runs. What am I missing? Could @dstillman @AbeJellinek help? Thanks!

Zotero.Connector_Types.schema = schema;
Zotero.Connector_Types.init();
me._runTests(callback);
Expand All @@ -57,4 +57,4 @@ Zotero.Messaging.addMessageListener("translatorTester_testDone", function(data)
// call Zotero_TranslatorTester#_debug
Zotero.Messaging.addMessageListener("translatorTester_debug", function(data) {
_instanceData[data[0]].debug.apply(null, data[1]);
});
});