mirror of
https://github.com/mozilla/readability.git
synced 2026-04-07 19:17:37 +00:00
70c101c25f
* Fix up eslint to use flat config and pass. * Switch to mozilla-recommended plugin, autofix a bunch of issues. * Run prettier * Manual lint fixes/refactoring.
25 lines
561 B
JavaScript
25 lines
561 B
JavaScript
/* eslint-env node */
|
|
|
|
var Readability = require("../Readability");
|
|
var { JSDOM } = require("jsdom");
|
|
var fs = require("fs");
|
|
var path = require("path");
|
|
|
|
var testcaseRoot = path.join(__dirname, "test-pages");
|
|
|
|
if (process.argv.length < 3) {
|
|
console.log("No testcase provided.");
|
|
process.exit(1);
|
|
}
|
|
|
|
var src = fs
|
|
.readFileSync(`${testcaseRoot}/${process.argv[2]}/source.html`, {
|
|
encoding: "utf-8",
|
|
})
|
|
.trim();
|
|
|
|
var doc = new JSDOM(src, { url: "http://fakehost/test/page.html" }).window
|
|
.document;
|
|
|
|
new Readability(doc, { debug: true }).parse();
|