Files
test-repo/tests/config/format-test/failed-format-tests.js
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 lines
3.0 KiB
JavaScript
Raw Normal View History

2026-01-25 10:30:19 +08:00
import path from "node:path";
2026-01-25 20:48:49 +08:00
import { FORMAT_TEST_DIRECTORY } from "./constants.js";
2026-01-25 10:30:19 +08:00
// TODO: these test files need fix
const unstableTests = new Map(
[
[
"js/ignore/semi/class-expression-decorator.js",
(options) => options.semi === false,
],
["js/ignore/semi/head-ignored.js", (options) => options.semi === false],
2026-01-25 10:30:19 +08:00
"js/comments/return-statement.js",
[
"js/multiparser-markdown/codeblock.js",
(options) => options.proseWrap === "always",
],
"flow/hook/declare-hook.js",
"flow/hook/hook-type-annotation.js",
2026-06-22 17:44:23 -07:00
"flow/comments/type_annotations.js",
2026-01-25 10:30:19 +08:00
"typescript/prettier-ignore/mapped-types.ts",
"typescript/prettier-ignore/issue-14238.ts",
2026-01-31 01:26:45 +08:00
"js/for-of/comments.js",
2026-01-25 10:30:19 +08:00
"js/sequence-expression/parenthesized.js",
"typescript/satisfies-operators/comments-unstable.ts",
"jsx/comments/in-attributes.js",
"typescript/import-type/long-module-name/long-module-name4.ts",
[
"typescript/method-chain/object/issue-17239.ts",
(options) => options.objectWrap !== "collapse",
],
"typescript/call/callee-comments.ts",
"js/arrows/arrow-chain-with-trailing-comments.js",
"typescript/as/comments/18160.ts",
"js/sequence-expression/parenthesized-trailing-comment-unstable.js",
"typescript/union/consistent-with-flow/single-type.ts",
2026-01-25 10:30:19 +08:00
].map((fixture) => {
const [file, isUnstable = () => true] = Array.isArray(fixture)
? fixture
: [fixture];
2026-01-25 20:48:49 +08:00
return [path.join(FORMAT_TEST_DIRECTORY, file), isUnstable];
2026-01-25 10:30:19 +08:00
}),
);
const unstableAstTests = new Map();
// These tests works on `babel`, `acorn`, `espree`, `oxc`, and `meriyah`
const commentClosureTypecaseTests = [
"js/comments-closure-typecast/",
"js/comments-closure-typecast/no-semi/",
];
2026-01-25 10:30:19 +08:00
const disabledTests = new Map(
Object.entries({
2026-07-29 22:39:32 +08:00
espree: commentClosureTypecaseTests,
acorn: [],
meriyah: [],
2026-07-29 22:39:32 +08:00
"babel-ts": [],
2026-01-25 10:30:19 +08:00
oxc: [],
2026-07-15 23:14:34 +08:00
"oxc-ts": [],
yuku: ["js/await/await-with-parens.js"],
"yuku-ts": ["js/await/await-with-parens.js"],
2026-01-25 10:30:19 +08:00
hermes: [
// Different result
2026-07-15 23:14:34 +08:00
"js/await/like-call.js",
2026-01-25 10:30:19 +08:00
],
flow: [
2026-07-15 23:14:34 +08:00
"js/decorators/member-expression.js", // Parsing to different ASTs
"js/await/await-with-parens.js",
"js/await/like-call.js",
2026-01-25 10:30:19 +08:00
],
typescript: [
// https://github.com/typescript-eslint/typescript-eslint/issues/11389
"js/import/long-module-name/import-defer.js",
"js/import/long-module-name/import-source.js",
],
2026-06-01 10:18:29 +08:00
yaml: [
// Bug: https://github.com/eemeli/yaml/issues/646
"yaml/spec/spec-example-2-11-mapping-between-sequences.yml",
],
2026-01-25 10:30:19 +08:00
}).map(([parser, tests]) => [
parser,
2026-01-25 20:48:49 +08:00
new Set(tests.map((file) => path.join(FORMAT_TEST_DIRECTORY, file))),
2026-01-25 10:30:19 +08:00
]),
);
2026-01-25 20:48:49 +08:00
const isUnstable = (filepath, options) =>
unstableTests.get(filepath)?.(options);
2026-01-25 10:30:19 +08:00
2026-01-25 20:48:49 +08:00
const isAstUnstable = (filepath, options) =>
unstableAstTests.get(filepath)?.(options);
2026-01-25 10:30:19 +08:00
2026-01-25 20:48:49 +08:00
const shouldDisable = (directoryOrFile, parser) =>
disabledTests.get(parser)?.has(directoryOrFile);
2026-01-25 10:30:19 +08:00
export { isAstUnstable, isUnstable, shouldDisable };