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

Fuzz test location-related parser options #14201

Merged
merged 34 commits into from Jan 29, 2022
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0d14005
Autogenerate tests to make sure startLine and startColumn work everyw…
tolmasky Jan 16, 2022
aee9486
Only deserialize JSON files that are serialized.
tolmasky Jan 20, 2022
4737700
Don't fuzz test in node 8, since for whatever reason Jest 23 on node …
tolmasky Jan 21, 2022
4bf3933
Rename runFixtureTests.js to run-fixture-tests.js.
tolmasky Jan 21, 2022
60b039e
Fix for showing code snippet again.
tolmasky Jan 23, 2022
17c1093
Fix some linter errors.
tolmasky Jan 23, 2022
c140ba8
Fix stack traces and only generate the context error when we need it.
tolmasky Jan 23, 2022
e10465a
Create errors in deserialization step instead of using adjust to conv…
tolmasky Jan 23, 2022
e9fc211
Fix only storing cause if it's an error.
tolmasky Jan 23, 2022
00fb3f6
Fix UnexpectedSuccess error.
tolmasky Jan 23, 2022
63a3e0c
Better DifferentError and cleaned up the cause stuff a bit.
tolmasky Jan 23, 2022
e5933b3
Fix linter errors.
tolmasky Jan 24, 2022
3a555d4
First pass at serialization.
tolmasky Jan 25, 2022
5648fc0
Better errors and serialization.
tolmasky Jan 25, 2022
dc186b1
Fix saving output.
tolmasky Jan 25, 2022
c31d5ba
Fix saving options.
tolmasky Jan 25, 2022
a275b7f
Fix linter errors and incorrect removal.
tolmasky Jan 25, 2022
c6b28ec
Add FUZZ environment variable.
tolmasky Jan 25, 2022
a040ebd
Fix location undefined problem when saving.
tolmasky Jan 25, 2022
0455aeb
Read the actual options file in since we don't have a true copy of th…
tolmasky Jan 25, 2022
c703418
Fix also compacting start and end outside of loc.
tolmasky Jan 25, 2022
a64178a
Fix linter error.
tolmasky Jan 25, 2022
ffb642e
Address a few style issues.
tolmasky Jan 26, 2022
1a24870
Use environment variable for TEST_FUZZ, and disable fuzz testing for …
tolmasky Jan 26, 2022
5e76011
Address more change requests.
tolmasky Jan 26, 2022
87424e1
Fix lint error.
tolmasky Jan 26, 2022
f6aeb06
Move logic into FixtureError base class and add comments.
tolmasky Jan 26, 2022
caa9a8c
Throw early if we are in CI, and make sure runFixtureText has its JSD…
tolmasky Jan 26, 2022
9b87eea
Fix JSDocs.
tolmasky Jan 27, 2022
b1118e4
Change fuzz testing to be opt-in while we only do line changes.
tolmasky Jan 27, 2022
dec5379
Don't check if file exists before deleting it, and only overwite opti…
tolmasky Jan 27, 2022
198ad6b
Put a newline at the end of JSON files.
tolmasky Jan 28, 2022
91f73c7
Only refrain from throwing if the error is ENOENT. Also, clean up the…
tolmasky Jan 28, 2022
4ec5658
Fix linter error.
tolmasky Jan 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions packages/babel-parser/test/helpers/run-fixture-tests.js
Expand Up @@ -7,9 +7,23 @@ import toFuzzedOptions from "./to-fuzzed-options.js";
import { serialize, deserialize } from "./serialization.js";
import toContextualSyntaxError from "./to-contextual-syntax-error.js";

const { OVERWRITE } = process.env;
const { CI, OVERWRITE } = process.env;
const { stringify, parse: JSONParse } = JSON;

/**
* run parser on given tests
*
* @param {Test} A {@link packages/babel-helper-fixtures/src/index.js Test}
JLHwung marked this conversation as resolved.
Show resolved Hide resolved
* instance
generated from `getFixtures`
* @param {*} parseFunction A parser with the same interface of
* `@babel/parser#parse`
* @param {boolean} [compareErrorsOnly=false] Whether we should only compare the
* "errors" of generated ast against the expected AST. Used for tests where an
* ESTree AST is generated but we want to make sure `@babel/parser` still throws
* expected recoverable recoverable errors on given code locations.
* @returns {void}
*/
export default function runFixtureTests(
fixturesPath,
parseFunction,
Expand Down Expand Up @@ -89,7 +103,7 @@ function runParseTest(parse, test, onlyCompareErrors) {

// If we're not overwriting the current values with whatever we get this time
// around, then we have a legitimate error that we need to report.
if (!OVERWRITE) throw error;
if (CI || !OVERWRITE) throw error;

// We only write the output of the original test, not all it's auto-generated
// variations.
Expand Down