From ed5bb0bf627770857c514ad1a6b02879c70dac2a Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sun, 25 Jan 2026 10:30:19 +0800 Subject: [PATCH] Refactor tests (#18743) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- CONTRIBUTING.md | 30 +- jest.config.js | 2 +- tests/config/failed-format-tests.js | 122 +++++ tests/config/run-format-test.js | 433 ++++++------------ .../__snapshots__/format.test.js.snap | 2 +- .../_errors_}/format.test.js | 0 .../_errors_}/unkown-block.html | 0 .../__snapshots__/format.test.js.snap | 4 +- .../css => css/_errors_}/format.test.js | 0 .../css => css/_errors_}/less-syntax.css | 0 .../css => css/_errors_}/scss-syntax.css | 0 .../__snapshots__/format.test.js.snap | 14 +- .../ambient/__snapshots__/format.test.js.snap | 4 +- .../flow => flow/_errors_}/ambient/ambient.js | 0 .../_errors_}/ambient/ambient.unknown | 0 .../_errors_}/ambient/format.test.js | 0 .../_errors_}/async-arrow-invalid.js | 0 .../__snapshots__/format.test.js.snap | 0 .../babel-flow}/async-arrow-invalid.js | 0 .../_errors_}/babel-flow/format.test.js | 0 .../babel-flow/wrong-arrow-no-parens-jsx.js | 0 .../flow => flow/_errors_}/format.test.js | 0 .../flow => flow/_errors_}/function-async.js | 0 .../__snapshots__/format.test.js.snap | 4 +- .../import-reflection/format.test.js | 0 .../valid-flow-default-import.js | 0 .../valid-ts-default-import.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/interface/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/invalid-match/format.test.js | 0 .../_errors_}/invalid_keyword_symbol.js | 0 .../_errors_}/module-attributes-static.js | 0 .../_errors_}/newline-before-arrow.js | 0 .../errors/flow => flow/_errors_}/number.js | 0 .../record/__snapshots__/format.test.js.snap | 0 .../_errors_}/record/format.test.js | 0 .../_errors_}/spread-with-optional.js | 0 .../__snapshots__/format.test.js.snap | 0 .../flow-babel-only/class_with_generics.js | 0 .../flow-babel-only/format.test.js | 0 .../flow-babel-only/functions.js | 0 .../ternary/__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 4 +- ...descriptions-on-a-short-hand-query.graphql | 0 .../_errors_}/format.test.js | 0 .../_errors_}/type-interfaces.graphql | 0 .../__snapshots__/format.test.js.snap | 66 +-- .../_errors_}/format.test.js | 0 .../_errors_}/invalid-2.hbs | 0 .../_errors_}/invalid-3.hbs | 0 .../_errors_}/invalid.hbs | 0 .../_errors_}/tilde-comments-1.hbs | 0 .../_errors_}/tilde-comments-2.hbs | 0 .../__snapshots__/format.test.js.snap | 44 +- .../__snapshots__/format.test.js.snap | 0 .../_errors_}/assignment/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/async-await/format.test.js | 0 .../__snapshots__/format.test.js.snap | 6 +- .../babel-missing-plugins/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../format.test.js | 0 .../__snapshots__/format.test.js.snap | 10 +- .../_errors_}/decorators/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/discard-binding/format.test.js | 0 .../invalid-array-expression.js | 0 .../invalid-assignment-expression.js | 0 .../discard-binding/invalid-assignment-for.js | 0 .../invalid-assignment-pattern.js | 0 .../invalid-async-call-argument.js | 0 .../invalid-catch-parameter.js | 0 .../invalid-lone-arrow-function-parameter.js | 0 ...lid-lone-async-arrow-function-parameter.js | 0 .../invalid-object-expression.js | 0 .../invalid-parenthesized-assignment.js | 0 .../invalid-parenthesized-binding.js | 0 ...alid-rest-element-array-pattern-for-lhs.js | 0 .../invalid-rest-element-array-pattern-lhs.js | 0 .../invalid-rest-element-array-pattern.js | 0 ...lid-rest-element-object-pattern-for-lhs.js | 0 ...invalid-rest-element-object-pattern-lhs.js | 0 .../invalid-rest-element-object-pattern.js | 0 .../invalid-sequence-expression.js | 0 .../invalid-variable-declarator.js | 0 .../__snapshots__/format.test.js.snap | 0 .../format.test.js | 0 .../invalid-for-await-using-binding-of-of.js | 0 .../invalid-for-using-binding-in.js | 0 .../invalid-for-using-binding-of-in.js | 0 .../invalid-for-using-binding-of-of.js | 0 .../invalid-using-binding-let.js | 0 .../invalid-using-binding-pattern.js | 0 .../__snapshots__/format.test.js.snap | 8 +- .../export-default-from/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/export-name/format.test.js | 0 .../for-of/__snapshots__/format.test.js.snap | 0 .../js => js/_errors_}/for-of/format.test.js | 0 .../errors/js => js/_errors_}/format.test.js | 0 .../__snapshots__/format.test.js.snap | 22 +- .../_errors_}/hack-pipeline/format.test.js | 0 .../_errors_}/hack-pipeline/v8intrinsic.js | 0 .../js => js/_errors_}/html-like-comments.js | 0 ...port-attributes-for-export-without-from.js | 0 .../import-attributes-with-parens.js | 0 .../import/__snapshots__/format.test.js.snap | 0 .../js => js/_errors_}/import/format.test.js | 0 .../invalid-escape-in-identifier-2.js | 0 .../_errors_}/invalid-escape-in-identifier.js | 0 .../invalid/__snapshots__/format.test.js.snap | 0 .../_errors_}/invalid/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../known-source-type/format.test.js | 0 .../literal/__snapshots__/format.test.js.snap | 0 .../js => js/_errors_}/literal/format.test.js | 0 .../_errors_}/literal/invalid-exponent.js | 0 .../js => js/_errors_}/module-attributes.js | 0 .../__snapshots__/format.test.js.snap | 0 .../newline-before-arrow/format.test.js | 0 .../newline-before-arrow.js | 0 .../no-for-in-init-concise-binary-in.js | 0 .../object/__snapshots__/format.test.js.snap | 0 .../js => js/_errors_}/object/format.test.js | 0 .../_errors_}/object/getter-generator.js | 0 .../_errors_}/object/getter-with-parameter.js | 0 .../_errors_}/object/setter-generator.js | 0 .../object/setter-without-parameter.js | 0 .../__snapshots__/format.test.js.snap | 0 .../optional-chaining/format.test.js | 0 .../_errors_}/partial-template-strings.js | 0 .../record/__snapshots__/format.test.js.snap | 0 .../js => js/_errors_}/record/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/regex-v-u-flags/format.test.js | 0 .../regex-v-u-flags/invalid-flags.js | 0 .../regex-v-u-flags/invalid-flags2.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/reserved-word/format.test.js | 0 ...mport-source-should-not-has-extra-token.js | 0 .../__snapshots__/format.test.js.snap | 0 .../variable-declarator/format.test.js | 0 .../variable-declarator/invalid-const.js | 0 .../__snapshots__/format.test.js.snap | 108 ++--- .../__snapshots__/format.test.js.snap | 358 +++++++-------- .../json => json/_errors_}/format.test.js | 0 .../__snapshots__/format.test.js.snap | 6 +- .../_errors_}/json-stringify/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/invalid-jsx-text/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../format.test.js | 0 .../__snapshots__/format.test.js.snap | 8 +- .../less => less/_errors_}/format.test.js | 0 .../_errors_}/inline-comment.less | 0 .../_errors_}/open-double-quote.less | 0 .../_errors_}/open-sigle-quote.less | 0 .../less => less/_errors_}/scss-syntax.scss | 0 .../__snapshots__/format.test.js.snap | 3 + .../broken-plugin/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../front-matter/format.test.js | 0 .../in-html/__snapshots__/format.test.js.snap | 0 .../in-html/format.test.js | 0 .../in-html/front-matter-toml.html | 0 .../in-html/front-matter-yaml.html | 0 .../in-html/test.html | 0 .../__snapshots__/format.test.js.snap | 0 .../in-javascript/format.test.js | 0 .../in-javascript/test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../in-markdown/format.test.js | 0 .../in-markdown/front-matter-json.md | 0 .../in-markdown/front-matter-pandoc.md | 0 .../in-markdown/issue-16342.md | 0 .../in-markdown/test.md | 0 .../in-vue/__snapshots__/format.test.js.snap | 0 .../in-vue/format.test.js | 0 .../in-vue/in.vue | 0 .../mdx/__snapshots__/format.test.js.snap | 0 .../mdx/format.test.js | 0 .../mdx/import-export.mdx | 0 .../mdx/jsx.mdx | 0 .../__snapshots__/format.test.js.snap | 3 - .../misc/parser-inference/format.test.js | 108 ++--- .../__snapshots__/format.test.js.snap | 2 +- .../scss => scss/_errors_}/format.test.js | 0 .../scss => scss/_errors_}/less-syntax.less | 0 .../__snapshots__/format.test.js.snap | 0 .../__snapshots__/format.test.js.snap | 0 .../format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../format.test.js | 0 .../__snapshots__/format.test.js.snap | 12 +- .../_errors_}/babel-ts/abstract.ts | 0 .../classAbstractMethodWithImplementation.ts | 0 .../_errors_}/babel-ts/declare-accessor.ts | 0 .../_errors_}/babel-ts/format.test.js | 0 .../__snapshots__/format.test.js.snap | 18 +- .../_errors_/babel-ts2}/export-declare.ts | 0 .../_errors_/babel-ts2}/format.test.js | 0 .../multiline-declaration-abstract-class.ts | 0 .../multiline-declaration-interface.ts | 0 .../multiline-declaration-module.ts | 0 .../babel-ts2}/multiline-declaration-type.ts | 0 ...arenthesized-decorators-tagged-template.ts | 0 .../type-annotation-expr-statement.ts | 0 .../babel-ts2}/type-annotation-func.ts | 0 .../babel-ts2}/type-annotation-in-jsx.tsx | 0 .../__snapshots__/format.test.js.snap | 0 .../catch-clause-with-initializer.ts | 0 .../format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../declare-function-with-body/format.test.js | 0 .../_errors_}/declare-getter.ts | 0 .../_errors_}/declare-setter.ts | 0 .../__snapshots__/format.test.js.snap | 0 .../format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../format.test.js | 0 .../enum/__snapshots__/format.test.js.snap | 0 .../_errors_}/enum/format.test.js | 0 .../_errors_}/export-declare.ts | 0 .../_errors_}/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../import-reflection/format.test.js | 0 .../valid-flow-default-import.mts | 0 .../valid-ts-default-import.mts | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/interface/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../invalid-class-implements/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../invalid-import-equals/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../invalid-interface-extends/format.test.js | 0 .../__snapshots__/format.test.js.snap | 2 +- .../format.test.js | 0 .../_errors_}/invalid-jsx-1.tsx | 0 .../__snapshots__/format.test.js.snap | 0 .../decorator.ts | 0 .../invalid-typescript-decorators/enums.ts | 0 .../format.test.js | 0 .../invalid-typescript-decorators/function.ts | 0 .../interface.ts | 0 .../issue-9102.ts | 0 .../loop/__snapshots__/format.test.js.snap | 0 .../_errors_}/loop/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/mapped-type/format.test.js | 0 .../_errors_}/mapped-type/mapped-type.ts | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/modifiers/format.test.js | 0 .../_errors_}/module-attributes-static.ts | 0 .../__snapshots__/format.test.js.snap | 0 .../module-declaration/format.test.js | 0 .../_errors_}/newline-before-arrow.ts | 0 .../tuple/__snapshots__/format.test.js.snap | 14 +- .../_errors_}/tuple/format.test.js | 0 .../__snapshots__/format.test.js.snap | 0 .../_errors_}/type-only-import/format.test.js | 0 .../_errors_}/value-of-abstract-property.ts | 0 .../__snapshots__/format.test.js.snap | 56 +-- .../__snapshots__/format.test.js.snap | 0 .../decorator-auto-accessors-new-line.ts | 0 .../typescript-babel-only/format.test.js | 0 ...arenthesized-decorators-call-expression.ts | 0 ...arenthesized-decorators-tagged-template.ts | 0 .../__snapshots__/format.test.js.snap | 0 .../typescript-only/await-with-parens.ts | 0 ...decorator-auto-accessors-abstract-class.ts | 0 .../decorator-auto-accessors-declara-class.ts | 0 ...ecorator-auto-accessors-mixed-modifiers.ts | 0 .../typescript-only/format.test.js | 0 ...arenthesized-decorators-call-expression.ts | 0 ...arenthesized-decorators-tagged-template.ts | 0 .../prettier-ignore-parenthesized-type.ts | 0 .../__snapshots__/format.test.js.snap | 6 +- .../vue => vue/_errors_}/format.test.js | 0 .../vue => vue/_errors_}/unclosed_tag.vue | 0 .../_errors_}/unclosed_tag_in_template.vue | 0 .../vue => vue/_errors_}/upper-case.html | 0 .../__snapshots__/format.test.js.snap | 2 +- .../block-scalar-with-spaces-only.yml | 0 .../yaml => yaml/_errors_}/format.test.js | 0 288 files changed, 730 insertions(+), 753 deletions(-) create mode 100644 tests/config/failed-format-tests.js rename tests/format/{misc/errors/angular => angular/_errors_}/__snapshots__/format.test.js.snap (86%) rename tests/format/{misc/errors/angular => angular/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/angular => angular/_errors_}/unkown-block.html (100%) rename tests/format/{misc/errors/css => css/_errors_}/__snapshots__/format.test.js.snap (78%) rename tests/format/{misc/errors/css => css/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/css => css/_errors_}/less-syntax.css (100%) rename tests/format/{misc/errors/css => css/_errors_}/scss-syntax.css (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/__snapshots__/format.test.js.snap (70%) rename tests/format/{misc/errors/flow => flow/_errors_}/ambient/__snapshots__/format.test.js.snap (73%) rename tests/format/{misc/errors/flow => flow/_errors_}/ambient/ambient.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/ambient/ambient.unknown (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/ambient/format.test.js (100%) rename tests/format/{misc/errors/babel-flow => flow/_errors_}/async-arrow-invalid.js (100%) rename tests/format/{misc/errors => flow/_errors_}/babel-flow/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/flow => flow/_errors_/babel-flow}/async-arrow-invalid.js (100%) rename tests/format/{misc/errors => flow/_errors_}/babel-flow/format.test.js (100%) rename tests/format/{misc/errors => flow/_errors_}/babel-flow/wrong-arrow-no-parens-jsx.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/function-async.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/import-reflection/__snapshots__/format.test.js.snap (78%) rename tests/format/{misc/errors/flow => flow/_errors_}/import-reflection/format.test.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/import-reflection/valid-flow-default-import.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/import-reflection/valid-ts-default-import.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/interface/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/interface/format.test.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/invalid-match/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/invalid-match/format.test.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/invalid_keyword_symbol.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/module-attributes-static.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/newline-before-arrow.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/number.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/record/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/record/format.test.js (100%) rename tests/format/{misc/errors/flow => flow/_errors_}/spread-with-optional.js (100%) rename tests/format/{misc => flow}/flow-babel-only/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc => flow}/flow-babel-only/class_with_generics.js (100%) rename tests/format/{misc => flow}/flow-babel-only/format.test.js (100%) rename tests/format/{misc => flow}/flow-babel-only/functions.js (100%) rename tests/format/{misc/errors/graphql => graphql/_errors_}/__snapshots__/format.test.js.snap (81%) rename tests/format/{misc/errors/graphql => graphql/_errors_}/descriptions-on-a-short-hand-query.graphql (100%) rename tests/format/{misc/errors/graphql => graphql/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/graphql => graphql/_errors_}/type-interfaces.graphql (100%) rename tests/format/{misc/errors/handlebars => handlebars/_errors_}/__snapshots__/format.test.js.snap (83%) rename tests/format/{misc/errors/handlebars => handlebars/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/handlebars => handlebars/_errors_}/invalid-2.hbs (100%) rename tests/format/{misc/errors/handlebars => handlebars/_errors_}/invalid-3.hbs (100%) rename tests/format/{misc/errors/handlebars => handlebars/_errors_}/invalid.hbs (100%) rename tests/format/{misc/errors/handlebars => handlebars/_errors_}/tilde-comments-1.hbs (100%) rename tests/format/{misc/errors/handlebars => handlebars/_errors_}/tilde-comments-2.hbs (100%) rename tests/format/{misc/errors/js => js/_errors_}/__snapshots__/format.test.js.snap (73%) rename tests/format/{misc/errors/js => js/_errors_}/assignment/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/assignment/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/async-await/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/async-await/format.test.js (100%) rename tests/format/{misc/errors => js/_errors_}/babel-missing-plugins/__snapshots__/format.test.js.snap (75%) rename tests/format/{misc/errors => js/_errors_}/babel-missing-plugins/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/class-property-named-constructor/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/class-property-named-constructor/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/decorators/__snapshots__/format.test.js.snap (88%) rename tests/format/{misc/errors/js => js/_errors_}/decorators/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-array-expression.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-assignment-expression.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-assignment-for.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-assignment-pattern.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-async-call-argument.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-catch-parameter.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-lone-arrow-function-parameter.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-lone-async-arrow-function-parameter.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-object-expression.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-parenthesized-assignment.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-parenthesized-binding.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-rest-element-array-pattern-for-lhs.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-rest-element-array-pattern-lhs.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-rest-element-array-pattern.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-rest-element-object-pattern-for-lhs.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-rest-element-object-pattern-lhs.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-rest-element-object-pattern.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-sequence-expression.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/discard-binding/invalid-variable-declarator.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/explicit-resource-management/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/explicit-resource-management/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/explicit-resource-management/invalid-for-await-using-binding-of-of.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/explicit-resource-management/invalid-for-using-binding-in.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/explicit-resource-management/invalid-for-using-binding-of-in.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/explicit-resource-management/invalid-for-using-binding-of-of.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/explicit-resource-management/invalid-using-binding-let.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/explicit-resource-management/invalid-using-binding-pattern.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/export-default-from/__snapshots__/format.test.js.snap (77%) rename tests/format/{misc/errors/js => js/_errors_}/export-default-from/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/export-name/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/export-name/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/for-of/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/for-of/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/hack-pipeline/__snapshots__/format.test.js.snap (88%) rename tests/format/{misc/errors/js => js/_errors_}/hack-pipeline/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/hack-pipeline/v8intrinsic.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/html-like-comments.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/import-attributes-for-export-without-from.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/import-attributes-with-parens.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/import/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/import/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/invalid-escape-in-identifier-2.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/invalid-escape-in-identifier.js (100%) rename tests/format/{misc/errors => js/_errors_}/invalid/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors => js/_errors_}/invalid/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/known-source-type/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/known-source-type/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/literal/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/literal/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/literal/invalid-exponent.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/module-attributes.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/newline-before-arrow/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/newline-before-arrow/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/newline-before-arrow/newline-before-arrow.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/no-for-in-init-concise-binary-in.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/object/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/object/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/object/getter-generator.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/object/getter-with-parameter.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/object/setter-generator.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/object/setter-without-parameter.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/optional-chaining/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/optional-chaining/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/partial-template-strings.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/record/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/record/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/regex-v-u-flags/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/regex-v-u-flags/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/regex-v-u-flags/invalid-flags.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/regex-v-u-flags/invalid-flags2.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/reserved-word/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/reserved-word/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/static-import-source-should-not-has-extra-token.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/variable-declarator/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/js => js/_errors_}/variable-declarator/format.test.js (100%) rename tests/format/{misc/errors/js => js/_errors_}/variable-declarator/invalid-const.js (100%) rename tests/format/{misc/errors/json => json/_errors_}/__snapshots__/format.test.js.snap (96%) rename tests/format/{misc/errors/json => json/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/json => json/_errors_}/json-stringify/__snapshots__/format.test.js.snap (68%) rename tests/format/{misc/errors/json => json/_errors_}/json-stringify/format.test.js (100%) rename tests/format/{misc/errors/jsx => jsx/_errors_}/invalid-jsx-text/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/jsx => jsx/_errors_}/invalid-jsx-text/format.test.js (100%) rename tests/format/{misc/errors/jsx => jsx/_errors_}/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/jsx => jsx/_errors_}/unparenthesized-sequence-expression/format.test.js (100%) rename tests/format/{misc/errors/less => less/_errors_}/__snapshots__/format.test.js.snap (77%) rename tests/format/{misc/errors/less => less/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/less => less/_errors_}/inline-comment.less (100%) rename tests/format/{misc/errors/less => less/_errors_}/open-double-quote.less (100%) rename tests/format/{misc/errors/less => less/_errors_}/open-sigle-quote.less (100%) rename tests/format/{misc/errors/less => less/_errors_}/scss-syntax.scss (100%) create mode 100644 tests/format/misc/_errors_/broken-plugin/__snapshots__/format.test.js.snap rename tests/format/misc/{errors => _errors_}/broken-plugin/format.test.js (100%) rename tests/format/misc/{errors => _errors_}/front-matter/__snapshots__/format.test.js.snap (100%) rename tests/format/misc/{errors => _errors_}/front-matter/format.test.js (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-html/__snapshots__/format.test.js.snap (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-html/format.test.js (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-html/front-matter-toml.html (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-html/front-matter-yaml.html (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-html/test.html (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-javascript/__snapshots__/format.test.js.snap (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-javascript/format.test.js (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-javascript/test.js (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-markdown/__snapshots__/format.test.js.snap (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-markdown/format.test.js (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-markdown/front-matter-json.md (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-markdown/front-matter-pandoc.md (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-markdown/issue-16342.md (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-markdown/test.md (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-vue/__snapshots__/format.test.js.snap (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-vue/format.test.js (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/in-vue/in.vue (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/mdx/__snapshots__/format.test.js.snap (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/mdx/format.test.js (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/mdx/import-export.mdx (100%) rename tests/format/misc/{embedded_language_formatting => embedded-language-formatting}/mdx/jsx.mdx (100%) delete mode 100644 tests/format/misc/errors/broken-plugin/__snapshots__/format.test.js.snap rename tests/format/{misc/errors/scss => scss/_errors_}/__snapshots__/format.test.js.snap (80%) rename tests/format/{misc/errors/scss => scss/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/scss => scss/_errors_}/less-syntax.less (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/abstract-accessor-with-implementation/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/abstract-method-with-implementation/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/abstract-method-with-implementation/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/babel-ts/__snapshots__/format.test.js.snap (78%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/babel-ts/abstract.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/babel-ts/classAbstractMethodWithImplementation.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/babel-ts/declare-accessor.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/babel-ts/format.test.js (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/__snapshots__/format.test.js.snap (70%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/export-declare.ts (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/format.test.js (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/multiline-declaration-abstract-class.ts (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/multiline-declaration-interface.ts (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/multiline-declaration-module.ts (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/multiline-declaration-type.ts (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/parenthesized-decorators-tagged-template.ts (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/type-annotation-expr-statement.ts (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/type-annotation-func.ts (100%) rename tests/format/{misc/errors/babel-ts => typescript/_errors_/babel-ts2}/type-annotation-in-jsx.tsx (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/catch-clause-with-initializer/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/catch-clause-with-initializer/catch-clause-with-initializer.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/catch-clause-with-initializer/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/declare-function-with-body/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/declare-function-with-body/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/declare-getter.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/declare-setter.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/decrement-and-increment-operators/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/decrement-and-increment-operators/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/duplicated-accessibility-modifiers/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/duplicated-accessibility-modifiers/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/empty-type-arguments-parameters/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/empty-type-arguments-parameters/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/enum/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/enum/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/export-declare.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/import-reflection/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/import-reflection/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/import-reflection/valid-flow-default-import.mts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/import-reflection/valid-ts-default-import.mts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/interface/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/interface/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/invalid-class-implements/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/invalid-class-implements/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/invalid-import-equals/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/invalid-import-equals/format.test.js (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-interface-extends/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-interface-extends/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/invalid-interface-heritage-clause/__snapshots__/format.test.js.snap (97%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/invalid-interface-heritage-clause/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/invalid-jsx-1.tsx (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-typescript-decorators/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-typescript-decorators/decorator.ts (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-typescript-decorators/enums.ts (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-typescript-decorators/format.test.js (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-typescript-decorators/function.ts (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-typescript-decorators/interface.ts (100%) rename tests/format/{misc/errors => typescript/_errors_}/invalid-typescript-decorators/issue-9102.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/loop/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/loop/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/mapped-type/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/mapped-type/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/mapped-type/mapped-type.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/modifiers/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/modifiers/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/module-attributes-static.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/module-declaration/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/module-declaration/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/newline-before-arrow.ts (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/tuple/__snapshots__/format.test.js.snap (97%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/tuple/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/type-only-import/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/type-only-import/format.test.js (100%) rename tests/format/{misc/errors/typescript => typescript/_errors_}/value-of-abstract-property.ts (100%) rename tests/format/{misc => typescript}/typescript-babel-only/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc => typescript}/typescript-babel-only/decorator-auto-accessors-new-line.ts (100%) rename tests/format/{misc => typescript}/typescript-babel-only/format.test.js (100%) rename tests/format/{misc => typescript}/typescript-babel-only/parenthesized-decorators-call-expression.ts (100%) rename tests/format/{misc => typescript}/typescript-babel-only/parenthesized-decorators-tagged-template.ts (100%) rename tests/format/{misc => typescript}/typescript-only/__snapshots__/format.test.js.snap (100%) rename tests/format/{misc => typescript}/typescript-only/await-with-parens.ts (100%) rename tests/format/{misc => typescript}/typescript-only/decorator-auto-accessors-abstract-class.ts (100%) rename tests/format/{misc => typescript}/typescript-only/decorator-auto-accessors-declara-class.ts (100%) rename tests/format/{misc => typescript}/typescript-only/decorator-auto-accessors-mixed-modifiers.ts (100%) rename tests/format/{misc => typescript}/typescript-only/format.test.js (100%) rename tests/format/{misc => typescript}/typescript-only/parenthesized-decorators-call-expression.ts (100%) rename tests/format/{misc => typescript}/typescript-only/parenthesized-decorators-tagged-template.ts (100%) rename tests/format/{misc => typescript}/typescript-only/prettier-ignore-parenthesized-type.ts (100%) rename tests/format/{misc/errors/vue => vue/_errors_}/__snapshots__/format.test.js.snap (82%) rename tests/format/{misc/errors/vue => vue/_errors_}/format.test.js (100%) rename tests/format/{misc/errors/vue => vue/_errors_}/unclosed_tag.vue (100%) rename tests/format/{misc/errors/vue => vue/_errors_}/unclosed_tag_in_template.vue (100%) rename tests/format/{misc/errors/vue => vue/_errors_}/upper-case.html (100%) rename tests/format/{misc/errors/yaml => yaml/_errors_}/__snapshots__/format.test.js.snap (86%) rename tests/format/{misc/errors/yaml => yaml/_errors_}/block-scalar-with-spaces-only.yml (100%) rename tests/format/{misc/errors/yaml => yaml/_errors_}/format.test.js (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5e9cd3f96..0ade0be36 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,11 +45,33 @@ function runFormatTest( ): void; ``` -Parameters: +### **`fixtures`** -- **`fixtures`**: Must be set to `import.meta` or to an object of the shape `{ importMeta: import.meta, ... }`. The object may have the `snippets` property to specify an array of extra input entries in addition to the files in the current directory. For each input entry (a file or a snippet), `runFormatTest` configures and runs a number of tests. The main check is that for a given input the output should match the snapshot (for snippets, the expected output can also be specified directly). [Additional checks](#deeper-testing) are controlled by options and environment variables. -- **`parsers`**: A list of parser names. The tests verify that the parsers in this list produce the same output. If the list includes `typescript`, then `babel-ts`, and `oxc-ts` are included implicitly. If the list includes `flow`, then `hermes` is included implicitly. If the list includes `babel`, and the current directory is inside `tests/format/js` or `tests/format/jsx`, then `acorn`, `espree`, `meriyah`, and `oxc` are included implicitly. -- **`options`**: In addition to Prettier's formatting options, can contain the `errors` property to specify that it's expected that the formatting shouldn't be successful and an error should be thrown for all (`errors: true`) or some combinations of input entries and parsers. +Must be set to `import.meta` or to an object of the shape `{ importMeta: import.meta, ... }`. + +The object may have the `snippets` property to specify an array of extra input entries in addition to the files in the current directory. + +For each input entry (a file or a snippet), `runFormatTest` configures and runs a number of tests. + +The main check is that for a given input the output should match the snapshot (for snippets, the expected output can also be specified directly). + +[Additional checks](#deeper-testing) are controlled by options and environment variables. + +### **`parsers`** + +A list of parser names. + +The tests verify that the parsers in this list produce the same output. + +If the list includes `typescript`, then `babel-ts`, and `oxc-ts` are included implicitly. + +If the list includes `flow`, then `hermes` is included implicitly. + +If the list includes `babel`, and the current directory is inside `tests/format/js` or `tests/format/jsx`, then `acorn`, `espree`, `meriyah`, and `oxc` are included implicitly. + +### **`options`** + +In addition to Prettier's formatting options, can contain the `errors` property to specify that it's expected that the formatting shouldn't be successful and an error should be thrown for all (`errors: true`) or some combinations of input entries and parsers. The implementation of `runFormatTest` can be found in [`tests/config/run-format-test.js`](tests/config/run-format-test.js). diff --git a/jest.config.js b/jest.config.js index 9849f485e..4bdcb9094 100644 --- a/jest.config.js +++ b/jest.config.js @@ -51,7 +51,7 @@ if (TEST_RUNTIME === "browser") { testPathIgnorePatterns.push( "tests/format/misc/front-matter/with-plugins/format.test.js", "tests/format/misc/plugins/embed-async-printer/format.test.js", - "tests/format/misc/errors/broken-plugin/format.test.js", + "tests/format/misc/_errors_/broken-plugin/format.test.js", "tests/format/vue/with-plugins/format.test.js", "tests/format/misc/plugins/async-printer/format.test.js", "tests/format/handlebars/front-matter/toml/format.test.js", diff --git a/tests/config/failed-format-tests.js b/tests/config/failed-format-tests.js new file mode 100644 index 000000000..32083026a --- /dev/null +++ b/tests/config/failed-format-tests.js @@ -0,0 +1,122 @@ +import path from "node:path"; +import createEsmUtils from "esm-utils"; + +const { __dirname } = createEsmUtils(import.meta); +const fixturesDirectory = path.join(__dirname, "../format/"); + +// TODO: these test files need fix +const unstableTests = new Map( + [ + ["js/identifier/parentheses/let.js", (options) => options.semi === false], + "js/comments/return-statement.js", + "js/comments/tagged-template-literal.js", + "js/for/9812-unstable.js", + [ + "js/multiparser-markdown/codeblock.js", + (options) => options.proseWrap === "always", + ], + "flow/hook/declare-hook.js", + "flow/hook/hook-type-annotation.js", + "typescript/prettier-ignore/mapped-types.ts", + "typescript/prettier-ignore/issue-14238.ts", + "js/for/continue-and-break-comment-without-blocks.js", + "js/sequence-expression/parenthesized.js", + "typescript/satisfies-operators/comments-unstable.ts", + "jsx/comments/in-attributes.js", + "typescript/union/consistent-with-flow/single-type.ts", + "js/if/non-block.js", + "typescript/import-type/long-module-name/long-module-name4.ts", + // Unstable due to lack of indent information + "js/multiparser-comments/comment-inside.js", + [ + "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", + ].map((fixture) => { + const [file, isUnstable = () => true] = Array.isArray(fixture) + ? fixture + : [fixture]; + return [path.join(fixturesDirectory, file), isUnstable]; + }), +); + +const unstableAstTests = new Map(); + +// These tests works on `babel`, `acorn`, `espree`, `oxc`, and `meriyah` +const commentClosureTypecaseTests = ["js/comments-closure-typecast/"]; + +const disabledTests = new Map( + Object.entries({ + espree: [ + ...commentClosureTypecaseTests, + "js/explicit-resource-management/valid-await-using-asi-assignment.js", + ], + acorn: [ + "js/explicit-resource-management/valid-await-using-asi-assignment.js", + ], + meriyah: [ + // Parsing to different ASTs + "js/decorators/member-expression.js", + ], + "babel-ts": [ + "typescript/conformance/types/moduleDeclaration/kind-detection.ts", + // https://github.com/babel/babel/pull/17659 + "typescript/conformance/internalModules/importDeclarations/circularImportAlias.ts", + "typescript/conformance/internalModules/importDeclarations/exportImportAlias.ts", + "typescript/conformance/internalModules/importDeclarations/importAliasIdentifiers.ts", + "typescript/conformance/internalModules/importDeclarations/shadowedInternalModule.ts", + "typescript/conformance/types/moduleDeclaration/moduleDeclaration.ts", + "typescript/conformance/types/ambient/ambientDeclarations.ts", + "typescript/compiler/declareDottedModuleName.ts", + "typescript/compiler/privacyGloImport.ts", + "typescript/declare/declare_module.ts", + "typescript/const/initializer-ambient-context.ts", + "typescript/keywords/keywords.ts", + "typescript/keywords/module.ts", + "typescript/module/global.ts", + "typescript/module/keyword.ts", + "typescript/module/module_nested.ts", + "typescript/custom/stability/moduleBlock.ts", + "typescript/interface2/module.ts", + "typescript/typescript-only/", + ], + oxc: [], + "oxc-ts": ["typescript/typescript-only/"], + hermes: [ + ...commentClosureTypecaseTests, + + // Not supported + "flow/comments/", + "flow-repo/union_new/", + + // Different result + "flow/hook/comments-before-arrow.js", + ], + flow: [ + // Parsing to different ASTs + "js/decorators/member-expression.js", + ], + 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", + ], + }).map(([parser, tests]) => [ + parser, + new Set(tests.map((file) => path.join(__dirname, "../format", file))), + ]), +); + +const isUnstable = (filename, options) => + unstableTests.get(filename)?.(options); + +const isAstUnstable = (filename, options) => + unstableAstTests.get(filename)?.(options); + +const shouldDisable = (dirnameOrFilename, parser) => + disabledTests.get(parser)?.has(dirnameOrFilename); + +export { isAstUnstable, isUnstable, shouldDisable }; diff --git a/tests/config/run-format-test.js b/tests/config/run-format-test.js index 207015c9c..ee93f97a6 100644 --- a/tests/config/run-format-test.js +++ b/tests/config/run-format-test.js @@ -2,6 +2,7 @@ import fs from "node:fs"; import path from "node:path"; import url from "node:url"; import createEsmUtils from "esm-utils"; +import * as failedTests from "./failed-format-tests.js"; import getPrettier from "./get-prettier.js"; import checkParsers from "./utilities/check-parsers.js"; import consistentEndOfLine from "./utilities/consistent-end-of-line.js"; @@ -19,147 +20,13 @@ const CURSOR_PLACEHOLDER = "<|>"; const RANGE_START_PLACEHOLDER = "<<>>"; const RANGE_END_PLACEHOLDER = "<<>>"; -// TODO: these test files need fix -const unstableTests = new Map( - [ - ["js/identifier/parentheses/let.js", (options) => options.semi === false], - "js/comments/return-statement.js", - "js/comments/tagged-template-literal.js", - "js/for/9812-unstable.js", - [ - "js/multiparser-markdown/codeblock.js", - (options) => options.proseWrap === "always", - ], - "flow/hook/declare-hook.js", - "flow/hook/hook-type-annotation.js", - "typescript/prettier-ignore/mapped-types.ts", - "typescript/prettier-ignore/issue-14238.ts", - "js/for/continue-and-break-comment-without-blocks.js", - "js/sequence-expression/parenthesized.js", - "typescript/satisfies-operators/comments-unstable.ts", - "jsx/comments/in-attributes.js", - "typescript/union/consistent-with-flow/single-type.ts", - "js/if/non-block.js", - "typescript/import-type/long-module-name/long-module-name4.ts", - // Unstable due to lack of indent information - "js/multiparser-comments/comment-inside.js", - [ - "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", - ].map((fixture) => { - const [file, isUnstable = () => true] = Array.isArray(fixture) - ? fixture - : [fixture]; - return [path.join(__dirname, "../format/", file), isUnstable]; - }), -); - -const unstableAstTests = new Map(); -const commentClosureTypecaseTests = new Set( - [ - // These tests works on `babel`, `acorn`, `espree`, `oxc`, and `meriyah` - "comments-closure-typecast", - ].map((directory) => path.join(__dirname, "../format/js", directory)), -); - -const espreeDisabledTests = new Set([ - ...commentClosureTypecaseTests, - ...["explicit-resource-management/valid-await-using-asi-assignment.js"].map( - (file) => path.join(__dirname, "../format/js", file), - ), -]); -const acornDisabledTests = new Set( - ["explicit-resource-management/valid-await-using-asi-assignment.js"].map( - (file) => path.join(__dirname, "../format/js", file), - ), -); -const meriyahDisabledTests = new Set( - [ - // Parsing to different ASTs - "js/decorators/member-expression.js", - ].map((file) => path.join(__dirname, "../format", file)), -); -const babelTsDisabledTests = new Set( - [ - "conformance/types/moduleDeclaration/kind-detection.ts", - // https://github.com/babel/babel/pull/17659 - "conformance/internalModules/importDeclarations/circularImportAlias.ts", - "conformance/internalModules/importDeclarations/exportImportAlias.ts", - "conformance/internalModules/importDeclarations/importAliasIdentifiers.ts", - "conformance/internalModules/importDeclarations/shadowedInternalModule.ts", - "conformance/types/moduleDeclaration/moduleDeclaration.ts", - "conformance/types/ambient/ambientDeclarations.ts", - "compiler/declareDottedModuleName.ts", - "compiler/privacyGloImport.ts", - "declare/declare_module.ts", - "const/initializer-ambient-context.ts", - "keywords/keywords.ts", - "keywords/module.ts", - "module/global.ts", - "module/keyword.ts", - "module/module_nested.ts", - "custom/stability/moduleBlock.ts", - "interface2/module.ts", - ].map((file) => path.join(__dirname, "../format/typescript", file)), -); -const oxcDisabledTests = new Set(); -const oxcTsDisabledTests = new Set(); -const hermesDisabledTests = new Set([ - ...commentClosureTypecaseTests, - ...[ - // Not supported - "flow/comments", - "flow-repo/union_new", - - // Different result - "flow/hook/comments-before-arrow.js", - ].map((file) => path.join(__dirname, "../format", file)), -]); -const flowDisabledTests = new Set( - [ - // Parsing to different ASTs - "js/decorators/member-expression.js", - ].map((file) => path.join(__dirname, "../format", file)), -); -const typescriptDisabledTests = new Set( - [ - // 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", - ].map((file) => path.join(__dirname, "../format", file)), -); - -const isUnstable = (filename, options) => { - const testFunction = unstableTests.get(filename); - - if (!testFunction) { - return false; - } - - return testFunction(options); -}; - -const isAstUnstable = (filename, options) => { - const testFunction = unstableAstTests.get(filename); - - if (!testFunction) { - return false; - } - - return testFunction(options); -}; - -const shouldThrowOnFormat = (filename, options) => { +const shouldThrowOnFormat = (filename, options, parser) => { const { errors = {} } = options; if (errors === true) { return true; } - const files = errors[options.parser]; + const files = errors[parser]; if (files === true || (Array.isArray(files) && files.includes(filename))) { return true; @@ -186,7 +53,7 @@ const ensurePromise = (value) => { return value; }; -function runFormatTest(fixtures, parsers, options) { +function runFormatTest(fixtures, parsers, options = {}) { let { importMeta, snippets = [] } = fixtures.importMeta ? fixtures : { importMeta: fixtures }; @@ -196,31 +63,18 @@ function runFormatTest(fixtures, parsers, options) { throw new Error(`Format test should run in file named 'format.test.js'.`); } - const dirname = path.dirname(url.fileURLToPath(importMeta.url)); - - // `IS_PARSER_INFERENCE_TESTS` mean to test `inferParser` on `standalone` - const IS_PARSER_INFERENCE_TESTS = isTestDirectory( - dirname, - "misc/parser-inference", + const dirname = path.normalize( + path.dirname(url.fileURLToPath(importMeta.url)) + path.sep, ); - // `IS_ERROR_TESTS` mean to watch errors like: + // `IS_ERROR_TEST` mean to watch errors like: // - syntax parser hasn't supported yet // - syntax errors that should throws - const IS_ERROR_TESTS = isTestDirectory(dirname, "misc/errors"); - if (IS_ERROR_TESTS) { + const IS_ERROR_TEST = dirname.includes(`${path.sep}_errors_${path.sep}`); + if (IS_ERROR_TEST) { options = { errors: true, ...options }; } - const IS_TYPESCRIPT_ONLY_TEST = isTestDirectory( - dirname, - "misc/typescript-only", - ); - - if (IS_PARSER_INFERENCE_TESTS) { - parsers = [undefined]; - } - snippets = snippets.map((test, index) => { test = typeof test === "string" ? { code: test } : test; @@ -268,48 +122,39 @@ function runFormatTest(fixtures, parsers, options) { checkParsers({ dirname, files }, parsers); } - const [parser] = parsers; const allParsers = [...parsers]; - - if (!IS_ERROR_TESTS) { - if ( - parsers.includes("babel") && - (isTestDirectory(dirname, "js") || isTestDirectory(dirname, "jsx")) - ) { - if (!parsers.includes("acorn") && !acornDisabledTests.has(dirname)) { - allParsers.push("acorn"); - } - if (!parsers.includes("espree") && !espreeDisabledTests.has(dirname)) { - allParsers.push("espree"); - } - if (!parsers.includes("meriyah") && !meriyahDisabledTests.has(dirname)) { - allParsers.push("meriyah"); - } - if (!parsers.includes("acorn") && !oxcDisabledTests.has(dirname)) { - allParsers.push("oxc"); - } + const addParsers = (...parsers) => { + if (IS_ERROR_TEST) { + return; } - if (parsers.includes("typescript") && !IS_TYPESCRIPT_ONLY_TEST) { - if (!parsers.includes("babel-ts")) { - allParsers.push("babel-ts"); - } - if (!parsers.includes("oxc-ts")) { - allParsers.push("oxc-ts"); + for (const parser of parsers) { + if ( + !allParsers.includes(parser) && + !failedTests.shouldDisable(dirname, parser) + ) { + allParsers.push(parser); } } + }; - if ( - parsers.includes("flow") && - !parsers.includes("hermes") && - !hermesDisabledTests.has(dirname) - ) { - allParsers.push("hermes"); - } + if ( + parsers.includes("babel") && + (isTestDirectory(dirname, "js") || isTestDirectory(dirname, "jsx")) + ) { + addParsers("acorn", "espree", "meriyah", "oxc"); + } - if (parsers.includes("babel") && !parsers.includes("__babel_estree")) { - allParsers.push("__babel_estree"); - } + if (parsers.includes("typescript")) { + addParsers("babel-ts", "oxc-ts"); + } + + if (parsers.includes("flow")) { + addParsers("hermes"); + } + + if (parsers.includes("babel")) { + addParsers("__babel_estree"); } const stringifiedOptions = stringifyOptionsForTitle(options); @@ -320,128 +165,143 @@ function runFormatTest(fixtures, parsers, options) { }`; describe(title, () => { - const formatOptions = { + const basicOptions = { printWidth: 80, - ...options, filepath: filename, - parser, + ...options, }; - const shouldThrowOnMainParserFormat = shouldThrowOnFormat( - name, - formatOptions, + + const testCases = allParsers + .filter((parser) => !failedTests.shouldDisable(filename, parser)) + .map((parser) => { + const formatOptions = { ...basicOptions, parser }; + const expectFail = shouldThrowOnFormat(name, options, parser); + return { + parser, + explicitParsers: parsers, + code, + formatOptions, + expectFail, + expectedOutput: output, + runFormat: () => format(code, formatOptions), + }; + }); + const shouldSnapshotResult = testCases.some( + (testCase) => + !testCase.expectFail && typeof testCase.expectedOutput !== "string", ); - let mainParserFormatResult; - if (shouldThrowOnMainParserFormat) { - mainParserFormatResult = { options: formatOptions, error: true }; - } else { - beforeAll(async () => { - mainParserFormatResult = await format(code, formatOptions); - }); - } + let testCaseForSnapshot; + beforeAll(async () => { + await Promise.all( + testCases.map(async (test) => { + if (test.expectFail) { + return; + } - for (const currentParser of allParsers) { - if ( - (currentParser === "acorn" && acornDisabledTests.has(filename)) || - (currentParser === "espree" && espreeDisabledTests.has(filename)) || - (currentParser === "meriyah" && meriyahDisabledTests.has(filename)) || - (currentParser === "oxc" && oxcDisabledTests.has(filename)) || - (currentParser === "oxc-ts" && oxcTsDisabledTests.has(filename)) || - (currentParser === "hermes" && hermesDisabledTests.has(filename)) || - (currentParser === "flow" && flowDisabledTests.has(filename)) || - (currentParser === "babel-ts" && - babelTsDisabledTests.has(filename)) || - (currentParser === "typescript" && - typescriptDisabledTests.has(filename)) - ) { - continue; - } + try { + test.formatResult = await test.runFormat(); + } catch (error) { + test.error = error; + } + }), + ); - const testTitle = - shouldThrowOnMainParserFormat || - formatOptions.parser !== currentParser - ? `[${currentParser}] format` - : "format"; + testCaseForSnapshot = testCases.find(({ formatResult }) => + Boolean(formatResult), + ); + }); + + const hasMultipleParsers = testCases.length > 1; + + for (const testCase of testCases) { + const testTitle = `${hasMultipleParsers ? `[${testCase.parser}] ` : ""}format`; test(testTitle, async () => { await runTest({ - parsers, - name, filename, code, output, - parser: currentParser, - mainParserFormatResult, - mainParserFormatOptions: formatOptions, + result: testCase, + testCaseForSnapshot, }); + + if (shouldSnapshotResult && !hasMultipleParsers) { + snapshotFormatResult(testCaseForSnapshot); + } + }); + } + + if (shouldSnapshotResult && hasMultipleParsers) { + test("format", () => { + snapshotFormatResult(testCaseForSnapshot); }); } }); } } +function snapshotFormatResult(testCase) { + expect(testCase).toBeDefined(); + + expect( + createSnapshot(testCase.formatResult, { + parsers: testCase.explicitParsers, + formatOptions: testCase.formatOptions, + CURSOR_PLACEHOLDER, + }), + ).toMatchSnapshot(); +} + async function runTest({ - parsers, - name, filename, code, output, - parser, - mainParserFormatResult, - mainParserFormatOptions, + result, + testCaseForSnapshot, }) { - let formatOptions = mainParserFormatOptions; - let formatResult = mainParserFormatResult; - expect(formatResult).toBeDefined(); - - const isMainParser = mainParserFormatOptions.parser === parser; - - // Verify parsers or error tests - if (mainParserFormatResult.error || !isMainParser) { - formatOptions = { ...mainParserFormatResult.options, parser }; - const runFormat = () => format(code, formatOptions); - - if (shouldThrowOnFormat(name, formatOptions)) { - await expect(runFormat()).rejects.toThrowErrorMatchingSnapshot(); - return; - } - - // Verify parsers format result should be the same as main parser - output = mainParserFormatResult.outputWithCursor; - formatResult = await runFormat(); + if (result.expectFail) { + await expect(result.runFormat).rejects.toThrowErrorMatchingSnapshot(); + return; } + const { error, formatResult } = result; + if (!formatResult) { + throw error; + } + + expect(formatResult).toBeDefined(); + expect(testCaseForSnapshot.formatResult).toBeDefined(); + // Make sure output has consistent EOL expect(formatResult.eolVisualizedOutput).toBe( visualizeEndOfLine(consistentEndOfLine(formatResult.outputWithCursor)), ); - // The result is assert to equals to `output` - if (typeof output === "string") { + if (typeof result.expectedOutput === "string") { expect(formatResult.eolVisualizedOutput).toBe(visualizeEndOfLine(output)); - } - // All parsers have the same result, only snapshot the result from main parser - else { - expect( - createSnapshot(formatResult, { - parsers, - formatOptions, - CURSOR_PLACEHOLDER, - }), - ).toMatchSnapshot(); + } else if (testCaseForSnapshot !== result) { + expect(formatResult.eolVisualizedOutput).toStrictEqual( + testCaseForSnapshot.formatResult.eolVisualizedOutput, + ); } if (!FULL_TEST) { return; } + const { formatOptions } = result; + // Some parsers skip parsing empty files if (formatResult.changed && code.trim()) { const { input, output } = formatResult; const [originalAst, formattedAst] = await Promise.all( [input, output].map((code) => parse(code, formatOptions)), ); - const isAstUnstableTest = isAstUnstable(filename, formatOptions); + const isAstUnstableTest = failedTests.isAstUnstable( + filename, + formatOptions, + ); if (isAstUnstableTest) { expect(formattedAst).not.toStrictEqual(originalAst); @@ -450,11 +310,11 @@ async function runTest({ } } - if (!isMainParser) { + if (testCaseForSnapshot === result) { return; } - const isUnstableTest = isUnstable(filename, formatOptions); + const isUnstableTest = failedTests.isUnstable(filename, formatOptions); if ( (formatResult.changed || isUnstableTest) && // No range and cursor @@ -481,21 +341,24 @@ async function runTest({ } if (!shouldSkipEolTest(code, formatResult.options)) { - for (const eol of ["\r\n", "\r"]) { - const { eolVisualizedOutput: output } = await format( - code.replace(/\n/g, eol), - formatOptions, - ); - // Only if `endOfLine: "auto"` the result will be different - const expected = - formatOptions.endOfLine === "auto" - ? visualizeEndOfLine( - // All `code` use `LF`, so the `eol` of result is always `LF` - formatResult.outputWithCursor.replace(/\n/g, eol), - ) - : formatResult.eolVisualizedOutput; - expect(output).toBe(expected); - } + await Promise.all( + ["\r\n", "\r"].map(async (eol) => { + const { eolVisualizedOutput: output } = await format( + code.replace(/\n/g, eol), + formatOptions, + ); + // Only if `endOfLine: "auto"` the result will be different + const expected = + formatOptions.endOfLine === "auto" + ? visualizeEndOfLine( + // All `code` use `LF`, so the `eol` of result is always `LF` + formatResult.outputWithCursor.replace(/\n/g, eol), + ) + : formatResult.eolVisualizedOutput; + + expect(output).toBe(expected); + }), + ); } if (code.charAt(0) !== BOM) { @@ -641,8 +504,8 @@ async function loadPlugins(options) { if (!externalParsers) { externalParsers = getExternalPlugins(); - externalParsers = await externalParsers; } + externalParsers = await externalParsers; if (!externalParsers.has(parser)) { return options; } diff --git a/tests/format/misc/errors/angular/__snapshots__/format.test.js.snap b/tests/format/angular/_errors_/__snapshots__/format.test.js.snap similarity index 86% rename from tests/format/misc/errors/angular/__snapshots__/format.test.js.snap rename to tests/format/angular/_errors_/__snapshots__/format.test.js.snap index 2e2dbffe0..e9f424e88 100644 --- a/tests/format/misc/errors/angular/__snapshots__/format.test.js.snap +++ b/tests/format/angular/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`unkown-block.html [angular] format 1`] = ` +exports[`unkown-block.html format 1`] = ` "Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) (4:1) 2 | } @unknown (foo) { 3 | } diff --git a/tests/format/misc/errors/angular/format.test.js b/tests/format/angular/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/angular/format.test.js rename to tests/format/angular/_errors_/format.test.js diff --git a/tests/format/misc/errors/angular/unkown-block.html b/tests/format/angular/_errors_/unkown-block.html similarity index 100% rename from tests/format/misc/errors/angular/unkown-block.html rename to tests/format/angular/_errors_/unkown-block.html diff --git a/tests/format/misc/errors/css/__snapshots__/format.test.js.snap b/tests/format/css/_errors_/__snapshots__/format.test.js.snap similarity index 78% rename from tests/format/misc/errors/css/__snapshots__/format.test.js.snap rename to tests/format/css/_errors_/__snapshots__/format.test.js.snap index 31c7fa319..2eb577530 100644 --- a/tests/format/misc/errors/css/__snapshots__/format.test.js.snap +++ b/tests/format/css/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`less-syntax.css [css] format 1`] = ` +exports[`less-syntax.css format 1`] = ` "CssSyntaxError: Unknown word .bordered (1:4) > 1 | a {.bordered();} | ^ @@ -8,7 +8,7 @@ exports[`less-syntax.css [css] format 1`] = ` Cause: :1:4: Unknown word .bordered" `; -exports[`scss-syntax.css [css] format 1`] = ` +exports[`scss-syntax.css format 1`] = ` "CssSyntaxError: Unknown word $foo (1:15) > 1 | a {content: #{$foo}} | ^ diff --git a/tests/format/misc/errors/css/format.test.js b/tests/format/css/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/css/format.test.js rename to tests/format/css/_errors_/format.test.js diff --git a/tests/format/misc/errors/css/less-syntax.css b/tests/format/css/_errors_/less-syntax.css similarity index 100% rename from tests/format/misc/errors/css/less-syntax.css rename to tests/format/css/_errors_/less-syntax.css diff --git a/tests/format/misc/errors/css/scss-syntax.css b/tests/format/css/_errors_/scss-syntax.css similarity index 100% rename from tests/format/misc/errors/css/scss-syntax.css rename to tests/format/css/_errors_/scss-syntax.css diff --git a/tests/format/misc/errors/flow/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/__snapshots__/format.test.js.snap similarity index 70% rename from tests/format/misc/errors/flow/__snapshots__/format.test.js.snap rename to tests/format/flow/_errors_/__snapshots__/format.test.js.snap index d5cc8f16a..f49f41995 100644 --- a/tests/format/misc/errors/flow/__snapshots__/format.test.js.snap +++ b/tests/format/flow/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`async-arrow-invalid.js [flow] format 1`] = ` +exports[`async-arrow-invalid.js format 1`] = ` "Unexpected token ILLEGAL (4:1) 2 | 3 | async () => {} @@ -8,28 +8,28 @@ exports[`async-arrow-invalid.js [flow] format 1`] = ` | ^" `; -exports[`function-async.js [flow] format 1`] = ` +exports[`function-async.js format 1`] = ` "Unexpected token \`;\`, expected the token \`=>\` (2:11) 1 | // Flow can't parse this since \`v0.128.0\`, #8661 > 2 | async(); | ^" `; -exports[`invalid_keyword_symbol.js [flow] format 1`] = ` +exports[`invalid_keyword_symbol.js format 1`] = ` "Unexpected reserved type (1:6) > 1 | type symbol = number; | ^^^^^^ 2 |" `; -exports[`module-attributes-static.js [flow] format 1`] = ` +exports[`module-attributes-static.js format 1`] = ` "Unexpected token \`type\`, expected the token \`{\` (1:33) > 1 | import foo from "foo.json" with type: "json"; | ^^^^ 2 |" `; -exports[`newline-before-arrow.js [flow] format 1`] = ` +exports[`newline-before-arrow.js format 1`] = ` "Illegal newline before arrow (2:1) 1 | async x > 2 | => x @@ -37,7 +37,7 @@ exports[`newline-before-arrow.js [flow] format 1`] = ` 3 |" `; -exports[`number.js [flow] format 1`] = ` +exports[`number.js format 1`] = ` "Unexpected token ILLEGAL (3:5) 1 | // https://github.com/babel/babel/pull/11854 2 | @@ -46,7 +46,7 @@ exports[`number.js [flow] format 1`] = ` 4 |" `; -exports[`spread-with-optional.js [flow] format 1`] = ` +exports[`spread-with-optional.js format 1`] = ` "Tuple spread elements cannot be optional. (1:17) > 1 | type T = [...foo?: S]; // ERROR | ^ diff --git a/tests/format/misc/errors/flow/ambient/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/ambient/__snapshots__/format.test.js.snap similarity index 73% rename from tests/format/misc/errors/flow/ambient/__snapshots__/format.test.js.snap rename to tests/format/flow/_errors_/ambient/__snapshots__/format.test.js.snap index 1ad7bb27a..84da05dac 100644 --- a/tests/format/misc/errors/flow/ambient/__snapshots__/format.test.js.snap +++ b/tests/format/flow/_errors_/ambient/__snapshots__/format.test.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`ambient.js [flow] format 1`] = ` +exports[`ambient.js format 1`] = ` "Const must be initialized (1:7) > 1 | const foo: string; | ^^^^^^^^^^^ 2 |" `; -exports[`ambient.unknown [flow] format 1`] = ` +exports[`ambient.unknown format 1`] = ` "Const must be initialized (1:7) > 1 | const foo: string; | ^^^^^^^^^^^ diff --git a/tests/format/misc/errors/flow/ambient/ambient.js b/tests/format/flow/_errors_/ambient/ambient.js similarity index 100% rename from tests/format/misc/errors/flow/ambient/ambient.js rename to tests/format/flow/_errors_/ambient/ambient.js diff --git a/tests/format/misc/errors/flow/ambient/ambient.unknown b/tests/format/flow/_errors_/ambient/ambient.unknown similarity index 100% rename from tests/format/misc/errors/flow/ambient/ambient.unknown rename to tests/format/flow/_errors_/ambient/ambient.unknown diff --git a/tests/format/misc/errors/flow/ambient/format.test.js b/tests/format/flow/_errors_/ambient/format.test.js similarity index 100% rename from tests/format/misc/errors/flow/ambient/format.test.js rename to tests/format/flow/_errors_/ambient/format.test.js diff --git a/tests/format/misc/errors/babel-flow/async-arrow-invalid.js b/tests/format/flow/_errors_/async-arrow-invalid.js similarity index 100% rename from tests/format/misc/errors/babel-flow/async-arrow-invalid.js rename to tests/format/flow/_errors_/async-arrow-invalid.js diff --git a/tests/format/misc/errors/babel-flow/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/babel-flow/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/babel-flow/__snapshots__/format.test.js.snap rename to tests/format/flow/_errors_/babel-flow/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/flow/async-arrow-invalid.js b/tests/format/flow/_errors_/babel-flow/async-arrow-invalid.js similarity index 100% rename from tests/format/misc/errors/flow/async-arrow-invalid.js rename to tests/format/flow/_errors_/babel-flow/async-arrow-invalid.js diff --git a/tests/format/misc/errors/babel-flow/format.test.js b/tests/format/flow/_errors_/babel-flow/format.test.js similarity index 100% rename from tests/format/misc/errors/babel-flow/format.test.js rename to tests/format/flow/_errors_/babel-flow/format.test.js diff --git a/tests/format/misc/errors/babel-flow/wrong-arrow-no-parens-jsx.js b/tests/format/flow/_errors_/babel-flow/wrong-arrow-no-parens-jsx.js similarity index 100% rename from tests/format/misc/errors/babel-flow/wrong-arrow-no-parens-jsx.js rename to tests/format/flow/_errors_/babel-flow/wrong-arrow-no-parens-jsx.js diff --git a/tests/format/misc/errors/flow/format.test.js b/tests/format/flow/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/flow/format.test.js rename to tests/format/flow/_errors_/format.test.js diff --git a/tests/format/misc/errors/flow/function-async.js b/tests/format/flow/_errors_/function-async.js similarity index 100% rename from tests/format/misc/errors/flow/function-async.js rename to tests/format/flow/_errors_/function-async.js diff --git a/tests/format/misc/errors/flow/import-reflection/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/import-reflection/__snapshots__/format.test.js.snap similarity index 78% rename from tests/format/misc/errors/flow/import-reflection/__snapshots__/format.test.js.snap rename to tests/format/flow/_errors_/import-reflection/__snapshots__/format.test.js.snap index 7d597dfce..69ba08d3b 100644 --- a/tests/format/misc/errors/flow/import-reflection/__snapshots__/format.test.js.snap +++ b/tests/format/flow/_errors_/import-reflection/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`valid-flow-default-import.js [flow] format 1`] = ` +exports[`valid-flow-default-import.js format 1`] = ` "Unexpected identifier, expected the keyword \`from\` (1:15) > 1 | import module foo from "./module.wasm"; | ^^^ @@ -8,7 +8,7 @@ exports[`valid-flow-default-import.js [flow] format 1`] = ` 3 |" `; -exports[`valid-ts-default-import.js [flow] format 1`] = ` +exports[`valid-ts-default-import.js format 1`] = ` "Unexpected identifier, expected the keyword \`from\` (1:15) > 1 | import module foo from "./module.wasm"; | ^^^ diff --git a/tests/format/misc/errors/flow/import-reflection/format.test.js b/tests/format/flow/_errors_/import-reflection/format.test.js similarity index 100% rename from tests/format/misc/errors/flow/import-reflection/format.test.js rename to tests/format/flow/_errors_/import-reflection/format.test.js diff --git a/tests/format/misc/errors/flow/import-reflection/valid-flow-default-import.js b/tests/format/flow/_errors_/import-reflection/valid-flow-default-import.js similarity index 100% rename from tests/format/misc/errors/flow/import-reflection/valid-flow-default-import.js rename to tests/format/flow/_errors_/import-reflection/valid-flow-default-import.js diff --git a/tests/format/misc/errors/flow/import-reflection/valid-ts-default-import.js b/tests/format/flow/_errors_/import-reflection/valid-ts-default-import.js similarity index 100% rename from tests/format/misc/errors/flow/import-reflection/valid-ts-default-import.js rename to tests/format/flow/_errors_/import-reflection/valid-ts-default-import.js diff --git a/tests/format/misc/errors/flow/interface/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/interface/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/flow/interface/__snapshots__/format.test.js.snap rename to tests/format/flow/_errors_/interface/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/flow/interface/format.test.js b/tests/format/flow/_errors_/interface/format.test.js similarity index 100% rename from tests/format/misc/errors/flow/interface/format.test.js rename to tests/format/flow/_errors_/interface/format.test.js diff --git a/tests/format/misc/errors/flow/invalid-match/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/invalid-match/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/flow/invalid-match/__snapshots__/format.test.js.snap rename to tests/format/flow/_errors_/invalid-match/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/flow/invalid-match/format.test.js b/tests/format/flow/_errors_/invalid-match/format.test.js similarity index 100% rename from tests/format/misc/errors/flow/invalid-match/format.test.js rename to tests/format/flow/_errors_/invalid-match/format.test.js diff --git a/tests/format/misc/errors/flow/invalid_keyword_symbol.js b/tests/format/flow/_errors_/invalid_keyword_symbol.js similarity index 100% rename from tests/format/misc/errors/flow/invalid_keyword_symbol.js rename to tests/format/flow/_errors_/invalid_keyword_symbol.js diff --git a/tests/format/misc/errors/flow/module-attributes-static.js b/tests/format/flow/_errors_/module-attributes-static.js similarity index 100% rename from tests/format/misc/errors/flow/module-attributes-static.js rename to tests/format/flow/_errors_/module-attributes-static.js diff --git a/tests/format/misc/errors/flow/newline-before-arrow.js b/tests/format/flow/_errors_/newline-before-arrow.js similarity index 100% rename from tests/format/misc/errors/flow/newline-before-arrow.js rename to tests/format/flow/_errors_/newline-before-arrow.js diff --git a/tests/format/misc/errors/flow/number.js b/tests/format/flow/_errors_/number.js similarity index 100% rename from tests/format/misc/errors/flow/number.js rename to tests/format/flow/_errors_/number.js diff --git a/tests/format/misc/errors/flow/record/__snapshots__/format.test.js.snap b/tests/format/flow/_errors_/record/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/flow/record/__snapshots__/format.test.js.snap rename to tests/format/flow/_errors_/record/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/flow/record/format.test.js b/tests/format/flow/_errors_/record/format.test.js similarity index 100% rename from tests/format/misc/errors/flow/record/format.test.js rename to tests/format/flow/_errors_/record/format.test.js diff --git a/tests/format/misc/errors/flow/spread-with-optional.js b/tests/format/flow/_errors_/spread-with-optional.js similarity index 100% rename from tests/format/misc/errors/flow/spread-with-optional.js rename to tests/format/flow/_errors_/spread-with-optional.js diff --git a/tests/format/misc/flow-babel-only/__snapshots__/format.test.js.snap b/tests/format/flow/flow-babel-only/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/flow-babel-only/__snapshots__/format.test.js.snap rename to tests/format/flow/flow-babel-only/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/flow-babel-only/class_with_generics.js b/tests/format/flow/flow-babel-only/class_with_generics.js similarity index 100% rename from tests/format/misc/flow-babel-only/class_with_generics.js rename to tests/format/flow/flow-babel-only/class_with_generics.js diff --git a/tests/format/misc/flow-babel-only/format.test.js b/tests/format/flow/flow-babel-only/format.test.js similarity index 100% rename from tests/format/misc/flow-babel-only/format.test.js rename to tests/format/flow/flow-babel-only/format.test.js diff --git a/tests/format/misc/flow-babel-only/functions.js b/tests/format/flow/flow-babel-only/functions.js similarity index 100% rename from tests/format/misc/flow-babel-only/functions.js rename to tests/format/flow/flow-babel-only/functions.js diff --git a/tests/format/flow/ternary/__snapshots__/format.test.js.snap b/tests/format/flow/ternary/__snapshots__/format.test.js.snap index 8a30cf546..2617e46c6 100644 --- a/tests/format/flow/ternary/__snapshots__/format.test.js.snap +++ b/tests/format/flow/ternary/__snapshots__/format.test.js.snap @@ -11,7 +11,7 @@ exports[`arrows.js [flow] format 1`] = ` 9 | (a ? (b = c) : d => e : f); // a ? ((b = c): d => e) : f" `; -exports[`arrows.js [hermes] format 1`] = ` +exports[`arrows.js format 1`] = ` ====================================options===================================== parsers: ["flow"] printWidth: 80 diff --git a/tests/format/misc/errors/graphql/__snapshots__/format.test.js.snap b/tests/format/graphql/_errors_/__snapshots__/format.test.js.snap similarity index 81% rename from tests/format/misc/errors/graphql/__snapshots__/format.test.js.snap rename to tests/format/graphql/_errors_/__snapshots__/format.test.js.snap index 429d01ffc..45aa831c4 100644 --- a/tests/format/misc/errors/graphql/__snapshots__/format.test.js.snap +++ b/tests/format/graphql/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`descriptions-on-a-short-hand-query.graphql [graphql] format 1`] = ` +exports[`descriptions-on-a-short-hand-query.graphql format 1`] = ` "Syntax Error: Unexpected description, descriptions are not supported on shorthand queries. (3:1) 1 | # https://github.com/graphql/graphql-js/pull/4482 2 | @@ -11,7 +11,7 @@ exports[`descriptions-on-a-short-hand-query.graphql [graphql] format 1`] = ` Cause: Syntax Error: Unexpected description, descriptions are not supported on shorthand queries." `; -exports[`type-interfaces.graphql [graphql] format 1`] = ` +exports[`type-interfaces.graphql format 1`] = ` "Syntax Error: Unexpected "|". (5:21) 3 | # which will break seperator detection added in #7305 4 | diff --git a/tests/format/misc/errors/graphql/descriptions-on-a-short-hand-query.graphql b/tests/format/graphql/_errors_/descriptions-on-a-short-hand-query.graphql similarity index 100% rename from tests/format/misc/errors/graphql/descriptions-on-a-short-hand-query.graphql rename to tests/format/graphql/_errors_/descriptions-on-a-short-hand-query.graphql diff --git a/tests/format/misc/errors/graphql/format.test.js b/tests/format/graphql/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/graphql/format.test.js rename to tests/format/graphql/_errors_/format.test.js diff --git a/tests/format/misc/errors/graphql/type-interfaces.graphql b/tests/format/graphql/_errors_/type-interfaces.graphql similarity index 100% rename from tests/format/misc/errors/graphql/type-interfaces.graphql rename to tests/format/graphql/_errors_/type-interfaces.graphql diff --git a/tests/format/misc/errors/handlebars/__snapshots__/format.test.js.snap b/tests/format/handlebars/_errors_/__snapshots__/format.test.js.snap similarity index 83% rename from tests/format/misc/errors/handlebars/__snapshots__/format.test.js.snap rename to tests/format/handlebars/_errors_/__snapshots__/format.test.js.snap index a5571eb1a..806d9d1e5 100644 --- a/tests/format/misc/errors/handlebars/__snapshots__/format.test.js.snap +++ b/tests/format/handlebars/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`invalid.hbs [glimmer] format 1`] = ` +exports[`invalid.hbs format 1`] = ` "Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_ARRAY', 'CLOSE_ARRAY', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', 'PRIVATE_SEP', got 'INVALID' (2:11) 1 | > 2 | x, {{@name} @@ -12,7 +12,7 @@ Cause: Parse error on line 2: Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_ARRAY', 'CLOSE_ARRAY', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', 'PRIVATE_SEP', got 'INVALID'" `; -exports[`invalid-2.hbs [glimmer] format 1`] = ` +exports[`invalid-2.hbs format 1`] = ` "Unclosed element \`@name\` (3:0) 1 | 2 | @@ -28,7 +28,7 @@ Cause: Unclosed element \`@name\`: (error occurred in 'an unknown module' @ line 3 : column 0)" `; -exports[`invalid-3.hbs [glimmer] format 1`] = ` +exports[`invalid-3.hbs format 1`] = ` "Expecting 'OPEN_SEXPR', 'ID', 'OPEN_ARRAY', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (3:3) 1 | 2 | @@ -41,7 +41,7 @@ Cause: Parse error on line 3: Expecting 'OPEN_SEXPR', 'ID', 'OPEN_ARRAY', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE'" `; -exports[`snippet: IMG [glimmer] format 1`] = ` +exports[`snippet: IMG format 1`] = ` "Unclosed element \`IMG\` (1:0) > 1 | | ^^^^^ @@ -54,7 +54,7 @@ Cause: Unclosed element \`IMG\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: INPUT [glimmer] format 1`] = ` +exports[`snippet: INPUT format 1`] = ` "Unclosed element \`INPUT\` (1:0) > 1 | | ^^^^^^^ @@ -67,7 +67,7 @@ Cause: Unclosed element \`INPUT\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: area [glimmer] format 1`] = ` +exports[`snippet: area format 1`] = ` " elements do not need end tags. You should remove it (1:6) > 1 | | ^^^^^^^ @@ -80,7 +80,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 6)" `; -exports[`snippet: base [glimmer] format 1`] = ` +exports[`snippet: base format 1`] = ` " elements do not need end tags. You should remove it (1:6) > 1 | | ^^^^^^^ @@ -93,7 +93,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 6)" `; -exports[`snippet: basefont [glimmer] format 1`] = ` +exports[`snippet: basefont format 1`] = ` "Unclosed element \`basefont\` (1:0) > 1 | | ^^^^^^^^^^ @@ -106,7 +106,7 @@ Cause: Unclosed element \`basefont\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: bgsound [glimmer] format 1`] = ` +exports[`snippet: bgsound format 1`] = ` "Unclosed element \`bgsound\` (1:0) > 1 | | ^^^^^^^^^ @@ -119,7 +119,7 @@ Cause: Unclosed element \`bgsound\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: br [glimmer] format 1`] = ` +exports[`snippet: br format 1`] = ` "
elements do not need end tags. You should remove it (1:4) > 1 |

| ^^^^^ @@ -132,7 +132,7 @@ Cause:
elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 4)" `; -exports[`snippet: col [glimmer] format 1`] = ` +exports[`snippet: col format 1`] = ` " elements do not need end tags. You should remove it (1:5) > 1 | | ^^^^^^ @@ -145,7 +145,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 5)" `; -exports[`snippet: command [glimmer] format 1`] = ` +exports[`snippet: command format 1`] = ` " elements do not need end tags. You should remove it (1:9) > 1 | | ^^^^^^^^^^ @@ -158,7 +158,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 9)" `; -exports[`snippet: div [glimmer] format 1`] = ` +exports[`snippet: div format 1`] = ` "Unclosed element \`div\` (1:0) > 1 |
| ^^^^^ @@ -171,7 +171,7 @@ Cause: Unclosed element \`div\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: embed [glimmer] format 1`] = ` +exports[`snippet: embed format 1`] = ` " elements do not need end tags. You should remove it (1:7) > 1 | | ^^^^^^^^ @@ -184,7 +184,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 7)" `; -exports[`snippet: frame [glimmer] format 1`] = ` +exports[`snippet: frame format 1`] = ` "Unclosed element \`frame\` (1:0) > 1 | | ^^^^^^^ @@ -197,7 +197,7 @@ Cause: Unclosed element \`frame\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: hr [glimmer] format 1`] = ` +exports[`snippet: hr format 1`] = ` "
elements do not need end tags. You should remove it (1:4) > 1 |
| ^^^^^ @@ -210,7 +210,7 @@ Cause:
elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 4)" `; -exports[`snippet: imG [glimmer] format 1`] = ` +exports[`snippet: imG format 1`] = ` "Unclosed element \`imG\` (1:0) > 1 | | ^^^^^ @@ -223,7 +223,7 @@ Cause: Unclosed element \`imG\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: image [glimmer] format 1`] = ` +exports[`snippet: image format 1`] = ` "Unclosed element \`image\` (1:0) > 1 | | ^^^^^^^ @@ -236,7 +236,7 @@ Cause: Unclosed element \`image\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: img [glimmer] format 1`] = ` +exports[`snippet: img format 1`] = ` " elements do not need end tags. You should remove it (1:5) > 1 | | ^^^^^^ @@ -249,7 +249,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 5)" `; -exports[`snippet: input [glimmer] format 1`] = ` +exports[`snippet: input format 1`] = ` " elements do not need end tags. You should remove it (1:7) > 1 | | ^^^^^^^^ @@ -262,7 +262,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 7)" `; -exports[`snippet: isindex [glimmer] format 1`] = ` +exports[`snippet: isindex format 1`] = ` "Unclosed element \`isindex\` (1:0) > 1 | | ^^^^^^^^^ @@ -275,7 +275,7 @@ Cause: Unclosed element \`isindex\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: keygen [glimmer] format 1`] = ` +exports[`snippet: keygen format 1`] = ` " elements do not need end tags. You should remove it (1:8) > 1 | | ^^^^^^^^^ @@ -288,7 +288,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 8)" `; -exports[`snippet: lINk [glimmer] format 1`] = ` +exports[`snippet: lINk format 1`] = ` "Unclosed element \`lINk\` (1:0) > 1 | | ^^^^^^ @@ -301,7 +301,7 @@ Cause: Unclosed element \`lINk\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: link [glimmer] format 1`] = ` +exports[`snippet: link format 1`] = ` " elements do not need end tags. You should remove it (1:6) > 1 | | ^^^^^^^ @@ -314,7 +314,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 6)" `; -exports[`snippet: menuitem [glimmer] format 1`] = ` +exports[`snippet: menuitem format 1`] = ` "Unclosed element \`menuitem\` (1:0) > 1 | | ^^^^^^^^^^ @@ -327,7 +327,7 @@ Cause: Unclosed element \`menuitem\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: meta [glimmer] format 1`] = ` +exports[`snippet: meta format 1`] = ` " elements do not need end tags. You should remove it (1:6) > 1 | | ^^^^^^^ @@ -340,7 +340,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 6)" `; -exports[`snippet: nextid [glimmer] format 1`] = ` +exports[`snippet: nextid format 1`] = ` "Unclosed element \`nextid\` (1:0) > 1 | | ^^^^^^^^ @@ -353,7 +353,7 @@ Cause: Unclosed element \`nextid\`: (error occurred in 'an unknown module' @ line 1 : column 0)" `; -exports[`snippet: param [glimmer] format 1`] = ` +exports[`snippet: param format 1`] = ` " elements do not need end tags. You should remove it (1:7) > 1 | | ^^^^^^^^ @@ -366,7 +366,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 7)" `; -exports[`snippet: source [glimmer] format 1`] = ` +exports[`snippet: source format 1`] = ` " elements do not need end tags. You should remove it (1:8) > 1 | | ^^^^^^^^^ @@ -379,7 +379,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 8)" `; -exports[`snippet: track [glimmer] format 1`] = ` +exports[`snippet: track format 1`] = ` " elements do not need end tags. You should remove it (1:7) > 1 | | ^^^^^^^^ @@ -392,7 +392,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 7)" `; -exports[`snippet: wbr [glimmer] format 1`] = ` +exports[`snippet: wbr format 1`] = ` " elements do not need end tags. You should remove it (1:5) > 1 | | ^^^^^^ @@ -405,7 +405,7 @@ Cause: elements do not need end tags. You should remove it: (error occurred in 'an unknown module' @ line 1 : column 5)" `; -exports[`tilde-comments-1.hbs [glimmer] format 1`] = ` +exports[`tilde-comments-1.hbs format 1`] = ` "Expecting 'OPEN_SEXPR', 'ID', 'OPEN_ARRAY', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (1:4) > 1 | {{~}} | ^ @@ -416,7 +416,7 @@ Cause: Parse error on line 1: Expecting 'OPEN_SEXPR', 'ID', 'OPEN_ARRAY', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE'" `; -exports[`tilde-comments-2.hbs [glimmer] format 1`] = ` +exports[`tilde-comments-2.hbs format 1`] = ` "Expecting 'OPEN_SEXPR', 'ID', 'OPEN_ARRAY', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE' (1:4) > 1 | {{~~}} | ^ diff --git a/tests/format/misc/errors/handlebars/format.test.js b/tests/format/handlebars/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/handlebars/format.test.js rename to tests/format/handlebars/_errors_/format.test.js diff --git a/tests/format/misc/errors/handlebars/invalid-2.hbs b/tests/format/handlebars/_errors_/invalid-2.hbs similarity index 100% rename from tests/format/misc/errors/handlebars/invalid-2.hbs rename to tests/format/handlebars/_errors_/invalid-2.hbs diff --git a/tests/format/misc/errors/handlebars/invalid-3.hbs b/tests/format/handlebars/_errors_/invalid-3.hbs similarity index 100% rename from tests/format/misc/errors/handlebars/invalid-3.hbs rename to tests/format/handlebars/_errors_/invalid-3.hbs diff --git a/tests/format/misc/errors/handlebars/invalid.hbs b/tests/format/handlebars/_errors_/invalid.hbs similarity index 100% rename from tests/format/misc/errors/handlebars/invalid.hbs rename to tests/format/handlebars/_errors_/invalid.hbs diff --git a/tests/format/misc/errors/handlebars/tilde-comments-1.hbs b/tests/format/handlebars/_errors_/tilde-comments-1.hbs similarity index 100% rename from tests/format/misc/errors/handlebars/tilde-comments-1.hbs rename to tests/format/handlebars/_errors_/tilde-comments-1.hbs diff --git a/tests/format/misc/errors/handlebars/tilde-comments-2.hbs b/tests/format/handlebars/_errors_/tilde-comments-2.hbs similarity index 100% rename from tests/format/misc/errors/handlebars/tilde-comments-2.hbs rename to tests/format/handlebars/_errors_/tilde-comments-2.hbs diff --git a/tests/format/misc/errors/js/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/__snapshots__/format.test.js.snap similarity index 73% rename from tests/format/misc/errors/js/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/__snapshots__/format.test.js.snap index e76caa372..09be89a35 100644 --- a/tests/format/misc/errors/js/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`html-like-comments.js [babel] format 1`] = ` +exports[`html-like-comments.js format 1`] = ` "Unexpected token (3:1) 1 | // Only support HTML-like comment in HTML 2 | alert( @@ -12,7 +12,7 @@ exports[`html-like-comments.js [babel] format 1`] = ` Cause: Unexpected token (3:0)" `; -exports[`import-attributes-for-export-without-from.js [babel] format 1`] = ` +exports[`import-attributes-for-export-without-from.js format 1`] = ` "Unexpected token, expected "(" (1:32) > 1 | export { default as foo } with { type: "json" }; | ^ @@ -20,7 +20,7 @@ exports[`import-attributes-for-export-without-from.js [babel] format 1`] = ` Cause: Unexpected token, expected "(" (1:31)" `; -exports[`import-attributes-with-parens.js [babel] format 1`] = ` +exports[`import-attributes-with-parens.js format 1`] = ` "Unexpected token, expected "{" (1:17) > 1 | import "x" with ({type: 'json'}); | ^ @@ -28,7 +28,7 @@ exports[`import-attributes-with-parens.js [babel] format 1`] = ` Cause: Unexpected token, expected "{" (1:16)" `; -exports[`invalid-escape-in-identifier.js [babel] format 1`] = ` +exports[`invalid-escape-in-identifier.js format 1`] = ` "Invalid Unicode escape. (1:7) > 1 | const \\u{20} = 1 | ^ @@ -37,7 +37,7 @@ exports[`invalid-escape-in-identifier.js [babel] format 1`] = ` Cause: Invalid Unicode escape. (1:6)" `; -exports[`invalid-escape-in-identifier-2.js [babel] format 1`] = ` +exports[`invalid-escape-in-identifier-2.js format 1`] = ` "Expecting Unicode escape sequence \\uXXXX. (1:3) > 1 | a\\ = a | ^ @@ -45,7 +45,7 @@ exports[`invalid-escape-in-identifier-2.js [babel] format 1`] = ` Cause: Expecting Unicode escape sequence \\uXXXX. (1:2)" `; -exports[`module-attributes.js [babel] format 1`] = ` +exports[`module-attributes.js format 1`] = ` "Unexpected token, expected "{" (1:33) > 1 | import foo from "foo.json" with type: "json"; | ^ @@ -53,7 +53,7 @@ exports[`module-attributes.js [babel] format 1`] = ` Cause: Unexpected token, expected "{" (1:32)" `; -exports[`no-for-in-init-concise-binary-in.js [babel] format 1`] = ` +exports[`no-for-in-init-concise-binary-in.js format 1`] = ` "Unexpected token, expected ")" (3:18) 1 | // https://github.com/babel/babel/pull/11931 2 | @@ -63,7 +63,7 @@ exports[`no-for-in-init-concise-binary-in.js [babel] format 1`] = ` Cause: Unexpected token, expected ")" (3:17)" `; -exports[`partial-template-strings.js [babel] format 1`] = ` +exports[`partial-template-strings.js format 1`] = ` "Unexpected token (6:42) 4 | 5 | const Diagnostics = { @@ -75,49 +75,49 @@ exports[`partial-template-strings.js [babel] format 1`] = ` Cause: Unexpected token (6:41)" `; -exports[`snippet: #0 [babel] format 1`] = ` +exports[`snippet: #0 format 1`] = ` "Binding should be performed on object property. (1:3) > 1 | ::%DebugPrint(null) | ^ Cause: Binding should be performed on object property. (1:2)" `; -exports[`snippet: #1 [babel] format 1`] = ` +exports[`snippet: #1 format 1`] = ` "Unexpected token (1:3) > 1 | a.%DebugPrint(); | ^ Cause: Unexpected token (1:2)" `; -exports[`snippet: #2 [babel] format 1`] = ` +exports[`snippet: #2 format 1`] = ` "Unexpected token (1:11) > 1 | const i = %DebugPrint; | ^ Cause: Unexpected token (1:10)" `; -exports[`snippet: #3 [babel] format 1`] = ` +exports[`snippet: #3 format 1`] = ` "Unexpected token (1:7) > 1 | f(x + ?) | ^ Cause: Unexpected token (1:6)" `; -exports[`snippet: #4 [babel] format 1`] = ` +exports[`snippet: #4 format 1`] = ` "Unexpected token (1:5) > 1 | x + ? | ^ Cause: Unexpected token (1:4)" `; -exports[`snippet: #5 [babel] format 1`] = ` +exports[`snippet: #5 format 1`] = ` "Unexpected token (1:1) > 1 | ?.f() | ^ Cause: Unexpected token (1:0)" `; -exports[`snippet: #6 [babel] format 1`] = ` +exports[`snippet: #6 format 1`] = ` "Unexpected token (5:12) 3 | 4 | static isC(obj) { @@ -128,49 +128,49 @@ exports[`snippet: #6 [babel] format 1`] = ` Cause: Unexpected token (5:11)" `; -exports[`snippet: #7 [babel] format 1`] = ` +exports[`snippet: #7 format 1`] = ` "Unexpected token (1:7) > 1 | const #{ a, b } = #{ a: 1, b: 2 }; | ^ Cause: Unexpected token (1:6)" `; -exports[`snippet: #8 [babel] format 1`] = ` +exports[`snippet: #8 format 1`] = ` "Unexpected token (1:7) > 1 | const #[a, b] = #[1, 2]; | ^ Cause: Unexpected token (1:6)" `; -exports[`snippet: #9 [babel] format 1`] = ` +exports[`snippet: #9 format 1`] = ` "Unexpected token (1:2) > 1 | [| 1 |] | ^ Cause: Unexpected token (1:1)" `; -exports[`snippet: #10 [babel] format 1`] = ` +exports[`snippet: #10 format 1`] = ` "Identifier directly after number. (1:12) > 1 | 0b101011101m; | ^ Cause: Identifier directly after number. (1:11)" `; -exports[`snippet: #11 [babel] format 1`] = ` +exports[`snippet: #11 format 1`] = ` "Identifier directly after number. (1:8) > 1 | 0x16432m; | ^ Cause: Identifier directly after number. (1:7)" `; -exports[`snippet: #12 [babel] format 1`] = ` +exports[`snippet: #12 format 1`] = ` "Identifier directly after number. (1:8) > 1 | 0o16432m; | ^ Cause: Identifier directly after number. (1:7)" `; -exports[`static-import-source-should-not-has-extra-token.js [babel] format 1`] = ` +exports[`static-import-source-should-not-has-extra-token.js format 1`] = ` "Unexpected token (4:16) 2 | // be parenthesized, that accidentally break #8016 3 | diff --git a/tests/format/misc/errors/js/assignment/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/assignment/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/assignment/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/assignment/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/assignment/format.test.js b/tests/format/js/_errors_/assignment/format.test.js similarity index 100% rename from tests/format/misc/errors/js/assignment/format.test.js rename to tests/format/js/_errors_/assignment/format.test.js diff --git a/tests/format/misc/errors/js/async-await/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/async-await/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/async-await/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/async-await/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/async-await/format.test.js b/tests/format/js/_errors_/async-await/format.test.js similarity index 100% rename from tests/format/misc/errors/js/async-await/format.test.js rename to tests/format/js/_errors_/async-await/format.test.js diff --git a/tests/format/misc/errors/babel-missing-plugins/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/babel-missing-plugins/__snapshots__/format.test.js.snap similarity index 75% rename from tests/format/misc/errors/babel-missing-plugins/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/babel-missing-plugins/__snapshots__/format.test.js.snap index 64118e114..9f9c953e1 100644 --- a/tests/format/misc/errors/babel-missing-plugins/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/babel-missing-plugins/__snapshots__/format.test.js.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`snippet: #0 [babel] format 1`] = ` +exports[`snippet: #0 format 1`] = ` "Unexpected token. (1:8) > 1 | export type Foo = number; | ^" `; -exports[`snippet: #1 [babel] format 1`] = ` +exports[`snippet: #1 format 1`] = ` "Identifier directly after number. (1:4) > 1 | 100m; | ^ Cause: Identifier directly after number. (1:3)" `; -exports[`snippet: #2 [babel] format 1`] = ` +exports[`snippet: #2 format 1`] = ` "Unexpected token, expected "from" (1:15) > 1 | import module foo from "./module.wasm"; | ^ diff --git a/tests/format/misc/errors/babel-missing-plugins/format.test.js b/tests/format/js/_errors_/babel-missing-plugins/format.test.js similarity index 100% rename from tests/format/misc/errors/babel-missing-plugins/format.test.js rename to tests/format/js/_errors_/babel-missing-plugins/format.test.js diff --git a/tests/format/misc/errors/js/class-property-named-constructor/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/class-property-named-constructor/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/class-property-named-constructor/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/class-property-named-constructor/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/class-property-named-constructor/format.test.js b/tests/format/js/_errors_/class-property-named-constructor/format.test.js similarity index 100% rename from tests/format/misc/errors/js/class-property-named-constructor/format.test.js rename to tests/format/js/_errors_/class-property-named-constructor/format.test.js diff --git a/tests/format/misc/errors/js/decorators/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/decorators/__snapshots__/format.test.js.snap similarity index 88% rename from tests/format/misc/errors/js/decorators/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/decorators/__snapshots__/format.test.js.snap index a490c5766..5b7b81c84 100644 --- a/tests/format/misc/errors/js/decorators/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/decorators/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`snippet: #0 [babel] format 1`] = ` +exports[`snippet: #0 format 1`] = ` "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time. (2:8) 1 | @decorator1 > 2 | export @decorator2 class A{} @@ -8,7 +8,7 @@ exports[`snippet: #0 [babel] format 1`] = ` Cause: Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time. (2:7)" `; -exports[`snippet: #1 [babel] format 1`] = ` +exports[`snippet: #1 format 1`] = ` "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time. (2:16) 1 | @decorator1 > 2 | export default @decorator2 class A{} @@ -16,21 +16,21 @@ exports[`snippet: #1 [babel] format 1`] = ` Cause: Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time. (2:15)" `; -exports[`snippet: #2 [babel] format 1`] = ` +exports[`snippet: #2 format 1`] = ` "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time. (1:20) > 1 | @decorator1 export @decorator2 class A {} | ^ Cause: Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time. (1:19)" `; -exports[`snippet: #3 [babel] format 1`] = ` +exports[`snippet: #3 format 1`] = ` "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time. (1:28) > 1 | @decorator1 export default @decorator2 class A {} | ^ Cause: Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time. (1:27)" `; -exports[`snippet: #4 [babel] format 1`] = ` +exports[`snippet: #4 format 1`] = ` "Leading decorators must be attached to a class declaration. (1:20) > 1 | export @decorator2 default class A {} | ^ diff --git a/tests/format/misc/errors/js/decorators/format.test.js b/tests/format/js/_errors_/decorators/format.test.js similarity index 100% rename from tests/format/misc/errors/js/decorators/format.test.js rename to tests/format/js/_errors_/decorators/format.test.js diff --git a/tests/format/misc/errors/js/discard-binding/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/discard-binding/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/discard-binding/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/discard-binding/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/discard-binding/format.test.js b/tests/format/js/_errors_/discard-binding/format.test.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/format.test.js rename to tests/format/js/_errors_/discard-binding/format.test.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-array-expression.js b/tests/format/js/_errors_/discard-binding/invalid-array-expression.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-array-expression.js rename to tests/format/js/_errors_/discard-binding/invalid-array-expression.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-assignment-expression.js b/tests/format/js/_errors_/discard-binding/invalid-assignment-expression.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-assignment-expression.js rename to tests/format/js/_errors_/discard-binding/invalid-assignment-expression.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-assignment-for.js b/tests/format/js/_errors_/discard-binding/invalid-assignment-for.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-assignment-for.js rename to tests/format/js/_errors_/discard-binding/invalid-assignment-for.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-assignment-pattern.js b/tests/format/js/_errors_/discard-binding/invalid-assignment-pattern.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-assignment-pattern.js rename to tests/format/js/_errors_/discard-binding/invalid-assignment-pattern.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-async-call-argument.js b/tests/format/js/_errors_/discard-binding/invalid-async-call-argument.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-async-call-argument.js rename to tests/format/js/_errors_/discard-binding/invalid-async-call-argument.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-catch-parameter.js b/tests/format/js/_errors_/discard-binding/invalid-catch-parameter.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-catch-parameter.js rename to tests/format/js/_errors_/discard-binding/invalid-catch-parameter.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-lone-arrow-function-parameter.js b/tests/format/js/_errors_/discard-binding/invalid-lone-arrow-function-parameter.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-lone-arrow-function-parameter.js rename to tests/format/js/_errors_/discard-binding/invalid-lone-arrow-function-parameter.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-lone-async-arrow-function-parameter.js b/tests/format/js/_errors_/discard-binding/invalid-lone-async-arrow-function-parameter.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-lone-async-arrow-function-parameter.js rename to tests/format/js/_errors_/discard-binding/invalid-lone-async-arrow-function-parameter.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-object-expression.js b/tests/format/js/_errors_/discard-binding/invalid-object-expression.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-object-expression.js rename to tests/format/js/_errors_/discard-binding/invalid-object-expression.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-parenthesized-assignment.js b/tests/format/js/_errors_/discard-binding/invalid-parenthesized-assignment.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-parenthesized-assignment.js rename to tests/format/js/_errors_/discard-binding/invalid-parenthesized-assignment.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-parenthesized-binding.js b/tests/format/js/_errors_/discard-binding/invalid-parenthesized-binding.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-parenthesized-binding.js rename to tests/format/js/_errors_/discard-binding/invalid-parenthesized-binding.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-rest-element-array-pattern-for-lhs.js b/tests/format/js/_errors_/discard-binding/invalid-rest-element-array-pattern-for-lhs.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-rest-element-array-pattern-for-lhs.js rename to tests/format/js/_errors_/discard-binding/invalid-rest-element-array-pattern-for-lhs.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-rest-element-array-pattern-lhs.js b/tests/format/js/_errors_/discard-binding/invalid-rest-element-array-pattern-lhs.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-rest-element-array-pattern-lhs.js rename to tests/format/js/_errors_/discard-binding/invalid-rest-element-array-pattern-lhs.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-rest-element-array-pattern.js b/tests/format/js/_errors_/discard-binding/invalid-rest-element-array-pattern.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-rest-element-array-pattern.js rename to tests/format/js/_errors_/discard-binding/invalid-rest-element-array-pattern.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-rest-element-object-pattern-for-lhs.js b/tests/format/js/_errors_/discard-binding/invalid-rest-element-object-pattern-for-lhs.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-rest-element-object-pattern-for-lhs.js rename to tests/format/js/_errors_/discard-binding/invalid-rest-element-object-pattern-for-lhs.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-rest-element-object-pattern-lhs.js b/tests/format/js/_errors_/discard-binding/invalid-rest-element-object-pattern-lhs.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-rest-element-object-pattern-lhs.js rename to tests/format/js/_errors_/discard-binding/invalid-rest-element-object-pattern-lhs.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-rest-element-object-pattern.js b/tests/format/js/_errors_/discard-binding/invalid-rest-element-object-pattern.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-rest-element-object-pattern.js rename to tests/format/js/_errors_/discard-binding/invalid-rest-element-object-pattern.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-sequence-expression.js b/tests/format/js/_errors_/discard-binding/invalid-sequence-expression.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-sequence-expression.js rename to tests/format/js/_errors_/discard-binding/invalid-sequence-expression.js diff --git a/tests/format/misc/errors/js/discard-binding/invalid-variable-declarator.js b/tests/format/js/_errors_/discard-binding/invalid-variable-declarator.js similarity index 100% rename from tests/format/misc/errors/js/discard-binding/invalid-variable-declarator.js rename to tests/format/js/_errors_/discard-binding/invalid-variable-declarator.js diff --git a/tests/format/misc/errors/js/explicit-resource-management/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/explicit-resource-management/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/explicit-resource-management/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/explicit-resource-management/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/explicit-resource-management/format.test.js b/tests/format/js/_errors_/explicit-resource-management/format.test.js similarity index 100% rename from tests/format/misc/errors/js/explicit-resource-management/format.test.js rename to tests/format/js/_errors_/explicit-resource-management/format.test.js diff --git a/tests/format/misc/errors/js/explicit-resource-management/invalid-for-await-using-binding-of-of.js b/tests/format/js/_errors_/explicit-resource-management/invalid-for-await-using-binding-of-of.js similarity index 100% rename from tests/format/misc/errors/js/explicit-resource-management/invalid-for-await-using-binding-of-of.js rename to tests/format/js/_errors_/explicit-resource-management/invalid-for-await-using-binding-of-of.js diff --git a/tests/format/misc/errors/js/explicit-resource-management/invalid-for-using-binding-in.js b/tests/format/js/_errors_/explicit-resource-management/invalid-for-using-binding-in.js similarity index 100% rename from tests/format/misc/errors/js/explicit-resource-management/invalid-for-using-binding-in.js rename to tests/format/js/_errors_/explicit-resource-management/invalid-for-using-binding-in.js diff --git a/tests/format/misc/errors/js/explicit-resource-management/invalid-for-using-binding-of-in.js b/tests/format/js/_errors_/explicit-resource-management/invalid-for-using-binding-of-in.js similarity index 100% rename from tests/format/misc/errors/js/explicit-resource-management/invalid-for-using-binding-of-in.js rename to tests/format/js/_errors_/explicit-resource-management/invalid-for-using-binding-of-in.js diff --git a/tests/format/misc/errors/js/explicit-resource-management/invalid-for-using-binding-of-of.js b/tests/format/js/_errors_/explicit-resource-management/invalid-for-using-binding-of-of.js similarity index 100% rename from tests/format/misc/errors/js/explicit-resource-management/invalid-for-using-binding-of-of.js rename to tests/format/js/_errors_/explicit-resource-management/invalid-for-using-binding-of-of.js diff --git a/tests/format/misc/errors/js/explicit-resource-management/invalid-using-binding-let.js b/tests/format/js/_errors_/explicit-resource-management/invalid-using-binding-let.js similarity index 100% rename from tests/format/misc/errors/js/explicit-resource-management/invalid-using-binding-let.js rename to tests/format/js/_errors_/explicit-resource-management/invalid-using-binding-let.js diff --git a/tests/format/misc/errors/js/explicit-resource-management/invalid-using-binding-pattern.js b/tests/format/js/_errors_/explicit-resource-management/invalid-using-binding-pattern.js similarity index 100% rename from tests/format/misc/errors/js/explicit-resource-management/invalid-using-binding-pattern.js rename to tests/format/js/_errors_/explicit-resource-management/invalid-using-binding-pattern.js diff --git a/tests/format/misc/errors/js/export-default-from/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/export-default-from/__snapshots__/format.test.js.snap similarity index 77% rename from tests/format/misc/errors/js/export-default-from/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/export-default-from/__snapshots__/format.test.js.snap index 4224f63a4..3f50fa73c 100644 --- a/tests/format/misc/errors/js/export-default-from/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/export-default-from/__snapshots__/format.test.js.snap @@ -1,27 +1,27 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`snippet: #0 [babel] format 1`] = ` +exports[`snippet: #0 format 1`] = ` "Unexpected token (1:9) > 1 | export *, {} from "foo"; | ^ Cause: Unexpected token (1:8)" `; -exports[`snippet: #1 [babel] format 1`] = ` +exports[`snippet: #1 format 1`] = ` "Unexpected token, expected "from" (1:21) > 1 | export * as foo, {} from "foo"; | ^ Cause: Unexpected token, expected "from" (1:20)" `; -exports[`snippet: #2 [babel] format 1`] = ` +exports[`snippet: #2 format 1`] = ` "Unexpected token (1:9) > 1 | export *, {bar} from "foo"; | ^ Cause: Unexpected token (1:8)" `; -exports[`snippet: #3 [babel] format 1`] = ` +exports[`snippet: #3 format 1`] = ` "Unexpected token, expected "from" (1:24) > 1 | export * as foo, {bar} from "foo"; | ^ diff --git a/tests/format/misc/errors/js/export-default-from/format.test.js b/tests/format/js/_errors_/export-default-from/format.test.js similarity index 100% rename from tests/format/misc/errors/js/export-default-from/format.test.js rename to tests/format/js/_errors_/export-default-from/format.test.js diff --git a/tests/format/misc/errors/js/export-name/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/export-name/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/export-name/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/export-name/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/export-name/format.test.js b/tests/format/js/_errors_/export-name/format.test.js similarity index 100% rename from tests/format/misc/errors/js/export-name/format.test.js rename to tests/format/js/_errors_/export-name/format.test.js diff --git a/tests/format/misc/errors/js/for-of/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/for-of/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/for-of/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/for-of/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/for-of/format.test.js b/tests/format/js/_errors_/for-of/format.test.js similarity index 100% rename from tests/format/misc/errors/js/for-of/format.test.js rename to tests/format/js/_errors_/for-of/format.test.js diff --git a/tests/format/misc/errors/js/format.test.js b/tests/format/js/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/js/format.test.js rename to tests/format/js/_errors_/format.test.js diff --git a/tests/format/misc/errors/js/hack-pipeline/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/hack-pipeline/__snapshots__/format.test.js.snap similarity index 88% rename from tests/format/misc/errors/js/hack-pipeline/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/hack-pipeline/__snapshots__/format.test.js.snap index 0e12debbf..debbe2357 100644 --- a/tests/format/misc/errors/js/hack-pipeline/__snapshots__/format.test.js.snap +++ b/tests/format/js/_errors_/hack-pipeline/__snapshots__/format.test.js.snap @@ -1,76 +1,76 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`snippet: #0 [babel] format 1`] = ` +exports[`snippet: #0 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> (yield y)} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #1 [babel] format 1`] = ` +exports[`snippet: #1 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> (yield)} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #2 [babel] format 1`] = ` +exports[`snippet: #2 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> (await y)} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #3 [babel] format 1`] = ` +exports[`snippet: #3 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> (a?.b)} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #4 [babel] format 1`] = ` +exports[`snippet: #4 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> a?.b} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #5 [babel] format 1`] = ` +exports[`snippet: #5 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> (a.b())} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #6 [babel] format 1`] = ` +exports[`snippet: #6 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> a.b()} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #7 [babel] format 1`] = ` +exports[`snippet: #7 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> (a.b?.())} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #8 [babel] format 1`] = ` +exports[`snippet: #8 format 1`] = ` "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:39) > 1 | async function * a() { a |> foo(%) |> a.b?.()} | ^ Cause: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:38)" `; -exports[`snippet: #9 [babel] format 1`] = ` +exports[`snippet: #9 format 1`] = ` "Hack-style pipe body cannot be an unparenthesized yield expression; please wrap it in parentheses. (1:39) > 1 | async function * a() { a |> foo(%) |> yield} | ^ Cause: Hack-style pipe body cannot be an unparenthesized yield expression; please wrap it in parentheses. (1:38)" `; -exports[`v8intrinsic.js [babel] format 1`] = ` +exports[`v8intrinsic.js format 1`] = ` "Topic reference is unbound; it must be inside a pipe body. (1:16) > 1 | const status = %GetOptimizationStatus(fn) |> console.log(%); | ^ diff --git a/tests/format/misc/errors/js/hack-pipeline/format.test.js b/tests/format/js/_errors_/hack-pipeline/format.test.js similarity index 100% rename from tests/format/misc/errors/js/hack-pipeline/format.test.js rename to tests/format/js/_errors_/hack-pipeline/format.test.js diff --git a/tests/format/misc/errors/js/hack-pipeline/v8intrinsic.js b/tests/format/js/_errors_/hack-pipeline/v8intrinsic.js similarity index 100% rename from tests/format/misc/errors/js/hack-pipeline/v8intrinsic.js rename to tests/format/js/_errors_/hack-pipeline/v8intrinsic.js diff --git a/tests/format/misc/errors/js/html-like-comments.js b/tests/format/js/_errors_/html-like-comments.js similarity index 100% rename from tests/format/misc/errors/js/html-like-comments.js rename to tests/format/js/_errors_/html-like-comments.js diff --git a/tests/format/misc/errors/js/import-attributes-for-export-without-from.js b/tests/format/js/_errors_/import-attributes-for-export-without-from.js similarity index 100% rename from tests/format/misc/errors/js/import-attributes-for-export-without-from.js rename to tests/format/js/_errors_/import-attributes-for-export-without-from.js diff --git a/tests/format/misc/errors/js/import-attributes-with-parens.js b/tests/format/js/_errors_/import-attributes-with-parens.js similarity index 100% rename from tests/format/misc/errors/js/import-attributes-with-parens.js rename to tests/format/js/_errors_/import-attributes-with-parens.js diff --git a/tests/format/misc/errors/js/import/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/import/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/import/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/import/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/import/format.test.js b/tests/format/js/_errors_/import/format.test.js similarity index 100% rename from tests/format/misc/errors/js/import/format.test.js rename to tests/format/js/_errors_/import/format.test.js diff --git a/tests/format/misc/errors/js/invalid-escape-in-identifier-2.js b/tests/format/js/_errors_/invalid-escape-in-identifier-2.js similarity index 100% rename from tests/format/misc/errors/js/invalid-escape-in-identifier-2.js rename to tests/format/js/_errors_/invalid-escape-in-identifier-2.js diff --git a/tests/format/misc/errors/js/invalid-escape-in-identifier.js b/tests/format/js/_errors_/invalid-escape-in-identifier.js similarity index 100% rename from tests/format/misc/errors/js/invalid-escape-in-identifier.js rename to tests/format/js/_errors_/invalid-escape-in-identifier.js diff --git a/tests/format/misc/errors/invalid/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/invalid/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/invalid/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/invalid/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/invalid/format.test.js b/tests/format/js/_errors_/invalid/format.test.js similarity index 100% rename from tests/format/misc/errors/invalid/format.test.js rename to tests/format/js/_errors_/invalid/format.test.js diff --git a/tests/format/misc/errors/js/known-source-type/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/known-source-type/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/known-source-type/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/known-source-type/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/known-source-type/format.test.js b/tests/format/js/_errors_/known-source-type/format.test.js similarity index 100% rename from tests/format/misc/errors/js/known-source-type/format.test.js rename to tests/format/js/_errors_/known-source-type/format.test.js diff --git a/tests/format/misc/errors/js/literal/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/literal/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/literal/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/literal/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/literal/format.test.js b/tests/format/js/_errors_/literal/format.test.js similarity index 100% rename from tests/format/misc/errors/js/literal/format.test.js rename to tests/format/js/_errors_/literal/format.test.js diff --git a/tests/format/misc/errors/js/literal/invalid-exponent.js b/tests/format/js/_errors_/literal/invalid-exponent.js similarity index 100% rename from tests/format/misc/errors/js/literal/invalid-exponent.js rename to tests/format/js/_errors_/literal/invalid-exponent.js diff --git a/tests/format/misc/errors/js/module-attributes.js b/tests/format/js/_errors_/module-attributes.js similarity index 100% rename from tests/format/misc/errors/js/module-attributes.js rename to tests/format/js/_errors_/module-attributes.js diff --git a/tests/format/misc/errors/js/newline-before-arrow/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/newline-before-arrow/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/newline-before-arrow/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/newline-before-arrow/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/newline-before-arrow/format.test.js b/tests/format/js/_errors_/newline-before-arrow/format.test.js similarity index 100% rename from tests/format/misc/errors/js/newline-before-arrow/format.test.js rename to tests/format/js/_errors_/newline-before-arrow/format.test.js diff --git a/tests/format/misc/errors/js/newline-before-arrow/newline-before-arrow.js b/tests/format/js/_errors_/newline-before-arrow/newline-before-arrow.js similarity index 100% rename from tests/format/misc/errors/js/newline-before-arrow/newline-before-arrow.js rename to tests/format/js/_errors_/newline-before-arrow/newline-before-arrow.js diff --git a/tests/format/misc/errors/js/no-for-in-init-concise-binary-in.js b/tests/format/js/_errors_/no-for-in-init-concise-binary-in.js similarity index 100% rename from tests/format/misc/errors/js/no-for-in-init-concise-binary-in.js rename to tests/format/js/_errors_/no-for-in-init-concise-binary-in.js diff --git a/tests/format/misc/errors/js/object/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/object/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/object/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/object/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/object/format.test.js b/tests/format/js/_errors_/object/format.test.js similarity index 100% rename from tests/format/misc/errors/js/object/format.test.js rename to tests/format/js/_errors_/object/format.test.js diff --git a/tests/format/misc/errors/js/object/getter-generator.js b/tests/format/js/_errors_/object/getter-generator.js similarity index 100% rename from tests/format/misc/errors/js/object/getter-generator.js rename to tests/format/js/_errors_/object/getter-generator.js diff --git a/tests/format/misc/errors/js/object/getter-with-parameter.js b/tests/format/js/_errors_/object/getter-with-parameter.js similarity index 100% rename from tests/format/misc/errors/js/object/getter-with-parameter.js rename to tests/format/js/_errors_/object/getter-with-parameter.js diff --git a/tests/format/misc/errors/js/object/setter-generator.js b/tests/format/js/_errors_/object/setter-generator.js similarity index 100% rename from tests/format/misc/errors/js/object/setter-generator.js rename to tests/format/js/_errors_/object/setter-generator.js diff --git a/tests/format/misc/errors/js/object/setter-without-parameter.js b/tests/format/js/_errors_/object/setter-without-parameter.js similarity index 100% rename from tests/format/misc/errors/js/object/setter-without-parameter.js rename to tests/format/js/_errors_/object/setter-without-parameter.js diff --git a/tests/format/misc/errors/js/optional-chaining/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/optional-chaining/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/optional-chaining/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/optional-chaining/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/optional-chaining/format.test.js b/tests/format/js/_errors_/optional-chaining/format.test.js similarity index 100% rename from tests/format/misc/errors/js/optional-chaining/format.test.js rename to tests/format/js/_errors_/optional-chaining/format.test.js diff --git a/tests/format/misc/errors/js/partial-template-strings.js b/tests/format/js/_errors_/partial-template-strings.js similarity index 100% rename from tests/format/misc/errors/js/partial-template-strings.js rename to tests/format/js/_errors_/partial-template-strings.js diff --git a/tests/format/misc/errors/js/record/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/record/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/record/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/record/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/record/format.test.js b/tests/format/js/_errors_/record/format.test.js similarity index 100% rename from tests/format/misc/errors/js/record/format.test.js rename to tests/format/js/_errors_/record/format.test.js diff --git a/tests/format/misc/errors/js/regex-v-u-flags/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/regex-v-u-flags/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/regex-v-u-flags/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/regex-v-u-flags/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/regex-v-u-flags/format.test.js b/tests/format/js/_errors_/regex-v-u-flags/format.test.js similarity index 100% rename from tests/format/misc/errors/js/regex-v-u-flags/format.test.js rename to tests/format/js/_errors_/regex-v-u-flags/format.test.js diff --git a/tests/format/misc/errors/js/regex-v-u-flags/invalid-flags.js b/tests/format/js/_errors_/regex-v-u-flags/invalid-flags.js similarity index 100% rename from tests/format/misc/errors/js/regex-v-u-flags/invalid-flags.js rename to tests/format/js/_errors_/regex-v-u-flags/invalid-flags.js diff --git a/tests/format/misc/errors/js/regex-v-u-flags/invalid-flags2.js b/tests/format/js/_errors_/regex-v-u-flags/invalid-flags2.js similarity index 100% rename from tests/format/misc/errors/js/regex-v-u-flags/invalid-flags2.js rename to tests/format/js/_errors_/regex-v-u-flags/invalid-flags2.js diff --git a/tests/format/misc/errors/js/reserved-word/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/reserved-word/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/reserved-word/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/reserved-word/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/reserved-word/format.test.js b/tests/format/js/_errors_/reserved-word/format.test.js similarity index 100% rename from tests/format/misc/errors/js/reserved-word/format.test.js rename to tests/format/js/_errors_/reserved-word/format.test.js diff --git a/tests/format/misc/errors/js/static-import-source-should-not-has-extra-token.js b/tests/format/js/_errors_/static-import-source-should-not-has-extra-token.js similarity index 100% rename from tests/format/misc/errors/js/static-import-source-should-not-has-extra-token.js rename to tests/format/js/_errors_/static-import-source-should-not-has-extra-token.js diff --git a/tests/format/misc/errors/js/variable-declarator/__snapshots__/format.test.js.snap b/tests/format/js/_errors_/variable-declarator/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/js/variable-declarator/__snapshots__/format.test.js.snap rename to tests/format/js/_errors_/variable-declarator/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/js/variable-declarator/format.test.js b/tests/format/js/_errors_/variable-declarator/format.test.js similarity index 100% rename from tests/format/misc/errors/js/variable-declarator/format.test.js rename to tests/format/js/_errors_/variable-declarator/format.test.js diff --git a/tests/format/misc/errors/js/variable-declarator/invalid-const.js b/tests/format/js/_errors_/variable-declarator/invalid-const.js similarity index 100% rename from tests/format/misc/errors/js/variable-declarator/invalid-const.js rename to tests/format/js/_errors_/variable-declarator/invalid-const.js diff --git a/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap b/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap index 547da233a..81dfc4455 100644 --- a/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap +++ b/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap @@ -997,42 +997,6 @@ exports[`flow.js [babel] format 1`] = ` Cause: Unexpected token, expected "," (3:16)" `; -exports[`flow.js [babel-flow] format 1`] = ` -====================================options===================================== -parsers: ["babel", "babel-ts", "babel-flow"] -printWidth: 80 - | printWidth -=====================================input====================================== -// https://babeljs.io/docs/babel-preset-flow - -function foo(one: any, two: number, three?): string {} - -=====================================output===================================== -// https://babeljs.io/docs/babel-preset-flow - -function foo(one: any, two: number, three?): string {} - -================================================================================ -`; - -exports[`flow.js [babel-ts] format 1`] = ` -====================================options===================================== -parsers: ["babel", "babel-ts", "babel-flow"] -printWidth: 80 - | printWidth -=====================================input====================================== -// https://babeljs.io/docs/babel-preset-flow - -function foo(one: any, two: number, three?): string {} - -=====================================output===================================== -// https://babeljs.io/docs/babel-preset-flow - -function foo(one: any, two: number, three?): string {} - -================================================================================ -`; - exports[`flow.js [espree] format 1`] = ` "Unexpected token : (3:17) 1 | // https://babeljs.io/docs/babel-preset-flow @@ -1062,6 +1026,24 @@ exports[`flow.js [oxc] format 1`] = ` 4 |" `; +exports[`flow.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "babel-ts", "babel-flow"] +printWidth: 80 + | printWidth +=====================================input====================================== +// https://babeljs.io/docs/babel-preset-flow + +function foo(one: any, two: number, three?): string {} + +=====================================output===================================== +// https://babeljs.io/docs/babel-preset-flow + +function foo(one: any, two: number, three?): string {} + +================================================================================ +`; + exports[`function-bind.js [acorn] format 1`] = ` "Unexpected token (3:5) 1 | // https://babeljs.io/docs/babel-plugin-proposal-function-bind @@ -2523,42 +2505,6 @@ exports[`typescript.js [babel] format 1`] = ` Cause: Unexpected token (3:7)" `; -exports[`typescript.js [babel-flow] format 1`] = ` -====================================options===================================== -parsers: ["babel", "babel-ts", "babel-flow"] -printWidth: 80 - | printWidth -=====================================input====================================== -// https://babeljs.io/docs/babel-preset-typescript - -const x: number = 0; - -=====================================output===================================== -// https://babeljs.io/docs/babel-preset-typescript - -const x: number = 0; - -================================================================================ -`; - -exports[`typescript.js [babel-ts] format 1`] = ` -====================================options===================================== -parsers: ["babel", "babel-ts", "babel-flow"] -printWidth: 80 - | printWidth -=====================================input====================================== -// https://babeljs.io/docs/babel-preset-typescript - -const x: number = 0; - -=====================================output===================================== -// https://babeljs.io/docs/babel-preset-typescript - -const x: number = 0; - -================================================================================ -`; - exports[`typescript.js [espree] format 1`] = ` "Unexpected token : (3:8) 1 | // https://babeljs.io/docs/babel-preset-typescript @@ -2588,6 +2534,24 @@ exports[`typescript.js [oxc] format 1`] = ` 4 |" `; +exports[`typescript.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "babel-ts", "babel-flow"] +printWidth: 80 + | printWidth +=====================================input====================================== +// https://babeljs.io/docs/babel-preset-typescript + +const x: number = 0; + +=====================================output===================================== +// https://babeljs.io/docs/babel-preset-typescript + +const x: number = 0; + +================================================================================ +`; + exports[`v8intrinsic.js [acorn] format 1`] = ` "Unexpected token (3:1) 1 | // https://github.com/babel/babel/pull/10148 diff --git a/tests/format/misc/errors/json/__snapshots__/format.test.js.snap b/tests/format/json/_errors_/__snapshots__/format.test.js.snap similarity index 96% rename from tests/format/misc/errors/json/__snapshots__/format.test.js.snap rename to tests/format/json/_errors_/__snapshots__/format.test.js.snap index b8983897e..752b5c323 100644 --- a/tests/format/misc/errors/json/__snapshots__/format.test.js.snap +++ b/tests/format/json/_errors_/__snapshots__/format.test.js.snap @@ -7,13 +7,6 @@ exports[`snippet: #0 [json] format 1`] = ` `; exports[`snippet: #0 [json] format 2`] = ` -"A 'set' accessor must have exactly one formal parameter. (1:9) -> 1 | [class {set foo() {}}] - | ^ -Cause: A 'set' accessor must have exactly one formal parameter. (1:8)" -`; - -exports[`snippet: #0 [json] format 3`] = ` "Unexpected token (1:2) > 1 | [ | ^ @@ -53,6 +46,13 @@ exports[`snippet: #0 [jsonc] format 1`] = ` Cause: Unexpected token (1:1)" `; +exports[`snippet: #0 format 1`] = ` +"A 'set' accessor must have exactly one formal parameter. (1:9) +> 1 | [class {set foo() {}}] + | ^ +Cause: A 'set' accessor must have exactly one formal parameter. (1:8)" +`; + exports[`snippet: #1 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {["foo"]:"bar"} @@ -60,13 +60,6 @@ exports[`snippet: #1 [json] format 1`] = ` `; exports[`snippet: #1 [json] format 2`] = ` -"Private name #bar is not defined. (1:21) -> 1 | [class {foo() {this.#bar}}] - | ^ -Cause: Private name #bar is not defined. (1:20)" -`; - -exports[`snippet: #1 [json] format 3`] = ` "Unexpected token (1:1) > 1 | ; | ^ @@ -106,6 +99,13 @@ exports[`snippet: #1 [jsonc] format 1`] = ` Cause: Unexpected token (1:0)" `; +exports[`snippet: #1 format 1`] = ` +"Private name #bar is not defined. (1:21) +> 1 | [class {foo() {this.#bar}}] + | ^ +Cause: Private name #bar is not defined. (1:20)" +`; + exports[`snippet: #2 [json] format 1`] = ` "Operator '~' is not allowed in JSON. (1:9) > 1 | {"foo": ~1} @@ -113,13 +113,6 @@ exports[`snippet: #2 [json] format 1`] = ` `; exports[`snippet: #2 [json] format 2`] = ` -"'await' is only allowed within async functions and at the top levels of modules. (1:14) -> 1 | [function(){ await 1 }] - | ^ -Cause: 'await' is only allowed within async functions and at the top levels of modules. (1:13)" -`; - -exports[`snippet: #2 [json] format 3`] = ` "The input should contain exactly one expression, but the first expression is followed by the unexpected character \`;\`. (1:9) > 1 | "string"; | ^ @@ -159,6 +152,13 @@ exports[`snippet: #2 [jsonc] format 1`] = ` Cause: Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`;\`. (1:8)" `; +exports[`snippet: #2 format 1`] = ` +"'await' is only allowed within async functions and at the top levels of modules. (1:14) +> 1 | [function(){ await 1 }] + | ^ +Cause: 'await' is only allowed within async functions and at the top levels of modules. (1:13)" +`; + exports[`snippet: #3 [json] format 1`] = ` "'LogicalExpression' is not allowed in JSON. (1:9) > 1 | {"foo": false || "bar"} @@ -166,12 +166,6 @@ exports[`snippet: #3 [json] format 1`] = ` `; exports[`snippet: #3 [json] format 2`] = ` -"Unexpected token. (1:2) -> 1 | [do {}] - | ^" -`; - -exports[`snippet: #3 [json] format 3`] = ` "The input should contain exactly one expression, but the first expression is followed by the unexpected character \`;\`. (2:1) 1 | "string" > 2 | ; @@ -215,6 +209,12 @@ exports[`snippet: #3 [jsonc] format 1`] = ` Cause: Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`;\`. (2:0)" `; +exports[`snippet: #3 format 1`] = ` +"Unexpected token. (1:2) +> 1 | [do {}] + | ^" +`; + exports[`snippet: #4 [json] format 1`] = ` "'ArrowFunctionExpression' is not allowed in JSON. (1:9) > 1 | {"foo": () => {}} @@ -222,13 +222,6 @@ exports[`snippet: #4 [json] format 1`] = ` `; exports[`snippet: #4 [json] format 2`] = ` -"'import' and 'export' may only appear at the top level. (1:14) -> 1 | [function() {export a from 'a'}] - | ^ -Cause: 'import' and 'export' may only appear at the top level. (1:13)" -`; - -exports[`snippet: #4 [json] format 3`] = ` "Unexpected token (1:15) > 1 | /* comment */[ | ^ @@ -268,6 +261,13 @@ exports[`snippet: #4 [jsonc] format 1`] = ` Cause: Unexpected token (1:14)" `; +exports[`snippet: #4 format 1`] = ` +"'import' and 'export' may only appear at the top level. (1:14) +> 1 | [function() {export a from 'a'}] + | ^ +Cause: 'import' and 'export' may only appear at the top level. (1:13)" +`; + exports[`snippet: #5 [json] format 1`] = ` "Expecting Unicode escape sequence \\uXXXX. (1:10) > 1 | packages\\the-hub\\cypress\\fixtures\\gridConfiguration.json @@ -276,13 +276,6 @@ Cause: Expecting Unicode escape sequence \\uXXXX. (1:9)" `; exports[`snippet: #5 [json] format 2`] = ` -"Unexpected token (1:1) -> 1 | export a from 'a' - | ^ -Cause: Unexpected token (1:0)" -`; - -exports[`snippet: #5 [json] format 3`] = ` "Unexpected token (1:14) > 1 | /* comment */; | ^ @@ -324,6 +317,13 @@ exports[`snippet: #5 [jsonc] format 1`] = ` Cause: Unexpected token (1:13)" `; +exports[`snippet: #5 format 1`] = ` +"Unexpected token (1:1) +> 1 | export a from 'a' + | ^ +Cause: Unexpected token (1:0)" +`; + exports[`snippet: #6 [json] format 1`] = ` "'BinaryExpression' is not allowed in JSON. (1:1) > 1 | 1+2 @@ -331,13 +331,6 @@ exports[`snippet: #6 [json] format 1`] = ` `; exports[`snippet: #6 [json] format 2`] = ` -"Unexpected token, expected "," (1:3) -> 1 | [a::b] - | ^ -Cause: Unexpected token, expected "," (1:2)" -`; - -exports[`snippet: #6 [json] format 3`] = ` "The input should contain exactly one expression, but the first expression is followed by the unexpected character \`;\`. (1:22) > 1 | /* comment */"string"; | ^ @@ -377,6 +370,13 @@ exports[`snippet: #6 [jsonc] format 1`] = ` Cause: Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`;\`. (1:21)" `; +exports[`snippet: #6 format 1`] = ` +"Unexpected token, expected "," (1:3) +> 1 | [a::b] + | ^ +Cause: Unexpected token, expected "," (1:2)" +`; + exports[`snippet: #7 [json] format 1`] = ` "Shorthand property is not allowed in JSON. (1:2) > 1 | {Infinity} @@ -384,12 +384,6 @@ exports[`snippet: #7 [json] format 1`] = ` `; exports[`snippet: #7 [json] format 2`] = ` -"Unexpected token. (1:24) -> 1 | [function*() {function.sent}] - | ^" -`; - -exports[`snippet: #7 [json] format 3`] = ` "The input should contain exactly one expression, but the first expression is followed by the unexpected character \`;\`. (2:1) 1 | /* comment */"string" > 2 | ; @@ -433,6 +427,12 @@ exports[`snippet: #7 [jsonc] format 1`] = ` Cause: Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`;\`. (2:0)" `; +exports[`snippet: #7 format 1`] = ` +"Unexpected token. (1:24) +> 1 | [function*() {function.sent}] + | ^" +`; + exports[`snippet: #8 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[key]: 1} @@ -440,12 +440,6 @@ exports[`snippet: #8 [json] format 1`] = ` `; exports[`snippet: #8 [json] format 2`] = ` -"Unexpected token. (1:2) -> 1 | [throw {}] - | ^" -`; - -exports[`snippet: #8 [json] format 3`] = ` "Unexpected token (1:1) > 1 | #!/usr/bin/env node | ^ @@ -485,6 +479,12 @@ exports[`snippet: #8 [jsonc] format 1`] = ` Cause: Unexpected token (1:0)" `; +exports[`snippet: #8 format 1`] = ` +"Unexpected token. (1:2) +> 1 | [throw {}] + | ^" +`; + exports[`snippet: #9 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[key()]: 1} @@ -492,12 +492,6 @@ exports[`snippet: #9 [json] format 1`] = ` `; exports[`snippet: #9 [json] format 2`] = ` -"Unexpected token. (1:6) -> 1 | [foo(?)] - | ^" -`; - -exports[`snippet: #9 [json] format 3`] = ` "Unexpected token (1:1) > 1 | #!/usr/bin/env node | ^ @@ -541,18 +535,18 @@ exports[`snippet: #9 [jsonc] format 1`] = ` Cause: Unexpected token (1:0)" `; +exports[`snippet: #9 format 1`] = ` +"Unexpected token. (1:6) +> 1 | [foo(?)] + | ^" +`; + exports[`snippet: #10 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {['CallExpression']: 1} | ^^^^^^^^^^^^^^^^" `; -exports[`snippet: #10 [json] format 2`] = ` -"Unexpected token. (1:2) -> 1 | [@decorator class {}] - | ^" -`; - exports[`snippet: #10 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {['CallExpression']: 1} @@ -565,18 +559,18 @@ exports[`snippet: #10 [json5] format 1`] = ` | ^^^^^^^^^^^^^^^^" `; +exports[`snippet: #10 format 1`] = ` +"Unexpected token. (1:2) +> 1 | [@decorator class {}] + | ^" +`; + exports[`snippet: #11 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {['StringLiteral']: 1} | ^^^^^^^^^^^^^^^" `; -exports[`snippet: #11 [json] format 2`] = ` -"'ImportExpression' is not allowed in JSON. (1:2) -> 1 | [import('a', {type:'json'})] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^" -`; - exports[`snippet: #11 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {['StringLiteral']: 1} @@ -589,19 +583,18 @@ exports[`snippet: #11 [json5] format 1`] = ` | ^^^^^^^^^^^^^^^" `; +exports[`snippet: #11 format 1`] = ` +"'ImportExpression' is not allowed in JSON. (1:2) +> 1 | [import('a', {type:'json'})] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^" +`; + exports[`snippet: #12 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {['string']: 1} | ^^^^^^^^" `; -exports[`snippet: #12 [json] format 2`] = ` -"Identifier directly after number. (1:3) -> 1 | [1m] - | ^ -Cause: Identifier directly after number. (1:2)" -`; - exports[`snippet: #12 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {['string']: 1} @@ -614,18 +607,19 @@ exports[`snippet: #12 [json5] format 1`] = ` | ^^^^^^^^" `; +exports[`snippet: #12 format 1`] = ` +"Identifier directly after number. (1:3) +> 1 | [1m] + | ^ +Cause: Identifier directly after number. (1:2)" +`; + exports[`snippet: #13 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[1]: 1} | ^" `; -exports[`snippet: #13 [json] format 2`] = ` -"Unexpected token. (1:2) -> 1 | [module {}] - | ^" -`; - exports[`snippet: #13 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[1]: 1} @@ -638,18 +632,18 @@ exports[`snippet: #13 [json5] format 1`] = ` | ^" `; +exports[`snippet: #13 format 1`] = ` +"Unexpected token. (1:2) +> 1 | [module {}] + | ^" +`; + exports[`snippet: #14 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[Infinity]: 1} | ^^^^^^^^" `; -exports[`snippet: #14 [json] format 2`] = ` -"Unexpected token. (1:8) -> 1 | [async do {}] - | ^" -`; - exports[`snippet: #14 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[Infinity]: 1} @@ -662,18 +656,18 @@ exports[`snippet: #14 [json5] format 1`] = ` | ^^^^^^^^" `; +exports[`snippet: #14 format 1`] = ` +"Unexpected token. (1:8) +> 1 | [async do {}] + | ^" +`; + exports[`snippet: #15 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[-Infinity]: 1} | ^^^^^^^^^" `; -exports[`snippet: #15 [json] format 2`] = ` -"'RegExpLiteral' is not allowed in JSON. (1:2) -> 1 | [/a/v] - | ^^^^" -`; - exports[`snippet: #15 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[-Infinity]: 1} @@ -686,18 +680,18 @@ exports[`snippet: #15 [json5] format 1`] = ` | ^^^^^^^^^" `; +exports[`snippet: #15 format 1`] = ` +"'RegExpLiteral' is not allowed in JSON. (1:2) +> 1 | [/a/v] + | ^^^^" +`; + exports[`snippet: #16 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[{key: 'value'}]: 1} | ^^^^^^^^^^^^^^" `; -exports[`snippet: #16 [json] format 2`] = ` -"Unexpected token. (1:28) -> 1 | [class {#foo;bar() {const {#foo: foo} = this;}}] - | ^" -`; - exports[`snippet: #16 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[{key: 'value'}]: 1} @@ -710,18 +704,18 @@ exports[`snippet: #16 [json5] format 1`] = ` | ^^^^^^^^^^^^^^" `; +exports[`snippet: #16 format 1`] = ` +"Unexpected token. (1:28) +> 1 | [class {#foo;bar() {const {#foo: foo} = this;}}] + | ^" +`; + exports[`snippet: #17 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[[]]: 1} | ^^" `; -exports[`snippet: #17 [json] format 2`] = ` -"Unexpected token. (1:18) -> 1 | [class {accessor foo = 1}] - | ^" -`; - exports[`snippet: #17 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[[]]: 1} @@ -734,18 +728,18 @@ exports[`snippet: #17 [json5] format 1`] = ` | ^^" `; +exports[`snippet: #17 format 1`] = ` +"Unexpected token. (1:18) +> 1 | [class {accessor foo = 1}] + | ^" +`; + exports[`snippet: #18 [json] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[null]: 1} | ^^^^" `; -exports[`snippet: #18 [json] format 2`] = ` -"'ImportExpression' is not allowed in JSON. (1:2) -> 1 | [import('a', {reflect: 'module'})] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" -`; - exports[`snippet: #18 [json-stringify] format 1`] = ` "Computed key is not allowed in JSON. (1:3) > 1 | {[null]: 1} @@ -758,19 +752,18 @@ exports[`snippet: #18 [json5] format 1`] = ` | ^^^^" `; +exports[`snippet: #18 format 1`] = ` +"'ImportExpression' is not allowed in JSON. (1:2) +> 1 | [import('a', {reflect: 'module'})] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" +`; + exports[`snippet: #19 [json] format 1`] = ` "Operator '+' before 'CallExpression' is not allowed in JSON. (1:8) > 1 | {key: +foo()} | ^^^^^" `; -exports[`snippet: #19 [json] format 2`] = ` -"\`import\` can only be used in \`import()\` or \`import.meta\`. (1:1) -> 1 | import module a from 'a' - | ^ -Cause: \`import\` can only be used in \`import()\` or \`import.meta\`. (1:0)" -`; - exports[`snippet: #19 [json-stringify] format 1`] = ` "Operator '+' before 'CallExpression' is not allowed in JSON. (1:8) > 1 | {key: +foo()} @@ -783,18 +776,19 @@ exports[`snippet: #19 [json5] format 1`] = ` | ^^^^^" `; +exports[`snippet: #19 format 1`] = ` +"\`import\` can only be used in \`import()\` or \`import.meta\`. (1:1) +> 1 | import module a from 'a' + | ^ +Cause: \`import\` can only be used in \`import()\` or \`import.meta\`. (1:0)" +`; + exports[`snippet: #20 [json] format 1`] = ` "Operator 'void' is not allowed in JSON. (1:7) > 1 | {key: void foo()} | ^^^^^^^^^^" `; -exports[`snippet: #20 [json] format 2`] = ` -"'FunctionExpression' is not allowed in JSON. (1:2) -> 1 | [function() { {using a = b} }] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^" -`; - exports[`snippet: #20 [json-stringify] format 1`] = ` "Operator 'void' is not allowed in JSON. (1:7) > 1 | {key: void foo()} @@ -807,6 +801,12 @@ exports[`snippet: #20 [json5] format 1`] = ` | ^^^^^^^^^^" `; +exports[`snippet: #20 format 1`] = ` +"'FunctionExpression' is not allowed in JSON. (1:2) +> 1 | [function() { {using a = b} }] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^" +`; + exports[`snippet: #21 [json] format 1`] = ` "Unexpected token (1:1) > 1 | #!/usr/bin/env node @@ -815,13 +815,6 @@ exports[`snippet: #21 [json] format 1`] = ` Cause: Unexpected token (1:0)" `; -exports[`snippet: #21 [json] format 2`] = ` -"Unexpected token, expected "," (1:8) -> 1 | {using a = b} - | ^ -Cause: Unexpected token, expected "," (1:7)" -`; - exports[`snippet: #21 [json-stringify] format 1`] = ` "Unexpected token (1:1) > 1 | #!/usr/bin/env node @@ -838,6 +831,13 @@ exports[`snippet: #21 [json5] format 1`] = ` Cause: Unexpected token (1:0)" `; +exports[`snippet: #21 format 1`] = ` +"Unexpected token, expected "," (1:8) +> 1 | {using a = b} + | ^ +Cause: Unexpected token, expected "," (1:7)" +`; + exports[`snippet: #22 [json] format 1`] = ` "The input should contain exactly one expression, but the first expression is followed by the unexpected character \`{\`. (2:1) 1 | "use strict" @@ -846,13 +846,6 @@ exports[`snippet: #22 [json] format 1`] = ` Cause: Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`{\`. (2:0)" `; -exports[`snippet: #22 [json] format 2`] = ` -"Unexpected token (1:2) -> 1 | [#[]] - | ^ -Cause: Unexpected token (1:1)" -`; - exports[`snippet: #22 [json-stringify] format 1`] = ` "The input should contain exactly one expression, but the first expression is followed by the unexpected character \`{\`. (2:1) 1 | "use strict" @@ -869,6 +862,13 @@ exports[`snippet: #22 [json5] format 1`] = ` Cause: Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`{\`. (2:0)" `; +exports[`snippet: #22 format 1`] = ` +"Unexpected token (1:2) +> 1 | [#[]] + | ^ +Cause: Unexpected token (1:1)" +`; + exports[`snippet: #23 [json] format 1`] = ` "The input is empty or contains only comments. (1:14) > 1 | /* comment */ @@ -876,13 +876,6 @@ exports[`snippet: #23 [json] format 1`] = ` Cause: Unexpected parseExpression() input: The input is empty or contains only comments. (1:13)" `; -exports[`snippet: #23 [json] format 2`] = ` -"Unexpected token (1:2) -> 1 | [#{}] - | ^ -Cause: Unexpected token (1:1)" -`; - exports[`snippet: #23 [json-stringify] format 1`] = ` "The input is empty or contains only comments. (1:14) > 1 | /* comment */ @@ -897,6 +890,13 @@ exports[`snippet: #23 [json5] format 1`] = ` Cause: Unexpected parseExpression() input: The input is empty or contains only comments. (1:13)" `; +exports[`snippet: #23 format 1`] = ` +"Unexpected token (1:2) +> 1 | [#{}] + | ^ +Cause: Unexpected token (1:1)" +`; + exports[`snippet: #24 [json] format 1`] = ` "The input is empty or contains only comments. (1:11) > 1 | // comment @@ -904,12 +904,6 @@ exports[`snippet: #24 [json] format 1`] = ` Cause: Unexpected parseExpression() input: The input is empty or contains only comments. (1:10)" `; -exports[`snippet: #24 [json] format 2`] = ` -"'BinaryExpression' is not allowed in JSON. (1:2) -> 1 | [foo%bar()] - | ^^^^^^^^^" -`; - exports[`snippet: #24 [json-stringify] format 1`] = ` "The input is empty or contains only comments. (1:11) > 1 | // comment @@ -924,18 +918,18 @@ exports[`snippet: #24 [json5] format 1`] = ` Cause: Unexpected parseExpression() input: The input is empty or contains only comments. (1:10)" `; +exports[`snippet: #24 format 1`] = ` +"'BinaryExpression' is not allowed in JSON. (1:2) +> 1 | [foo%bar()] + | ^^^^^^^^^" +`; + exports[`snippet: #25 [json] format 1`] = ` "'TemplateLiteral' with expression is not allowed in JSON. (1:7) > 1 | \`foo\${1}bar\` | ^" `; -exports[`snippet: #25 [json] format 2`] = ` -"Unexpected token. (1:8) -> 1 | ['foo' |> bar] - | ^" -`; - exports[`snippet: #25 [json-stringify] format 1`] = ` "'TemplateLiteral' with expression is not allowed in JSON. (1:7) > 1 | \`foo\${1}bar\` @@ -948,18 +942,18 @@ exports[`snippet: #25 [json5] format 1`] = ` | ^" `; +exports[`snippet: #25 format 1`] = ` +"Unexpected token. (1:8) +> 1 | ['foo' |> bar] + | ^" +`; + exports[`snippet: #26 [json] format 1`] = ` "Operator '-' before 'UnaryExpression' is not allowed in JSON. (1:2) > 1 | -+1 | ^^" `; -exports[`snippet: #26 [json] format 2`] = ` -"Unexpected token. (1:8) -> 1 | ['foo' |> bar(%)] - | ^" -`; - exports[`snippet: #26 [json-stringify] format 1`] = ` "Operator '-' before 'UnaryExpression' is not allowed in JSON. (1:2) > 1 | -+1 @@ -972,18 +966,18 @@ exports[`snippet: #26 [json5] format 1`] = ` | ^^" `; +exports[`snippet: #26 format 1`] = ` +"Unexpected token. (1:8) +> 1 | ['foo' |> bar(%)] + | ^" +`; + exports[`snippet: #27 [json] format 1`] = ` "Operator '-' before 'UnaryExpression' is not allowed in JSON. (1:2) > 1 | -+Infinity | ^^^^^^^^^" `; -exports[`snippet: #27 [json] format 2`] = ` -"Unexpected token. (1:2) -> 1 | [] - | ^" -`; - exports[`snippet: #27 [json-stringify] format 1`] = ` "Operator '-' before 'UnaryExpression' is not allowed in JSON. (1:2) > 1 | -+Infinity @@ -996,6 +990,12 @@ exports[`snippet: #27 [json5] format 1`] = ` | ^^^^^^^^^" `; +exports[`snippet: #27 format 1`] = ` +"Unexpected token. (1:2) +> 1 | [] + | ^" +`; + exports[`snippet: #28 [json] format 1`] = ` "Operator '-' before 'Identifier' is not allowed in JSON. (1:2) > 1 | -undefined diff --git a/tests/format/misc/errors/json/format.test.js b/tests/format/json/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/json/format.test.js rename to tests/format/json/_errors_/format.test.js diff --git a/tests/format/misc/errors/json/json-stringify/__snapshots__/format.test.js.snap b/tests/format/json/_errors_/json-stringify/__snapshots__/format.test.js.snap similarity index 68% rename from tests/format/misc/errors/json/json-stringify/__snapshots__/format.test.js.snap rename to tests/format/json/_errors_/json-stringify/__snapshots__/format.test.js.snap index 885d71f36..9e18c924a 100644 --- a/tests/format/misc/errors/json/json-stringify/__snapshots__/format.test.js.snap +++ b/tests/format/json/_errors_/json-stringify/__snapshots__/format.test.js.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`snippet: #0 [json-stringify] format 1`] = ` +exports[`snippet: #0 format 1`] = ` "Comment is not allowed in JSON. (1:1) > 1 | /* comment */{"foo": 1} | ^^^^^^^^^^^^^" `; -exports[`snippet: #1 [json-stringify] format 1`] = ` +exports[`snippet: #1 format 1`] = ` "Comment is not allowed in JSON. (1:1) > 1 | // comment | ^^^^^^^^^^ 2 | {"foo": 1}" `; -exports[`snippet: #2 [json-stringify] format 1`] = ` +exports[`snippet: #2 format 1`] = ` "Comment is not allowed in JSON. (1:9) > 1 | {"foo": /* comment */ 1} | ^^^^^^^^^^^^^" diff --git a/tests/format/misc/errors/json/json-stringify/format.test.js b/tests/format/json/_errors_/json-stringify/format.test.js similarity index 100% rename from tests/format/misc/errors/json/json-stringify/format.test.js rename to tests/format/json/_errors_/json-stringify/format.test.js diff --git a/tests/format/misc/errors/jsx/invalid-jsx-text/__snapshots__/format.test.js.snap b/tests/format/jsx/_errors_/invalid-jsx-text/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/jsx/invalid-jsx-text/__snapshots__/format.test.js.snap rename to tests/format/jsx/_errors_/invalid-jsx-text/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/jsx/invalid-jsx-text/format.test.js b/tests/format/jsx/_errors_/invalid-jsx-text/format.test.js similarity index 100% rename from tests/format/misc/errors/jsx/invalid-jsx-text/format.test.js rename to tests/format/jsx/_errors_/invalid-jsx-text/format.test.js diff --git a/tests/format/misc/errors/jsx/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap b/tests/format/jsx/_errors_/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/jsx/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap rename to tests/format/jsx/_errors_/unparenthesized-sequence-expression/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/jsx/unparenthesized-sequence-expression/format.test.js b/tests/format/jsx/_errors_/unparenthesized-sequence-expression/format.test.js similarity index 100% rename from tests/format/misc/errors/jsx/unparenthesized-sequence-expression/format.test.js rename to tests/format/jsx/_errors_/unparenthesized-sequence-expression/format.test.js diff --git a/tests/format/misc/errors/less/__snapshots__/format.test.js.snap b/tests/format/less/_errors_/__snapshots__/format.test.js.snap similarity index 77% rename from tests/format/misc/errors/less/__snapshots__/format.test.js.snap rename to tests/format/less/_errors_/__snapshots__/format.test.js.snap index 98622a31e..1539f6042 100644 --- a/tests/format/misc/errors/less/__snapshots__/format.test.js.snap +++ b/tests/format/less/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`inline-comment.less [less] format 1`] = ` +exports[`inline-comment.less format 1`] = ` "CssSyntaxError: Unknown word inline (5:4) 3 | a{ 4 | prop @@ -12,7 +12,7 @@ exports[`inline-comment.less [less] format 1`] = ` Cause: :5:4: Unknown word inline" `; -exports[`open-double-quote.less [less] format 1`] = ` +exports[`open-double-quote.less format 1`] = ` "CssSyntaxError: Unclosed string (2:17) 1 | a { > 2 | background: url(" @@ -22,7 +22,7 @@ exports[`open-double-quote.less [less] format 1`] = ` Cause: :2:17: Unclosed string" `; -exports[`open-sigle-quote.less [less] format 1`] = ` +exports[`open-sigle-quote.less format 1`] = ` "CssSyntaxError: Unclosed string (2:17) 1 | a { > 2 | background: url(' @@ -32,7 +32,7 @@ exports[`open-sigle-quote.less [less] format 1`] = ` Cause: :2:17: Unclosed string" `; -exports[`scss-syntax.scss [less] format 1`] = ` +exports[`scss-syntax.scss format 1`] = ` "CssSyntaxError: Unknown word $foo (1:15) > 1 | a {content: #{$foo}} | ^ diff --git a/tests/format/misc/errors/less/format.test.js b/tests/format/less/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/less/format.test.js rename to tests/format/less/_errors_/format.test.js diff --git a/tests/format/misc/errors/less/inline-comment.less b/tests/format/less/_errors_/inline-comment.less similarity index 100% rename from tests/format/misc/errors/less/inline-comment.less rename to tests/format/less/_errors_/inline-comment.less diff --git a/tests/format/misc/errors/less/open-double-quote.less b/tests/format/less/_errors_/open-double-quote.less similarity index 100% rename from tests/format/misc/errors/less/open-double-quote.less rename to tests/format/less/_errors_/open-double-quote.less diff --git a/tests/format/misc/errors/less/open-sigle-quote.less b/tests/format/less/_errors_/open-sigle-quote.less similarity index 100% rename from tests/format/misc/errors/less/open-sigle-quote.less rename to tests/format/less/_errors_/open-sigle-quote.less diff --git a/tests/format/misc/errors/less/scss-syntax.scss b/tests/format/less/_errors_/scss-syntax.scss similarity index 100% rename from tests/format/misc/errors/less/scss-syntax.scss rename to tests/format/less/_errors_/scss-syntax.scss diff --git a/tests/format/misc/_errors_/broken-plugin/__snapshots__/format.test.js.snap b/tests/format/misc/_errors_/broken-plugin/__snapshots__/format.test.js.snap new file mode 100644 index 000000000..68f64290e --- /dev/null +++ b/tests/format/misc/_errors_/broken-plugin/__snapshots__/format.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`snippet: #0 format 1`] = `"Comment "comment" was not printed. Please report this error!"`; diff --git a/tests/format/misc/errors/broken-plugin/format.test.js b/tests/format/misc/_errors_/broken-plugin/format.test.js similarity index 100% rename from tests/format/misc/errors/broken-plugin/format.test.js rename to tests/format/misc/_errors_/broken-plugin/format.test.js diff --git a/tests/format/misc/errors/front-matter/__snapshots__/format.test.js.snap b/tests/format/misc/_errors_/front-matter/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/front-matter/__snapshots__/format.test.js.snap rename to tests/format/misc/_errors_/front-matter/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/front-matter/format.test.js b/tests/format/misc/_errors_/front-matter/format.test.js similarity index 100% rename from tests/format/misc/errors/front-matter/format.test.js rename to tests/format/misc/_errors_/front-matter/format.test.js diff --git a/tests/format/misc/embedded_language_formatting/in-html/__snapshots__/format.test.js.snap b/tests/format/misc/embedded-language-formatting/in-html/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-html/__snapshots__/format.test.js.snap rename to tests/format/misc/embedded-language-formatting/in-html/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/embedded_language_formatting/in-html/format.test.js b/tests/format/misc/embedded-language-formatting/in-html/format.test.js similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-html/format.test.js rename to tests/format/misc/embedded-language-formatting/in-html/format.test.js diff --git a/tests/format/misc/embedded_language_formatting/in-html/front-matter-toml.html b/tests/format/misc/embedded-language-formatting/in-html/front-matter-toml.html similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-html/front-matter-toml.html rename to tests/format/misc/embedded-language-formatting/in-html/front-matter-toml.html diff --git a/tests/format/misc/embedded_language_formatting/in-html/front-matter-yaml.html b/tests/format/misc/embedded-language-formatting/in-html/front-matter-yaml.html similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-html/front-matter-yaml.html rename to tests/format/misc/embedded-language-formatting/in-html/front-matter-yaml.html diff --git a/tests/format/misc/embedded_language_formatting/in-html/test.html b/tests/format/misc/embedded-language-formatting/in-html/test.html similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-html/test.html rename to tests/format/misc/embedded-language-formatting/in-html/test.html diff --git a/tests/format/misc/embedded_language_formatting/in-javascript/__snapshots__/format.test.js.snap b/tests/format/misc/embedded-language-formatting/in-javascript/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-javascript/__snapshots__/format.test.js.snap rename to tests/format/misc/embedded-language-formatting/in-javascript/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/embedded_language_formatting/in-javascript/format.test.js b/tests/format/misc/embedded-language-formatting/in-javascript/format.test.js similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-javascript/format.test.js rename to tests/format/misc/embedded-language-formatting/in-javascript/format.test.js diff --git a/tests/format/misc/embedded_language_formatting/in-javascript/test.js b/tests/format/misc/embedded-language-formatting/in-javascript/test.js similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-javascript/test.js rename to tests/format/misc/embedded-language-formatting/in-javascript/test.js diff --git a/tests/format/misc/embedded_language_formatting/in-markdown/__snapshots__/format.test.js.snap b/tests/format/misc/embedded-language-formatting/in-markdown/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-markdown/__snapshots__/format.test.js.snap rename to tests/format/misc/embedded-language-formatting/in-markdown/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/embedded_language_formatting/in-markdown/format.test.js b/tests/format/misc/embedded-language-formatting/in-markdown/format.test.js similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-markdown/format.test.js rename to tests/format/misc/embedded-language-formatting/in-markdown/format.test.js diff --git a/tests/format/misc/embedded_language_formatting/in-markdown/front-matter-json.md b/tests/format/misc/embedded-language-formatting/in-markdown/front-matter-json.md similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-markdown/front-matter-json.md rename to tests/format/misc/embedded-language-formatting/in-markdown/front-matter-json.md diff --git a/tests/format/misc/embedded_language_formatting/in-markdown/front-matter-pandoc.md b/tests/format/misc/embedded-language-formatting/in-markdown/front-matter-pandoc.md similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-markdown/front-matter-pandoc.md rename to tests/format/misc/embedded-language-formatting/in-markdown/front-matter-pandoc.md diff --git a/tests/format/misc/embedded_language_formatting/in-markdown/issue-16342.md b/tests/format/misc/embedded-language-formatting/in-markdown/issue-16342.md similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-markdown/issue-16342.md rename to tests/format/misc/embedded-language-formatting/in-markdown/issue-16342.md diff --git a/tests/format/misc/embedded_language_formatting/in-markdown/test.md b/tests/format/misc/embedded-language-formatting/in-markdown/test.md similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-markdown/test.md rename to tests/format/misc/embedded-language-formatting/in-markdown/test.md diff --git a/tests/format/misc/embedded_language_formatting/in-vue/__snapshots__/format.test.js.snap b/tests/format/misc/embedded-language-formatting/in-vue/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-vue/__snapshots__/format.test.js.snap rename to tests/format/misc/embedded-language-formatting/in-vue/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/embedded_language_formatting/in-vue/format.test.js b/tests/format/misc/embedded-language-formatting/in-vue/format.test.js similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-vue/format.test.js rename to tests/format/misc/embedded-language-formatting/in-vue/format.test.js diff --git a/tests/format/misc/embedded_language_formatting/in-vue/in.vue b/tests/format/misc/embedded-language-formatting/in-vue/in.vue similarity index 100% rename from tests/format/misc/embedded_language_formatting/in-vue/in.vue rename to tests/format/misc/embedded-language-formatting/in-vue/in.vue diff --git a/tests/format/misc/embedded_language_formatting/mdx/__snapshots__/format.test.js.snap b/tests/format/misc/embedded-language-formatting/mdx/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/embedded_language_formatting/mdx/__snapshots__/format.test.js.snap rename to tests/format/misc/embedded-language-formatting/mdx/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/embedded_language_formatting/mdx/format.test.js b/tests/format/misc/embedded-language-formatting/mdx/format.test.js similarity index 100% rename from tests/format/misc/embedded_language_formatting/mdx/format.test.js rename to tests/format/misc/embedded-language-formatting/mdx/format.test.js diff --git a/tests/format/misc/embedded_language_formatting/mdx/import-export.mdx b/tests/format/misc/embedded-language-formatting/mdx/import-export.mdx similarity index 100% rename from tests/format/misc/embedded_language_formatting/mdx/import-export.mdx rename to tests/format/misc/embedded-language-formatting/mdx/import-export.mdx diff --git a/tests/format/misc/embedded_language_formatting/mdx/jsx.mdx b/tests/format/misc/embedded-language-formatting/mdx/jsx.mdx similarity index 100% rename from tests/format/misc/embedded_language_formatting/mdx/jsx.mdx rename to tests/format/misc/embedded-language-formatting/mdx/jsx.mdx diff --git a/tests/format/misc/errors/broken-plugin/__snapshots__/format.test.js.snap b/tests/format/misc/errors/broken-plugin/__snapshots__/format.test.js.snap deleted file mode 100644 index 4e3102b01..000000000 --- a/tests/format/misc/errors/broken-plugin/__snapshots__/format.test.js.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`snippet: #0 [missing-comments] format 1`] = `"Comment "comment" was not printed. Please report this error!"`; diff --git a/tests/format/misc/parser-inference/format.test.js b/tests/format/misc/parser-inference/format.test.js index f773cc0d8..401716046 100644 --- a/tests/format/misc/parser-inference/format.test.js +++ b/tests/format/misc/parser-inference/format.test.js @@ -1,54 +1,60 @@ import { outdent } from "outdent"; -runFormatTest({ - importMeta: import.meta, - snippets: [ - { - name: ".prettierrc in json(empty)", - filename: ".prettierrc", - code: "{}", - }, - { - name: ".prettierrc in json", - filename: "path/to/.prettierrc", - code: outdent` - {"printWidth": 100, - "overrides": [ - {"files": ".prettierrc", - "options": {"parser": "json" - }}, - {"files": "*.js", - "options": {"parser": "babel", - "singleQuote": true,"printWidth": 80,"semi": - false, - "quoteProps": "as-needed" - }} - ]} - `, - }, - { - name: ".prettierrc in yaml", - filename: ".prettierrc", - code: outdent` - # comment - printWidth: 100 - overrides: - - files: '.prettierrc' - options: - parser: "json" - `, - }, - { - name: ".prettierrc in yaml (with flowMapping)", - filename: ".prettierrc", - code: outdent` - # comment - printWidth: 100 - overrides: { - "files": [".prettierrc", "prettierrc.json"], - "options": { "parser": "json"} - } - `, - }, +runFormatTest( + { + importMeta: import.meta, + snippets: [ + { + name: ".prettierrc in json(empty)", + filename: ".prettierrc", + code: "{}", + }, + { + name: ".prettierrc in json", + filename: "path/to/.prettierrc", + code: outdent` + {"printWidth": 100, + "overrides": [ + {"files": ".prettierrc", + "options": {"parser": "json" + }}, + {"files": "*.js", + "options": {"parser": "babel", + "singleQuote": true,"printWidth": 80,"semi": + false, + "quoteProps": "as-needed" + }} + ]} + `, + }, + { + name: ".prettierrc in yaml", + filename: ".prettierrc", + code: outdent` + # comment + printWidth: 100 + overrides: + - files: '.prettierrc' + options: + parser: "json" + `, + }, + { + name: ".prettierrc in yaml (with flowMapping)", + filename: ".prettierrc", + code: outdent` + # comment + printWidth: 100 + overrides: { + "files": [".prettierrc", "prettierrc.json"], + "options": { "parser": "json"} + } + `, + }, + ], + }, + [ + // don't set parser in options + undefined, ], -}); +); diff --git a/tests/format/misc/errors/scss/__snapshots__/format.test.js.snap b/tests/format/scss/_errors_/__snapshots__/format.test.js.snap similarity index 80% rename from tests/format/misc/errors/scss/__snapshots__/format.test.js.snap rename to tests/format/scss/_errors_/__snapshots__/format.test.js.snap index b68c27a7c..8a53a937a 100644 --- a/tests/format/misc/errors/scss/__snapshots__/format.test.js.snap +++ b/tests/format/scss/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`less-syntax.less [scss] format 1`] = ` +exports[`less-syntax.less format 1`] = ` "CssSyntaxError: Unknown word .bordered (1:4) > 1 | a {.bordered();} | ^ diff --git a/tests/format/misc/errors/scss/format.test.js b/tests/format/scss/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/scss/format.test.js rename to tests/format/scss/_errors_/format.test.js diff --git a/tests/format/misc/errors/scss/less-syntax.less b/tests/format/scss/_errors_/less-syntax.less similarity index 100% rename from tests/format/misc/errors/scss/less-syntax.less rename to tests/format/scss/_errors_/less-syntax.less diff --git a/tests/format/misc/errors/typescript/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/abstract-accessor-with-implementation/format.test.js b/tests/format/typescript/_errors_/abstract-accessor-with-implementation/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/abstract-accessor-with-implementation/format.test.js rename to tests/format/typescript/_errors_/abstract-accessor-with-implementation/format.test.js diff --git a/tests/format/misc/errors/typescript/abstract-method-with-implementation/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/abstract-method-with-implementation/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/abstract-method-with-implementation/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/abstract-method-with-implementation/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/abstract-method-with-implementation/format.test.js b/tests/format/typescript/_errors_/abstract-method-with-implementation/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/abstract-method-with-implementation/format.test.js rename to tests/format/typescript/_errors_/abstract-method-with-implementation/format.test.js diff --git a/tests/format/misc/errors/typescript/babel-ts/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/babel-ts/__snapshots__/format.test.js.snap similarity index 78% rename from tests/format/misc/errors/typescript/babel-ts/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/babel-ts/__snapshots__/format.test.js.snap index 8b6b371d6..7a0b8cddc 100644 --- a/tests/format/misc/errors/typescript/babel-ts/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/_errors_/babel-ts/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`abstract.ts [babel-ts] format 1`] = ` +exports[`abstract.ts format 1`] = ` "Method 'foo' cannot have an implementation because it is marked abstract. (2:5) 1 | class A { > 2 | abstract foo() {} @@ -9,7 +9,7 @@ exports[`abstract.ts [babel-ts] format 1`] = ` Cause: Method 'foo' cannot have an implementation because it is marked abstract. (2:4)" `; -exports[`classAbstractMethodWithImplementation.ts [babel-ts] format 1`] = ` +exports[`classAbstractMethodWithImplementation.ts format 1`] = ` "Method 'foo' cannot have an implementation because it is marked abstract. (2:5) 1 | abstract class A { > 2 | abstract foo() {} @@ -18,7 +18,7 @@ exports[`classAbstractMethodWithImplementation.ts [babel-ts] format 1`] = ` Cause: Method 'foo' cannot have an implementation because it is marked abstract. (2:4)" `; -exports[`declare-accessor.ts [babel-ts] format 1`] = ` +exports[`declare-accessor.ts format 1`] = ` "'declare' is not allowed in getters. (2:3) 1 | class Foo { > 2 | declare get foo() @@ -29,21 +29,21 @@ exports[`declare-accessor.ts [babel-ts] format 1`] = ` Cause: 'declare' is not allowed in getters. (2:2)" `; -exports[`snippet: #0 [babel-ts] format 1`] = ` +exports[`snippet: #0 format 1`] = ` "Invalid left-hand side in assignment expression. (1:1) > 1 | foo as any = 10; | ^ Cause: Invalid left-hand side in assignment expression. (1:0)" `; -exports[`snippet: #1 [babel-ts] format 1`] = ` +exports[`snippet: #1 format 1`] = ` "Invalid left-hand side in assignment expression. (1:7) > 1 | ({ a: b as any = 2000 } = x); | ^ Cause: Invalid left-hand side in assignment expression. (1:6)" `; -exports[`snippet: #2 [babel-ts] format 1`] = ` +exports[`snippet: #2 format 1`] = ` "Unterminated JSX contents. (1:9) > 1 | foo = '100'; | ^ diff --git a/tests/format/misc/errors/typescript/babel-ts/abstract.ts b/tests/format/typescript/_errors_/babel-ts/abstract.ts similarity index 100% rename from tests/format/misc/errors/typescript/babel-ts/abstract.ts rename to tests/format/typescript/_errors_/babel-ts/abstract.ts diff --git a/tests/format/misc/errors/typescript/babel-ts/classAbstractMethodWithImplementation.ts b/tests/format/typescript/_errors_/babel-ts/classAbstractMethodWithImplementation.ts similarity index 100% rename from tests/format/misc/errors/typescript/babel-ts/classAbstractMethodWithImplementation.ts rename to tests/format/typescript/_errors_/babel-ts/classAbstractMethodWithImplementation.ts diff --git a/tests/format/misc/errors/typescript/babel-ts/declare-accessor.ts b/tests/format/typescript/_errors_/babel-ts/declare-accessor.ts similarity index 100% rename from tests/format/misc/errors/typescript/babel-ts/declare-accessor.ts rename to tests/format/typescript/_errors_/babel-ts/declare-accessor.ts diff --git a/tests/format/misc/errors/typescript/babel-ts/format.test.js b/tests/format/typescript/_errors_/babel-ts/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/babel-ts/format.test.js rename to tests/format/typescript/_errors_/babel-ts/format.test.js diff --git a/tests/format/misc/errors/babel-ts/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/babel-ts2/__snapshots__/format.test.js.snap similarity index 70% rename from tests/format/misc/errors/babel-ts/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/babel-ts2/__snapshots__/format.test.js.snap index a8b51f9c4..f7c616bcb 100644 --- a/tests/format/misc/errors/babel-ts/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/_errors_/babel-ts2/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`export-declare.ts [babel-ts] format 1`] = ` +exports[`export-declare.ts format 1`] = ` "'export declare' must be followed by an ambient declaration. (1:16) > 1 | export declare foo; | ^ @@ -8,7 +8,7 @@ exports[`export-declare.ts [babel-ts] format 1`] = ` Cause: 'export declare' must be followed by an ambient declaration. (1:15)" `; -exports[`multiline-declaration-abstract-class.ts [babel-ts] format 1`] = ` +exports[`multiline-declaration-abstract-class.ts format 1`] = ` "Missing semicolon. (1:8) > 1 | declare abstract | ^ @@ -17,7 +17,7 @@ exports[`multiline-declaration-abstract-class.ts [babel-ts] format 1`] = ` Cause: Missing semicolon. (1:7)" `; -exports[`multiline-declaration-interface.ts [babel-ts] format 1`] = ` +exports[`multiline-declaration-interface.ts format 1`] = ` "Missing semicolon. (1:8) > 1 | declare interface | ^ @@ -27,7 +27,7 @@ exports[`multiline-declaration-interface.ts [babel-ts] format 1`] = ` Cause: Missing semicolon. (1:7)" `; -exports[`multiline-declaration-module.ts [babel-ts] format 1`] = ` +exports[`multiline-declaration-module.ts format 1`] = ` "Missing semicolon. (1:8) > 1 | declare module | ^ @@ -37,7 +37,7 @@ exports[`multiline-declaration-module.ts [babel-ts] format 1`] = ` Cause: Missing semicolon. (1:7)" `; -exports[`multiline-declaration-type.ts [babel-ts] format 1`] = ` +exports[`multiline-declaration-type.ts format 1`] = ` "Missing semicolon. (1:8) > 1 | declare type | ^ @@ -46,7 +46,7 @@ exports[`multiline-declaration-type.ts [babel-ts] format 1`] = ` Cause: Missing semicolon. (1:7)" `; -exports[`parenthesized-decorators-tagged-template.ts [babel-ts] format 1`] = ` +exports[`parenthesized-decorators-tagged-template.ts format 1`] = ` "Unexpected token (2:7) 1 | class Test { > 2 | @foo\`bar\` @@ -57,7 +57,7 @@ exports[`parenthesized-decorators-tagged-template.ts [babel-ts] format 1`] = ` Cause: Unexpected token (2:6)" `; -exports[`type-annotation-expr-statement.ts [babel-ts] format 1`] = ` +exports[`type-annotation-expr-statement.ts format 1`] = ` "Did not expect a type annotation here. (1:3) > 1 | (a: T); | ^ @@ -65,7 +65,7 @@ exports[`type-annotation-expr-statement.ts [babel-ts] format 1`] = ` Cause: Did not expect a type annotation here. (1:2)" `; -exports[`type-annotation-func.ts [babel-ts] format 1`] = ` +exports[`type-annotation-func.ts format 1`] = ` "Did not expect a type annotation here. (1:10) > 1 | func(a: T); | ^ @@ -73,7 +73,7 @@ exports[`type-annotation-func.ts [babel-ts] format 1`] = ` Cause: Did not expect a type annotation here. (1:9)" `; -exports[`type-annotation-in-jsx.tsx [babel-ts] format 1`] = ` +exports[`type-annotation-in-jsx.tsx format 1`] = ` "Did not expect a type annotation here. (3:22) 1 | function Foo() { 2 | return ( diff --git a/tests/format/misc/errors/babel-ts/export-declare.ts b/tests/format/typescript/_errors_/babel-ts2/export-declare.ts similarity index 100% rename from tests/format/misc/errors/babel-ts/export-declare.ts rename to tests/format/typescript/_errors_/babel-ts2/export-declare.ts diff --git a/tests/format/misc/errors/babel-ts/format.test.js b/tests/format/typescript/_errors_/babel-ts2/format.test.js similarity index 100% rename from tests/format/misc/errors/babel-ts/format.test.js rename to tests/format/typescript/_errors_/babel-ts2/format.test.js diff --git a/tests/format/misc/errors/babel-ts/multiline-declaration-abstract-class.ts b/tests/format/typescript/_errors_/babel-ts2/multiline-declaration-abstract-class.ts similarity index 100% rename from tests/format/misc/errors/babel-ts/multiline-declaration-abstract-class.ts rename to tests/format/typescript/_errors_/babel-ts2/multiline-declaration-abstract-class.ts diff --git a/tests/format/misc/errors/babel-ts/multiline-declaration-interface.ts b/tests/format/typescript/_errors_/babel-ts2/multiline-declaration-interface.ts similarity index 100% rename from tests/format/misc/errors/babel-ts/multiline-declaration-interface.ts rename to tests/format/typescript/_errors_/babel-ts2/multiline-declaration-interface.ts diff --git a/tests/format/misc/errors/babel-ts/multiline-declaration-module.ts b/tests/format/typescript/_errors_/babel-ts2/multiline-declaration-module.ts similarity index 100% rename from tests/format/misc/errors/babel-ts/multiline-declaration-module.ts rename to tests/format/typescript/_errors_/babel-ts2/multiline-declaration-module.ts diff --git a/tests/format/misc/errors/babel-ts/multiline-declaration-type.ts b/tests/format/typescript/_errors_/babel-ts2/multiline-declaration-type.ts similarity index 100% rename from tests/format/misc/errors/babel-ts/multiline-declaration-type.ts rename to tests/format/typescript/_errors_/babel-ts2/multiline-declaration-type.ts diff --git a/tests/format/misc/errors/babel-ts/parenthesized-decorators-tagged-template.ts b/tests/format/typescript/_errors_/babel-ts2/parenthesized-decorators-tagged-template.ts similarity index 100% rename from tests/format/misc/errors/babel-ts/parenthesized-decorators-tagged-template.ts rename to tests/format/typescript/_errors_/babel-ts2/parenthesized-decorators-tagged-template.ts diff --git a/tests/format/misc/errors/babel-ts/type-annotation-expr-statement.ts b/tests/format/typescript/_errors_/babel-ts2/type-annotation-expr-statement.ts similarity index 100% rename from tests/format/misc/errors/babel-ts/type-annotation-expr-statement.ts rename to tests/format/typescript/_errors_/babel-ts2/type-annotation-expr-statement.ts diff --git a/tests/format/misc/errors/babel-ts/type-annotation-func.ts b/tests/format/typescript/_errors_/babel-ts2/type-annotation-func.ts similarity index 100% rename from tests/format/misc/errors/babel-ts/type-annotation-func.ts rename to tests/format/typescript/_errors_/babel-ts2/type-annotation-func.ts diff --git a/tests/format/misc/errors/babel-ts/type-annotation-in-jsx.tsx b/tests/format/typescript/_errors_/babel-ts2/type-annotation-in-jsx.tsx similarity index 100% rename from tests/format/misc/errors/babel-ts/type-annotation-in-jsx.tsx rename to tests/format/typescript/_errors_/babel-ts2/type-annotation-in-jsx.tsx diff --git a/tests/format/misc/errors/typescript/catch-clause-with-initializer/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/catch-clause-with-initializer/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/catch-clause-with-initializer/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/catch-clause-with-initializer/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/catch-clause-with-initializer/catch-clause-with-initializer.ts b/tests/format/typescript/_errors_/catch-clause-with-initializer/catch-clause-with-initializer.ts similarity index 100% rename from tests/format/misc/errors/typescript/catch-clause-with-initializer/catch-clause-with-initializer.ts rename to tests/format/typescript/_errors_/catch-clause-with-initializer/catch-clause-with-initializer.ts diff --git a/tests/format/misc/errors/typescript/catch-clause-with-initializer/format.test.js b/tests/format/typescript/_errors_/catch-clause-with-initializer/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/catch-clause-with-initializer/format.test.js rename to tests/format/typescript/_errors_/catch-clause-with-initializer/format.test.js diff --git a/tests/format/misc/errors/typescript/declare-function-with-body/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/declare-function-with-body/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/declare-function-with-body/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/declare-function-with-body/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/declare-function-with-body/format.test.js b/tests/format/typescript/_errors_/declare-function-with-body/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/declare-function-with-body/format.test.js rename to tests/format/typescript/_errors_/declare-function-with-body/format.test.js diff --git a/tests/format/misc/errors/typescript/declare-getter.ts b/tests/format/typescript/_errors_/declare-getter.ts similarity index 100% rename from tests/format/misc/errors/typescript/declare-getter.ts rename to tests/format/typescript/_errors_/declare-getter.ts diff --git a/tests/format/misc/errors/typescript/declare-setter.ts b/tests/format/typescript/_errors_/declare-setter.ts similarity index 100% rename from tests/format/misc/errors/typescript/declare-setter.ts rename to tests/format/typescript/_errors_/declare-setter.ts diff --git a/tests/format/misc/errors/typescript/decrement-and-increment-operators/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/decrement-and-increment-operators/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/decrement-and-increment-operators/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/decrement-and-increment-operators/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/decrement-and-increment-operators/format.test.js b/tests/format/typescript/_errors_/decrement-and-increment-operators/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/decrement-and-increment-operators/format.test.js rename to tests/format/typescript/_errors_/decrement-and-increment-operators/format.test.js diff --git a/tests/format/misc/errors/typescript/duplicated-accessibility-modifiers/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/duplicated-accessibility-modifiers/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/duplicated-accessibility-modifiers/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/duplicated-accessibility-modifiers/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/duplicated-accessibility-modifiers/format.test.js b/tests/format/typescript/_errors_/duplicated-accessibility-modifiers/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/duplicated-accessibility-modifiers/format.test.js rename to tests/format/typescript/_errors_/duplicated-accessibility-modifiers/format.test.js diff --git a/tests/format/misc/errors/typescript/empty-type-arguments-parameters/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/empty-type-arguments-parameters/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/empty-type-arguments-parameters/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/empty-type-arguments-parameters/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/empty-type-arguments-parameters/format.test.js b/tests/format/typescript/_errors_/empty-type-arguments-parameters/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/empty-type-arguments-parameters/format.test.js rename to tests/format/typescript/_errors_/empty-type-arguments-parameters/format.test.js diff --git a/tests/format/misc/errors/typescript/enum/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/enum/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/enum/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/enum/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/enum/format.test.js b/tests/format/typescript/_errors_/enum/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/enum/format.test.js rename to tests/format/typescript/_errors_/enum/format.test.js diff --git a/tests/format/misc/errors/typescript/export-declare.ts b/tests/format/typescript/_errors_/export-declare.ts similarity index 100% rename from tests/format/misc/errors/typescript/export-declare.ts rename to tests/format/typescript/_errors_/export-declare.ts diff --git a/tests/format/misc/errors/typescript/format.test.js b/tests/format/typescript/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/format.test.js rename to tests/format/typescript/_errors_/format.test.js diff --git a/tests/format/misc/errors/typescript/import-reflection/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/import-reflection/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/import-reflection/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/import-reflection/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/import-reflection/format.test.js b/tests/format/typescript/_errors_/import-reflection/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/import-reflection/format.test.js rename to tests/format/typescript/_errors_/import-reflection/format.test.js diff --git a/tests/format/misc/errors/typescript/import-reflection/valid-flow-default-import.mts b/tests/format/typescript/_errors_/import-reflection/valid-flow-default-import.mts similarity index 100% rename from tests/format/misc/errors/typescript/import-reflection/valid-flow-default-import.mts rename to tests/format/typescript/_errors_/import-reflection/valid-flow-default-import.mts diff --git a/tests/format/misc/errors/typescript/import-reflection/valid-ts-default-import.mts b/tests/format/typescript/_errors_/import-reflection/valid-ts-default-import.mts similarity index 100% rename from tests/format/misc/errors/typescript/import-reflection/valid-ts-default-import.mts rename to tests/format/typescript/_errors_/import-reflection/valid-ts-default-import.mts diff --git a/tests/format/misc/errors/typescript/interface/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/interface/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/interface/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/interface/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/interface/format.test.js b/tests/format/typescript/_errors_/interface/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/interface/format.test.js rename to tests/format/typescript/_errors_/interface/format.test.js diff --git a/tests/format/misc/errors/typescript/invalid-class-implements/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/invalid-class-implements/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/invalid-class-implements/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/invalid-class-implements/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/invalid-class-implements/format.test.js b/tests/format/typescript/_errors_/invalid-class-implements/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/invalid-class-implements/format.test.js rename to tests/format/typescript/_errors_/invalid-class-implements/format.test.js diff --git a/tests/format/misc/errors/typescript/invalid-import-equals/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/invalid-import-equals/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/invalid-import-equals/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/invalid-import-equals/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/invalid-import-equals/format.test.js b/tests/format/typescript/_errors_/invalid-import-equals/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/invalid-import-equals/format.test.js rename to tests/format/typescript/_errors_/invalid-import-equals/format.test.js diff --git a/tests/format/misc/errors/invalid-interface-extends/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/invalid-interface-extends/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/invalid-interface-extends/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/invalid-interface-extends/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/invalid-interface-extends/format.test.js b/tests/format/typescript/_errors_/invalid-interface-extends/format.test.js similarity index 100% rename from tests/format/misc/errors/invalid-interface-extends/format.test.js rename to tests/format/typescript/_errors_/invalid-interface-extends/format.test.js diff --git a/tests/format/misc/errors/typescript/invalid-interface-heritage-clause/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/invalid-interface-heritage-clause/__snapshots__/format.test.js.snap similarity index 97% rename from tests/format/misc/errors/typescript/invalid-interface-heritage-clause/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/invalid-interface-heritage-clause/__snapshots__/format.test.js.snap index 7958f1ce1..05cb86456 100644 --- a/tests/format/misc/errors/typescript/invalid-interface-heritage-clause/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/_errors_/invalid-interface-heritage-clause/__snapshots__/format.test.js.snap @@ -20,7 +20,7 @@ exports[`snippet: #0 [typescript] format 1`] = ` Cause: 'extends' list cannot be empty." `; -exports[`snippet: #0 [typescript] format 2`] = ` +exports[`snippet: #0 format 1`] = ` "'extends' list cannot be empty. (1:13) > 1 | interface F extends implements {} | ^^^^^^^ diff --git a/tests/format/misc/errors/typescript/invalid-interface-heritage-clause/format.test.js b/tests/format/typescript/_errors_/invalid-interface-heritage-clause/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/invalid-interface-heritage-clause/format.test.js rename to tests/format/typescript/_errors_/invalid-interface-heritage-clause/format.test.js diff --git a/tests/format/misc/errors/typescript/invalid-jsx-1.tsx b/tests/format/typescript/_errors_/invalid-jsx-1.tsx similarity index 100% rename from tests/format/misc/errors/typescript/invalid-jsx-1.tsx rename to tests/format/typescript/_errors_/invalid-jsx-1.tsx diff --git a/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/invalid-typescript-decorators/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/invalid-typescript-decorators/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/invalid-typescript-decorators/decorator.ts b/tests/format/typescript/_errors_/invalid-typescript-decorators/decorator.ts similarity index 100% rename from tests/format/misc/errors/invalid-typescript-decorators/decorator.ts rename to tests/format/typescript/_errors_/invalid-typescript-decorators/decorator.ts diff --git a/tests/format/misc/errors/invalid-typescript-decorators/enums.ts b/tests/format/typescript/_errors_/invalid-typescript-decorators/enums.ts similarity index 100% rename from tests/format/misc/errors/invalid-typescript-decorators/enums.ts rename to tests/format/typescript/_errors_/invalid-typescript-decorators/enums.ts diff --git a/tests/format/misc/errors/invalid-typescript-decorators/format.test.js b/tests/format/typescript/_errors_/invalid-typescript-decorators/format.test.js similarity index 100% rename from tests/format/misc/errors/invalid-typescript-decorators/format.test.js rename to tests/format/typescript/_errors_/invalid-typescript-decorators/format.test.js diff --git a/tests/format/misc/errors/invalid-typescript-decorators/function.ts b/tests/format/typescript/_errors_/invalid-typescript-decorators/function.ts similarity index 100% rename from tests/format/misc/errors/invalid-typescript-decorators/function.ts rename to tests/format/typescript/_errors_/invalid-typescript-decorators/function.ts diff --git a/tests/format/misc/errors/invalid-typescript-decorators/interface.ts b/tests/format/typescript/_errors_/invalid-typescript-decorators/interface.ts similarity index 100% rename from tests/format/misc/errors/invalid-typescript-decorators/interface.ts rename to tests/format/typescript/_errors_/invalid-typescript-decorators/interface.ts diff --git a/tests/format/misc/errors/invalid-typescript-decorators/issue-9102.ts b/tests/format/typescript/_errors_/invalid-typescript-decorators/issue-9102.ts similarity index 100% rename from tests/format/misc/errors/invalid-typescript-decorators/issue-9102.ts rename to tests/format/typescript/_errors_/invalid-typescript-decorators/issue-9102.ts diff --git a/tests/format/misc/errors/typescript/loop/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/loop/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/loop/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/loop/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/loop/format.test.js b/tests/format/typescript/_errors_/loop/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/loop/format.test.js rename to tests/format/typescript/_errors_/loop/format.test.js diff --git a/tests/format/misc/errors/typescript/mapped-type/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/mapped-type/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/mapped-type/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/mapped-type/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/mapped-type/format.test.js b/tests/format/typescript/_errors_/mapped-type/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/mapped-type/format.test.js rename to tests/format/typescript/_errors_/mapped-type/format.test.js diff --git a/tests/format/misc/errors/typescript/mapped-type/mapped-type.ts b/tests/format/typescript/_errors_/mapped-type/mapped-type.ts similarity index 100% rename from tests/format/misc/errors/typescript/mapped-type/mapped-type.ts rename to tests/format/typescript/_errors_/mapped-type/mapped-type.ts diff --git a/tests/format/misc/errors/typescript/modifiers/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/modifiers/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/modifiers/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/modifiers/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/modifiers/format.test.js b/tests/format/typescript/_errors_/modifiers/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/modifiers/format.test.js rename to tests/format/typescript/_errors_/modifiers/format.test.js diff --git a/tests/format/misc/errors/typescript/module-attributes-static.ts b/tests/format/typescript/_errors_/module-attributes-static.ts similarity index 100% rename from tests/format/misc/errors/typescript/module-attributes-static.ts rename to tests/format/typescript/_errors_/module-attributes-static.ts diff --git a/tests/format/misc/errors/typescript/module-declaration/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/module-declaration/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/module-declaration/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/module-declaration/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/module-declaration/format.test.js b/tests/format/typescript/_errors_/module-declaration/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/module-declaration/format.test.js rename to tests/format/typescript/_errors_/module-declaration/format.test.js diff --git a/tests/format/misc/errors/typescript/newline-before-arrow.ts b/tests/format/typescript/_errors_/newline-before-arrow.ts similarity index 100% rename from tests/format/misc/errors/typescript/newline-before-arrow.ts rename to tests/format/typescript/_errors_/newline-before-arrow.ts diff --git a/tests/format/misc/errors/typescript/tuple/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/tuple/__snapshots__/format.test.js.snap similarity index 97% rename from tests/format/misc/errors/typescript/tuple/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/tuple/__snapshots__/format.test.js.snap index 6cc635c1f..1374145e3 100644 --- a/tests/format/misc/errors/typescript/tuple/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/_errors_/tuple/__snapshots__/format.test.js.snap @@ -14,13 +14,6 @@ exports[`snippet: #0 [babel-ts] format 2`] = ` Cause: A required element cannot follow an optional element. (1:17)" `; -exports[`snippet: #0 [babel-ts] format 3`] = ` -"Type parameters cannot appear on a constructor declaration. (1:24) -> 1 | class A { 'constructor'
() {} } - | ^ -Cause: Type parameters cannot appear on a constructor declaration. (1:23)" -`; - exports[`snippet: #0 [oxc-ts] format 1`] = ` "Expected \`,\` or \`]\` but found \`:\` (1:14) > 1 | type T = [x.y: A]; @@ -40,6 +33,13 @@ exports[`snippet: #0 [typescript] format 1`] = ` Cause: ',' expected." `; +exports[`snippet: #0 format 1`] = ` +"Type parameters cannot appear on a constructor declaration. (1:24) +> 1 | class A { 'constructor'() {} } + | ^ +Cause: Type parameters cannot appear on a constructor declaration. (1:23)" +`; + exports[`snippet: #1 [babel-ts] format 1`] = ` "Tuple members must be labeled with a simple identifier. (1:11) > 1 | type T = [x: A]; diff --git a/tests/format/misc/errors/typescript/tuple/format.test.js b/tests/format/typescript/_errors_/tuple/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/tuple/format.test.js rename to tests/format/typescript/_errors_/tuple/format.test.js diff --git a/tests/format/misc/errors/typescript/type-only-import/__snapshots__/format.test.js.snap b/tests/format/typescript/_errors_/type-only-import/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/errors/typescript/type-only-import/__snapshots__/format.test.js.snap rename to tests/format/typescript/_errors_/type-only-import/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/errors/typescript/type-only-import/format.test.js b/tests/format/typescript/_errors_/type-only-import/format.test.js similarity index 100% rename from tests/format/misc/errors/typescript/type-only-import/format.test.js rename to tests/format/typescript/_errors_/type-only-import/format.test.js diff --git a/tests/format/misc/errors/typescript/value-of-abstract-property.ts b/tests/format/typescript/_errors_/value-of-abstract-property.ts similarity index 100% rename from tests/format/misc/errors/typescript/value-of-abstract-property.ts rename to tests/format/typescript/_errors_/value-of-abstract-property.ts diff --git a/tests/format/typescript/type-arguments-bit-shift-left-like/__snapshots__/format.test.js.snap b/tests/format/typescript/type-arguments-bit-shift-left-like/__snapshots__/format.test.js.snap index 88e0d9bd7..653d98103 100644 --- a/tests/format/typescript/type-arguments-bit-shift-left-like/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/type-arguments-bit-shift-left-like/__snapshots__/format.test.js.snap @@ -28,20 +28,6 @@ f<(v: T) => void>(); ================================================================================ `; -exports[`3.ts [babel-ts] format 1`] = ` -====================================options===================================== -parsers: ["typescript"] -printWidth: 80 - | printWidth -=====================================input====================================== -(class extends f<(v: T) => void> {}); - -=====================================output===================================== -(class extends f<(v: T) => void> {}); - -================================================================================ -`; - exports[`3.ts [oxc-ts] format 1`] = ` "Expected \`{\` but found \`<<\` (1:17) > 1 | (class extends f<(v: T) => void> {}); @@ -57,6 +43,20 @@ exports[`3.ts [typescript] format 1`] = ` Cause: ',' expected." `; +exports[`3.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +(class extends f<(v: T) => void> {}); + +=====================================output===================================== +(class extends f<(v: T) => void> {}); + +================================================================================ +`; + exports[`4.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -74,20 +74,6 @@ printWidth: 80 ================================================================================ `; -exports[`5.tsx [babel-ts] format 1`] = ` -====================================options===================================== -parsers: ["typescript"] -printWidth: 80 - | printWidth -=====================================input====================================== -(v: T) => void> /> - -=====================================output===================================== -(v: T) => void> />; - -================================================================================ -`; - exports[`5.tsx [oxc-ts] format 1`] = ` "Unexpected token (1:11) > 1 | (v: T) => void> /> @@ -103,6 +89,20 @@ exports[`5.tsx [typescript] format 1`] = ` Cause: Identifier expected." `; +exports[`5.tsx format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +(v: T) => void> /> + +=====================================output===================================== +(v: T) => void> />; + +================================================================================ +`; + exports[`6.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/format/misc/typescript-babel-only/__snapshots__/format.test.js.snap b/tests/format/typescript/typescript-babel-only/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/typescript-babel-only/__snapshots__/format.test.js.snap rename to tests/format/typescript/typescript-babel-only/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/typescript-babel-only/decorator-auto-accessors-new-line.ts b/tests/format/typescript/typescript-babel-only/decorator-auto-accessors-new-line.ts similarity index 100% rename from tests/format/misc/typescript-babel-only/decorator-auto-accessors-new-line.ts rename to tests/format/typescript/typescript-babel-only/decorator-auto-accessors-new-line.ts diff --git a/tests/format/misc/typescript-babel-only/format.test.js b/tests/format/typescript/typescript-babel-only/format.test.js similarity index 100% rename from tests/format/misc/typescript-babel-only/format.test.js rename to tests/format/typescript/typescript-babel-only/format.test.js diff --git a/tests/format/misc/typescript-babel-only/parenthesized-decorators-call-expression.ts b/tests/format/typescript/typescript-babel-only/parenthesized-decorators-call-expression.ts similarity index 100% rename from tests/format/misc/typescript-babel-only/parenthesized-decorators-call-expression.ts rename to tests/format/typescript/typescript-babel-only/parenthesized-decorators-call-expression.ts diff --git a/tests/format/misc/typescript-babel-only/parenthesized-decorators-tagged-template.ts b/tests/format/typescript/typescript-babel-only/parenthesized-decorators-tagged-template.ts similarity index 100% rename from tests/format/misc/typescript-babel-only/parenthesized-decorators-tagged-template.ts rename to tests/format/typescript/typescript-babel-only/parenthesized-decorators-tagged-template.ts diff --git a/tests/format/misc/typescript-only/__snapshots__/format.test.js.snap b/tests/format/typescript/typescript-only/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/misc/typescript-only/__snapshots__/format.test.js.snap rename to tests/format/typescript/typescript-only/__snapshots__/format.test.js.snap diff --git a/tests/format/misc/typescript-only/await-with-parens.ts b/tests/format/typescript/typescript-only/await-with-parens.ts similarity index 100% rename from tests/format/misc/typescript-only/await-with-parens.ts rename to tests/format/typescript/typescript-only/await-with-parens.ts diff --git a/tests/format/misc/typescript-only/decorator-auto-accessors-abstract-class.ts b/tests/format/typescript/typescript-only/decorator-auto-accessors-abstract-class.ts similarity index 100% rename from tests/format/misc/typescript-only/decorator-auto-accessors-abstract-class.ts rename to tests/format/typescript/typescript-only/decorator-auto-accessors-abstract-class.ts diff --git a/tests/format/misc/typescript-only/decorator-auto-accessors-declara-class.ts b/tests/format/typescript/typescript-only/decorator-auto-accessors-declara-class.ts similarity index 100% rename from tests/format/misc/typescript-only/decorator-auto-accessors-declara-class.ts rename to tests/format/typescript/typescript-only/decorator-auto-accessors-declara-class.ts diff --git a/tests/format/misc/typescript-only/decorator-auto-accessors-mixed-modifiers.ts b/tests/format/typescript/typescript-only/decorator-auto-accessors-mixed-modifiers.ts similarity index 100% rename from tests/format/misc/typescript-only/decorator-auto-accessors-mixed-modifiers.ts rename to tests/format/typescript/typescript-only/decorator-auto-accessors-mixed-modifiers.ts diff --git a/tests/format/misc/typescript-only/format.test.js b/tests/format/typescript/typescript-only/format.test.js similarity index 100% rename from tests/format/misc/typescript-only/format.test.js rename to tests/format/typescript/typescript-only/format.test.js diff --git a/tests/format/misc/typescript-only/parenthesized-decorators-call-expression.ts b/tests/format/typescript/typescript-only/parenthesized-decorators-call-expression.ts similarity index 100% rename from tests/format/misc/typescript-only/parenthesized-decorators-call-expression.ts rename to tests/format/typescript/typescript-only/parenthesized-decorators-call-expression.ts diff --git a/tests/format/misc/typescript-only/parenthesized-decorators-tagged-template.ts b/tests/format/typescript/typescript-only/parenthesized-decorators-tagged-template.ts similarity index 100% rename from tests/format/misc/typescript-only/parenthesized-decorators-tagged-template.ts rename to tests/format/typescript/typescript-only/parenthesized-decorators-tagged-template.ts diff --git a/tests/format/misc/typescript-only/prettier-ignore-parenthesized-type.ts b/tests/format/typescript/typescript-only/prettier-ignore-parenthesized-type.ts similarity index 100% rename from tests/format/misc/typescript-only/prettier-ignore-parenthesized-type.ts rename to tests/format/typescript/typescript-only/prettier-ignore-parenthesized-type.ts diff --git a/tests/format/misc/errors/vue/__snapshots__/format.test.js.snap b/tests/format/vue/_errors_/__snapshots__/format.test.js.snap similarity index 82% rename from tests/format/misc/errors/vue/__snapshots__/format.test.js.snap rename to tests/format/vue/_errors_/__snapshots__/format.test.js.snap index 5a1b398ca..7769461ef 100644 --- a/tests/format/misc/errors/vue/__snapshots__/format.test.js.snap +++ b/tests/format/vue/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`unclosed_tag.vue [vue] format 1`] = ` +exports[`unclosed_tag.vue format 1`] = ` "Opening tag "div" not terminated. (1:1) > 1 |
Templates are formatted as well... 3 | 7 | diff --git a/tests/format/misc/errors/vue/format.test.js b/tests/format/vue/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/vue/format.test.js rename to tests/format/vue/_errors_/format.test.js diff --git a/tests/format/misc/errors/vue/unclosed_tag.vue b/tests/format/vue/_errors_/unclosed_tag.vue similarity index 100% rename from tests/format/misc/errors/vue/unclosed_tag.vue rename to tests/format/vue/_errors_/unclosed_tag.vue diff --git a/tests/format/misc/errors/vue/unclosed_tag_in_template.vue b/tests/format/vue/_errors_/unclosed_tag_in_template.vue similarity index 100% rename from tests/format/misc/errors/vue/unclosed_tag_in_template.vue rename to tests/format/vue/_errors_/unclosed_tag_in_template.vue diff --git a/tests/format/misc/errors/vue/upper-case.html b/tests/format/vue/_errors_/upper-case.html similarity index 100% rename from tests/format/misc/errors/vue/upper-case.html rename to tests/format/vue/_errors_/upper-case.html diff --git a/tests/format/misc/errors/yaml/__snapshots__/format.test.js.snap b/tests/format/yaml/_errors_/__snapshots__/format.test.js.snap similarity index 86% rename from tests/format/misc/errors/yaml/__snapshots__/format.test.js.snap rename to tests/format/yaml/_errors_/__snapshots__/format.test.js.snap index 515d70320..bc4a310e4 100644 --- a/tests/format/misc/errors/yaml/__snapshots__/format.test.js.snap +++ b/tests/format/yaml/_errors_/__snapshots__/format.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing -exports[`block-scalar-with-spaces-only.yml [yaml] format 1`] = ` +exports[`block-scalar-with-spaces-only.yml format 1`] = ` "Block scalars with more-indented leading empty lines must use an explicit indentation indicator (1:21) > 1 | empty block scalar: > | ^ diff --git a/tests/format/misc/errors/yaml/block-scalar-with-spaces-only.yml b/tests/format/yaml/_errors_/block-scalar-with-spaces-only.yml similarity index 100% rename from tests/format/misc/errors/yaml/block-scalar-with-spaces-only.yml rename to tests/format/yaml/_errors_/block-scalar-with-spaces-only.yml diff --git a/tests/format/misc/errors/yaml/format.test.js b/tests/format/yaml/_errors_/format.test.js similarity index 100% rename from tests/format/misc/errors/yaml/format.test.js rename to tests/format/yaml/_errors_/format.test.js