Skip to content
Merged
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
9 changes: 9 additions & 0 deletions fuzz/__snapshots__/regression.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`dom-parser.html.target.js crash-doctype-in-element.xml 1`] = `-1`;

exports[`dom-parser.html.target.js crash-proto-prefix.xml 1`] = `-1`;

exports[`dom-parser.xml.target.js crash-doctype-in-element.xml 1`] = `-1`;

exports[`dom-parser.xml.target.js crash-proto-prefix.xml 1`] = `-1`;
14 changes: 9 additions & 5 deletions fuzz/regression.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ const TARGETS = fs
.map((target) => [target, path.join(__dirname, target)]);

TARGETS.forEach(([target, targetPath]) => {
describe('', () => {
describe(target, () => {
const regressionDir = path.join(__filename.replace(/\.js$/, ''), target);
const testfiles = fs.readdirSync(regressionDir);
const module = require(targetPath);
beforeAll(() => {
const regressionDir = path.join(__filename.replace(/\.js$/, ''), target);
expect(fs.existsSync(regressionDir)).toBe(true);
const testfiles = fs.readdirSync(regressionDir);
expect(testfiles.length).toBeGreaterThan(0);
});
const module = require(targetPath);
test.fuzz(target, (data) => module.fuzz(data));
testfiles.forEach((testfile) => {
test(path.basename(testfile), () => {
expect(module.fuzz(fs.readFileSync(path.join(regressionDir, testfile)))).toMatchSnapshot();
});
});
});
});
2 changes: 1 addition & 1 deletion jest.fuzz.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ module.exports = {
// testResultsProcessor: undefined,

// This option allows use of a custom test runner
testRunner: '@jazzer.js/jest-runner',
// testRunner: '@jazzer.js/jest-runner',

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
Expand Down
Loading
Loading