Merge pull request #12539 from Snuffleupagus/TestReporter-import
Use standard `import` statements more when running the unit-tests
This commit is contained in:
commit
08b00c13a7
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
|
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
|
||||||
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
|
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
|
||||||
<script src="../unit/testreporter.js"></script>
|
|
||||||
|
|
||||||
<script defer src="../../node_modules/es-module-shims/dist/es-module-shims.js"></script>
|
<script defer src="../../node_modules/es-module-shims/dist/es-module-shims.js"></script>
|
||||||
<script type="importmap-shim">
|
<script type="importmap-shim">
|
||||||
|
@ -34,12 +34,14 @@
|
|||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
/* globals jasmineRequire, TestReporter */
|
/* globals jasmineRequire */
|
||||||
|
|
||||||
// Modified jasmine's boot.js file to load PDF.js libraries async.
|
// Modified jasmine's boot.js file to load PDF.js libraries async.
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import { TestReporter } from "../unit/testreporter.js";
|
||||||
|
|
||||||
async function initializePDFJS(callback) {
|
async function initializePDFJS(callback) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
[
|
[
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
"rules": {
|
"rules": {
|
||||||
|
// Plugins
|
||||||
|
"import/no-unresolved": ["error", { "ignore": ["pdfjs/"] }],
|
||||||
|
|
||||||
// ECMAScript 6
|
// ECMAScript 6
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
},
|
},
|
||||||
|
@ -34,20 +34,22 @@
|
|||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
/* globals jasmineRequire, TestReporter */
|
/* globals jasmineRequire */
|
||||||
|
|
||||||
// Modified jasmine's boot.js file to load PDF.js libraries async.
|
// Modified jasmine's boot.js file to load PDF.js libraries async.
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import { GlobalWorkerOptions } from "pdfjs/display/worker_options.js";
|
||||||
|
import { isNodeJS } from "pdfjs/shared/is_node.js";
|
||||||
|
import { PDFFetchStream } from "pdfjs/display/fetch_stream.js";
|
||||||
|
import { PDFNetworkStream } from "pdfjs/display/network.js";
|
||||||
|
import { setPDFNetworkStreamFactory } from "pdfjs/display/api.js";
|
||||||
|
import { TestReporter } from "./testreporter.js";
|
||||||
|
|
||||||
async function initializePDFJS(callback) {
|
async function initializePDFJS(callback) {
|
||||||
const modules = await Promise.all(
|
await Promise.all(
|
||||||
[
|
[
|
||||||
"pdfjs/display/api.js",
|
|
||||||
"pdfjs/display/worker_options.js",
|
|
||||||
"pdfjs/display/network.js",
|
|
||||||
"pdfjs/display/fetch_stream.js",
|
|
||||||
"pdfjs/shared/is_node.js",
|
|
||||||
"pdfjs-test/unit/annotation_spec.js",
|
"pdfjs-test/unit/annotation_spec.js",
|
||||||
"pdfjs-test/unit/annotation_storage_spec.js",
|
"pdfjs-test/unit/annotation_storage_spec.js",
|
||||||
"pdfjs-test/unit/api_spec.js",
|
"pdfjs-test/unit/api_spec.js",
|
||||||
@ -87,13 +89,6 @@ async function initializePDFJS(callback) {
|
|||||||
return import(moduleName);
|
return import(moduleName);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
const [
|
|
||||||
{ setPDFNetworkStreamFactory },
|
|
||||||
{ GlobalWorkerOptions },
|
|
||||||
{ PDFNetworkStream },
|
|
||||||
{ PDFFetchStream },
|
|
||||||
{ isNodeJS },
|
|
||||||
] = modules;
|
|
||||||
|
|
||||||
if (isNodeJS) {
|
if (isNodeJS) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const TestReporter = function (browser) {
|
const TestReporter = function (browser) {
|
||||||
function send(action, json, cb) {
|
function send(action, json, cb) {
|
||||||
const r = new XMLHttpRequest();
|
const r = new XMLHttpRequest();
|
||||||
@ -91,3 +88,5 @@ const TestReporter = function (browser) {
|
|||||||
setTimeout(sendQuitRequest, 500);
|
setTimeout(sendQuitRequest, 500);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export { TestReporter };
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
|
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
|
||||||
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
|
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
|
||||||
<script src="testreporter.js"></script>
|
|
||||||
|
|
||||||
<script defer src="../../node_modules/es-module-shims/dist/es-module-shims.js"></script>
|
<script defer src="../../node_modules/es-module-shims/dist/es-module-shims.js"></script>
|
||||||
<script type="importmap-shim">
|
<script type="importmap-shim">
|
||||||
|
@ -319,7 +319,7 @@ describe("util", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("escapeString", function () {
|
describe("escapeString", function () {
|
||||||
it("should escape (, ), \n, \r and \\", function () {
|
it("should escape (, ), \\n, \\r, and \\", function () {
|
||||||
expect(escapeString("((a\\a))\n(b(b\\b)\rb)")).toEqual(
|
expect(escapeString("((a\\a))\n(b(b\\b)\rb)")).toEqual(
|
||||||
"\\(\\(a\\\\a\\)\\)\\n\\(b\\(b\\\\b\\)\\rb\\)"
|
"\\(\\(a\\\\a\\)\\)\\n\\(b\\(b\\\\b\\)\\rb\\)"
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user