repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/printer/print-result.js
src/document/printer/print-result.js
import { trimIndentation } from "./trim-indentation.js"; class printResult { /** @type {string[]} */ #settledTexts = []; #unsettledText = ""; #settledTextLength = 0; /** @type {number[]} */ #settledPositions = []; /** @type {number[]} */ #unsettledPositions = []; #settle() { const text = this.#u...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/printer-yaml.js
src/language-yaml/printer-yaml.js
/** @import {Doc} from "../document/index.js" */ import { breakParent, fill, group, hardline, join, line, lineSuffix, replaceEndOfLine, } from "../document/index.js"; import isPreviousLineEmpty from "../utilities/is-previous-line-empty.js"; import UnexpectedNodeError from "../utilities/unexpected-node-...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/index.js
src/language-yaml/index.js
import printer from "./printer-yaml.js"; export const printers = { yaml: printer, }; export { default as languages } from "./languages.evaluate.js"; export { default as options } from "./options.js"; export * as parsers from "./parser-yaml.js";
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/visitor-keys.evaluate.js
src/language-yaml/visitor-keys.evaluate.js
import { generateReferenceSharedVisitorKeys } from "../utilities/visitor-keys.js"; /** @import {VisitorKeys} from "../utilities/visitor-keys.js"; */ const commentsKeys = [ "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments", ]; const tagAndAnchor = ["anchor", "tag"]; ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/utilities.js
src/language-yaml/utilities.js
import isNonEmptyArray from "../utilities/is-non-empty-array.js"; /** * @param {any} value * @param {string[]=} types */ function isNode(value, types) { return typeof value?.type === "string" && types.includes(value.type); } function mapNode(node, callback, parent) { return callback( "children" in node ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/print-preprocess.js
src/language-yaml/print-preprocess.js
import { defineShortcut, mapNode } from "./utilities.js"; function preprocess(ast) { return mapNode(ast, defineShortcuts); } function defineShortcuts(node) { switch (node.type) { case "document": defineShortcut(node, "head", () => node.children[0]); defineShortcut(node, "body", () => node.children...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/clean.js
src/language-yaml/clean.js
import { isPragma } from "./pragma.js"; function clean(original, cloned /* , parent */) { switch (original.type) { case "comment": // insert pragma if (isPragma(original.value)) { return null; } break; case "quoteDouble": case "quoteSingle": cloned.type = "quote"; ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/options.js
src/language-yaml/options.js
import commonOptions from "../common/common-options.evaluate.js"; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.evaluate.js const options = { bracketSpacing: commonOptions.bracketSpacing, singleQuote: commonOptions.singleQuote, proseWrap: commonOptions.proseWrap, }; exp...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/loc.js
src/language-yaml/loc.js
const locStart = (node) => node.position.start.offset; const locEnd = (node) => node.position.end.offset; export { locEnd, locStart };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/parser-yaml.js
src/language-yaml/parser-yaml.js
import { parse as parseYaml } from "yaml-unist-parser/lib/parse.js"; import createError from "../common/parser-create-error.js"; import { locEnd, locStart } from "./loc.js"; import { hasIgnorePragma, hasPragma } from "./pragma.js"; const parseOptions = { allowDuplicateKeysInMap: true, }; function parse(text) { tr...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/get-visitor-keys.js
src/language-yaml/get-visitor-keys.js
import createGetVisitorKeys from "../utilities/create-get-visitor-keys.js"; import visitorKeys from "./visitor-keys.evaluate.js"; const getVisitorKeys = createGetVisitorKeys(visitorKeys); export default getVisitorKeys;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/pragma.js
src/language-yaml/pragma.js
import { FORMAT_PRAGMA_TO_INSERT, YAML_HAS_IGNORE_PRAGMA_REGEXP, YAML_HAS_PRAGMA_REGEXP, YAML_IS_PRAGMA_REGEXP, } from "../utilities/pragma/pragma.evaluate.js"; const isPragma = (text) => YAML_IS_PRAGMA_REGEXP.test(text); const hasPragma = (text) => YAML_HAS_PRAGMA_REGEXP.test(text); const hasIgnorePragma = (t...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/embed.js
src/language-yaml/embed.js
import { hardline } from "../document/index.js"; function embed(path, options) { const { node } = path; // Try to format `.prettierrc`, `.stylelintrc`, and `.lintstagedrc` as `json` first if ( node.type === "root" && options.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/.test(option...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/languages.evaluate.js
src/language-yaml/languages.evaluate.js
import * as linguistLanguages from "linguist-languages"; import createLanguage from "../utilities/create-language.js"; const ignoredFilenames = new Set([ // `yarn.lock` is not YAML in Yarn v1: https://github.com/yarnpkg/yarn/issues/5629 // and it's a generated file, we don't want format it by default "yarn.lock"...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/print/mapping-item.js
src/language-yaml/print/mapping-item.js
/** @import {Doc} from "../../document/index.js" */ import { conditionalGroup, group, hardline, ifBreak, line, } from "../../document/index.js"; import { hasEndComments, hasLeadingComments, hasMiddleComments, hasTrailingComment, isEmptyNode, isInlineNode, isNode, } from "../utilities.js"; impor...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/print/misc.js
src/language-yaml/print/misc.js
import { align, softline } from "../../document/index.js"; import { hasEndComments, isNextLineEmpty, isNode } from "../utilities.js"; const printedEmptyLineCache = new WeakMap(); function printNextEmptyLine(path, originalText) { const { node, root } = path; let isNextEmptyLinePrintedSet; if (printedEmptyLineCac...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/print/flow-mapping-sequence.js
src/language-yaml/print/flow-mapping-sequence.js
import { hardline, ifBreak, join, line, softline, } from "../../document/index.js"; import { hasEndComments, isEmptyNode } from "../utilities.js"; import { alignWithSpaces, printNextEmptyLine } from "./misc.js"; function printFlowMapping(path, options, print) { const { node } = path; const isMapping = no...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-yaml/print/block.js
src/language-yaml/print/block.js
/** @import {Doc} from "../../document/index.js" */ import { dedent, dedentToRoot, fill, hardline, join, line, literalline, markAsRoot, } from "../../document/index.js"; import { getBlockValueLineContents, hasIndicatorComment, isLastDescendantNode, } from "../utilities.js"; import { alignWithSpac...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/printer-graphql.js
src/language-graphql/printer-graphql.js
import { group, hardline, ifBreak, indent, join, line, softline, } from "../document/index.js"; import isNextLineEmpty from "../utilities/is-next-line-empty.js"; import isNonEmptyArray from "../utilities/is-non-empty-array.js"; import UnexpectedNodeError from "../utilities/unexpected-node-error.js"; impor...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/index.js
src/language-graphql/index.js
import printer from "./printer-graphql.js"; export const printers = { graphql: printer, }; export { default as languages } from "./languages.evaluate.js"; export { default as options } from "./options.js"; export * as parsers from "./parser-graphql.js";
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/parser-graphql.js
src/language-graphql/parser-graphql.js
import { parse as parseGraphql } from "graphql/language/parser.mjs"; import createError from "../common/parser-create-error.js"; import { locEnd, locStart } from "./loc.js"; import { hasIgnorePragma, hasPragma } from "./pragma.js"; function parseComments(ast) { const comments = []; const { startToken, endToken } =...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/options.js
src/language-graphql/options.js
import commonOptions from "../common/common-options.evaluate.js"; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.evaluate.js const options = { bracketSpacing: commonOptions.bracketSpacing, }; export default options;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/loc.js
src/language-graphql/loc.js
const locStart = (nodeOrToken) => nodeOrToken.loc.start; const locEnd = (nodeOrToken) => nodeOrToken.loc.end; export { locEnd, locStart };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/visitor-keys.js
src/language-graphql/visitor-keys.js
import { QueryDocumentKeys as graphqlVisitorKeys } from "graphql/language/ast.mjs"; const visitorKeys = { ...graphqlVisitorKeys }; // Unable to produce https://github.com/prettier/prettier/issues/18212#issuecomment-3506234429 for (const kind of [ "ArgumentCoordinate", "DirectiveArgumentCoordinate", "DirectiveCo...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/get-visitor-keys.js
src/language-graphql/get-visitor-keys.js
import createGetVisitorKeys from "../utilities/create-get-visitor-keys.js"; import visitorKeys from "./visitor-keys.js"; const getVisitorKeys = createGetVisitorKeys(visitorKeys, "kind"); export default getVisitorKeys;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/pragma.js
src/language-graphql/pragma.js
import { FORMAT_PRAGMA_TO_INSERT, GRAPHQL_HAS_IGNORE_PRAGMA_REGEXP, GRAPHQL_HAS_PRAGMA_REGEXP, } from "../utilities/pragma/pragma.evaluate.js"; const hasPragma = (text) => GRAPHQL_HAS_PRAGMA_REGEXP.test(text); const hasIgnorePragma = (text) => GRAPHQL_HAS_IGNORE_PRAGMA_REGEXP.test(text); const insertPragma = (te...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/languages.evaluate.js
src/language-graphql/languages.evaluate.js
import * as linguistLanguages from "linguist-languages"; import createLanguage from "../utilities/create-language.js"; const languages = [ createLanguage(linguistLanguages.GraphQL, () => ({ parsers: ["graphql"], vscodeLanguageIds: ["graphql"], })), ]; export default languages;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-graphql/print/description.js
src/language-graphql/print/description.js
import { hardline, line } from "../../document/index.js"; function printDescription(path, options, print) { const { node } = path; if (!node.description) { return ""; } const parts = [print("description")]; if (node.kind === "InputValueDefinition" && !node.description.block) { parts.push(line); } ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/printer-glimmer.js
src/language-handlebars/printer-glimmer.js
import { dedent, fill, group, hardline, ifBreak, indent, join, line, replaceEndOfLine, softline, } from "../document/index.js"; import { getPreferredQuote } from "../utilities/get-preferred-quote.js"; import htmlWhitespace from "../utilities/html-whitespace.js"; import isNonEmptyArray from "../utili...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/index.js
src/language-handlebars/index.js
import printer from "./printer-glimmer.js"; export const printers = { glimmer: printer, }; export { default as languages } from "./languages.evaluate.js"; export * as parsers from "./parser-glimmer.js";
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/utilities.js
src/language-handlebars/utilities.js
// Do not use void tags from other package, won't match import { getVoidTags } from "@glimmer/syntax"; const htmlVoidElements = new Set(getVoidTags()); function isUppercase(string) { return string.toUpperCase() === string; } function isGlimmerComponent(node) { return ( node.type === "ElementNode" && type...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/parser-glimmer.js
src/language-handlebars/parser-glimmer.js
import { preprocess as parseGlimmer } from "@glimmer/syntax"; import createError from "../common/parser-create-error.js"; import parseFrontMatter from "../main/front-matter/parse.js"; import { locEnd, locStart } from "./loc.js"; /** @import {AST, PreprocessOptions} from "@glimmer/syntax"; @typedef {AST.SourcePosition ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/clean.js
src/language-handlebars/clean.js
import htmlWhitespace from "../utilities/html-whitespace.js"; function clean(original, cloned, parent) { // (Glimmer/HTML) ignore TextNode if (original.type === "TextNode") { const trimmed = original.chars.trim(); if (!trimmed) { return null; } // CSS will be formatted if ( parent....
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/loc.js
src/language-handlebars/loc.js
const locStart = (node) => node.loc.start.offset; const locEnd = (node) => node.loc.end.offset; export { locEnd, locStart };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/visitor-keys.js
src/language-handlebars/visitor-keys.js
export { visitorKeys as default } from "@glimmer/syntax";
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/get-visitor-keys.js
src/language-handlebars/get-visitor-keys.js
import createGetVisitorKeys from "../utilities/create-get-visitor-keys.js"; import visitorKeys from "./visitor-keys.js"; const getVisitorKeys = createGetVisitorKeys(visitorKeys); export default getVisitorKeys;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/embed.js
src/language-handlebars/embed.js
function embed(path /* , options*/) { const { node } = path; if (node.type !== "TextNode") { return; } const { parent } = path; if ( !( parent.type === "ElementNode" && parent.tag === "style" && parent.children.length === 1 && parent.children[0] === node ) ) { retu...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-handlebars/languages.evaluate.js
src/language-handlebars/languages.evaluate.js
import * as linguistLanguages from "linguist-languages"; import createLanguage from "../utilities/create-language.js"; const languages = [ createLanguage(linguistLanguages.Handlebars, () => ({ parsers: ["glimmer"], vscodeLanguageIds: ["handlebars"], })), ]; export default languages;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/create-path-serializer.js
tests/integration/create-path-serializer.js
import { fileURLToPath } from "node:url"; const isWindows = process.platform === "win32"; const replaceAll = (text, find, replacement) => text.replaceAll ? text.replaceAll(find, replacement) : text.split(find).join(replacement); function createPathSerializer(options) { const replacements = []; for (cons...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/print-doc.js
tests/integration/print-doc.js
/** @type {import('prettier')} */ import prettier from "../config/prettier-entry.js"; function printDoc(doc) { // This dummy plugin ignores the input and simply returns the given doc. // This is to make sure that the doc will go through all the stages a real doc // returned by a real plugin would go (e.g. `propa...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/env.js
tests/integration/env.js
import path from "node:path"; import createEsmUtils from "esm-utils"; const { __dirname, require } = createEsmUtils(import.meta); const isProduction = process.env.NODE_ENV === "production"; const { PRETTIER_DIR } = process.env; const { bin } = require(path.join(PRETTIER_DIR, "package.json")); const prettierCliEntry =...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/path-serializer.js
tests/integration/path-serializer.js
import createPathSerializer from "./create-path-serializer.js"; export default createPathSerializer({ replacements: new Map([ [new URL("./cli/", import.meta.url), "<cli>/"], [new URL("./plugins/", import.meta.url), "<plugins>/"], ]), });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/integration-test-setup.js
tests/integration/integration-test-setup.js
import runCli from "./run-cli.js"; globalThis.runCli = runCli;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/run-cli.js
tests/integration/run-cli.js
import childProcess from "node:child_process"; import path from "node:path"; import url from "node:url"; /** @typedef {{ isTTY?: boolean, stdoutIsTTY?: boolean, ci?: boolean, mockWriteFileErrors?: Record<string, string>, nodeOptions?: string[], input?: string, }} CliTestOptions */ // Though the doc says `...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/cli-worker.js
tests/integration/cli-worker.js
import path from "node:path"; import url from "node:url"; import { prettierCliEntry, prettierCliMockableEntry, prettierMainEntry, } from "./env.js"; const normalizeToPosix = path.sep === "\\" ? (filepath) => replaceAll(filepath, "\\", "/") : (filepath) => filepath; const hasOwn = Object.hasOwn ?? (...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/plugins/automatic/prettier-plugin-baz.js
tests/integration/plugins/automatic/prettier-plugin-baz.js
import createPlugin from "../../../config/utilities/create-plugin.cjs"; const plugin = createPlugin({ name: "baz", print: (text) => `content from \`prettier-plugin-baz.js\` file + ${text}`, finalNewLine: false, }); export default plugin;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/plugins/automatic/node_modules/prettier-plugin-baz.js/index.js
tests/integration/plugins/automatic/node_modules/prettier-plugin-baz.js/index.js
"use strict"; module.exports = { languages: [ { name: "baz", parsers: ["baz"], }, ], parsers: { baz: { parse: text => ({ text }), astFormat: "baz", }, }, printers: { baz: { async print(path) { const { default: prettier } = await import( "../...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/plugins/automatic/node_modules/prettier-plugin-bar/index.js
tests/integration/plugins/automatic/node_modules/prettier-plugin-bar/index.js
"use strict"; module.exports = { languages: [ { name: "bar", parsers: ["bar"], }, ], parsers: { bar: { parse: text => ({ text }), astFormat: "bar", }, }, printers: { bar: { print(path) { return ["content from `prettier-plugin-bar` package + ", path.ge...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/plugins/automatic/node_modules/@user/prettier-plugin-foobar/index.js
tests/integration/plugins/automatic/node_modules/@user/prettier-plugin-foobar/index.js
"use strict"; module.exports = { languages: [ { name: "foobar", parsers: ["foobar"], extensions: [".foobar"], }, ], parsers: { foobar: { parse: text => ({ text }), astFormat: "foobar", }, }, printers: { foobar: { print(path) { return ["foobar+",...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/plugins/automatic/node_modules/@prettier/plugin-foo/index.js
tests/integration/plugins/automatic/node_modules/@prettier/plugin-foo/index.js
"use strict"; module.exports = { languages: [ { name: "foo", parsers: ["foo"], extensions: [".foo"], }, ], parsers: { foo: { parse: text => ({ text }), astFormat: "foo", }, }, printers: { foo: { print(path) { return ["foo+", path.getValue().text...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/plugins/get-parse-options/plugin.js
tests/integration/plugins/get-parse-options/plugin.js
const name = "get-parse-options"; export { name as __plugin_internal_name }; export const languages = [ { name, parsers: [name], extensions: [`.${name}`], }, ]; export const parsers = { [name]: { astFormat: name, parse: (_, options) => options, }, }; // Adding this since `prettier.__debu...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/plugins/bespoke/node_modules/@company/prettier-plugin-bespoke/main.js
tests/integration/plugins/bespoke/node_modules/@company/prettier-plugin-bespoke/main.js
"use strict"; module.exports = { languages: [ { name: "bespoke", parsers: ["bespoke"], }, ], parsers: { bespoke: { parse: text => ({ text }), astFormat: "bespoke" }, }, printers: { bespoke: { print(path) { return ["bespoke+", path.getValue().text]; ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/plugins/languages/is-supported.js
tests/integration/plugins/languages/is-supported.js
import path from "node:path"; import createPlugin from "../../../config/utilities/create-plugin.cjs"; const PARSER_NAME = "parser-name-inferred-from-language-is-supported"; const PRINT_MARK = `formatted by '${PARSER_NAME}' parser`; const languages = [ { name: "language-name-does-not-matter", parsers: [PARSE...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/plugin-precedence.js
tests/integration/__tests__/plugin-precedence.js
describe("json-stringify takes precedence over json for package.json", () => { runCli("plugins", ["--stdin-filepath=package.json"], { input: '{ "a": "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong" }', }).test({ stdout: '{\n "a": "longlonglonglonglonglonglo...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/doc-builders.js
tests/integration/__tests__/doc-builders.js
import prettier from "../../config/prettier-entry.js"; const { join, hardline, literalline, group, fill, line, lineSuffix, breakParent, ifBreak, indent, align, } = prettier.doc.builders; describe("doc builders", () => { test.each([ ["concat", ["1", "2"], ["1", "2"]], ["join", join(["1"]...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/mockable.js
tests/integration/__tests__/mockable.js
import url from "node:url"; import { prettierCliMockableEntry } from "../env.js"; async function getCliMockable() { const cli = await import(url.pathToFileURL(prettierCliMockableEntry)); return cli.mockable; } test("isCI", async () => { const mockable = await getCliMockable(); expect(typeof mockable.implement...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/plugin-flush-line-suffix.js
tests/integration/__tests__/plugin-flush-line-suffix.js
describe("flush all line-suffix content", () => { runCli("plugins/flushLineSuffix", ["*.foo", "--plugin=./plugin.cjs"], { ignoreLineEndings: true, }).test({ stdout: "contents", stderr: "", status: 0, write: [], }); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/ignore-vcs-files.js
tests/integration/__tests__/ignore-vcs-files.js
describe("ignores files in version control systems", () => { runCli("cli/ignore-vcs-files", [ ".svn/file.js", ".hg/file.js", ".jj/file.js", "file.js", "-l", ]).test({ status: 1, }); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/file-info.js
tests/integration/__tests__/file-info.js
import fs from "node:fs"; import path from "node:path"; import url from "node:url"; import createEsmUtils from "esm-utils"; import { temporaryDirectory as getTemporaryDirectory } from "tempy"; import prettier from "../../config/prettier-entry.js"; const { __dirname } = createEsmUtils(import.meta); describe("extracts ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/list-different.js
tests/integration/__tests__/list-different.js
describe("checks stdin with --list-different", () => { runCli("cli/with-shebang", ["--list-different", "--parser", "babel"], { input: "0", }).test({ stdout: "(stdin)", stderr: "", status: "non-zero", }); }); describe("checks stdin with -l (alias for --list-different)", () => { runCli("cli/with-...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/doc-trim.js
tests/integration/__tests__/doc-trim.js
import { outdent } from "outdent"; import prettier from "../../config/prettier-entry.js"; const docPrinter = prettier.doc.printer; const docBuilders = prettier.doc.builders; const { printDocToString } = docPrinter; const { line, trim, group, indent } = docBuilders; // These tests don't use `runCli` because `trim` is...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/with-node-modules.js
tests/integration/__tests__/with-node-modules.js
describe("ignores node_modules by default", () => { runCli("cli/with-node-modules", ["**/*.js", "-l"]).test({ status: 1, }); }); describe("ignores node_modules by with ./**/*.js", () => { runCli("cli/with-node-modules", ["./**/*.js", "-l"]).test({ status: 1, }); }); describe("doesn't ignore node_modul...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/cursor-offset.js
tests/integration/__tests__/cursor-offset.js
describe("write cursorOffset to stderr with --cursor-offset <int>", () => { runCli("cli", ["--cursor-offset", "2", "--parser", "babel"], { input: " 1", }).test({ status: 0, }); }); describe("cursorOffset should not be affected by full-width character", () => { runCli("cli", ["--cursor-offset", "21", "-...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/print-doc-to-string.js
tests/integration/__tests__/print-doc-to-string.js
import prettier from "../../config/prettier-entry.js"; const { printDocToString } = prettier.doc.printer; test("Throw error on invalid doc", () => { const printDocToStringOptions = { printWidth: 80, tabWidth: 2 }; for (const doc of [ true, false, 0, 1, Number.NaN, Number.POSITIVE_INFINITY,...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/plugin-resolution.js
tests/integration/__tests__/plugin-resolution.js
describe("loads --plugin by its relative path", () => { runCli("plugins", [ "automatic/file.txt", "--parser=bar", "--plugin=./automatic/node_modules/prettier-plugin-bar/index.js", ]).test({ stdout: "content from `prettier-plugin-bar` package + contents", stderr: "", status: 0, write: [],...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/cli.js
tests/integration/__tests__/cli.js
import fs from "node:fs"; import { prettierCliEntry } from "../env.js"; describe("CLI", () => { test("CLI should be executable.", () => { expect(() => fs.accessSync(prettierCliEntry, fs.constants.X_OK), ).not.toThrow(); }); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/arg-parsing.js
tests/integration/__tests__/arg-parsing.js
describe("boolean flags do not swallow the next argument", () => { runCli("cli/arg-parsing", [ "--end-of-line", "lf", "--single-quote", "file.js", ]).test({ status: 0, }); }); describe("negated options work", () => { runCli("cli/arg-parsing", [ "--end-of-line", "lf", "--no-semi"...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/public-utilities.js
tests/integration/__tests__/public-utilities.js
import prettier from "../../config/prettier-entry.js"; const utilities = prettier.util; test("shared util has correct structure", () => { expect(typeof utilities.getMaxContinuousCount).toBe("function"); expect(typeof utilities.getStringWidth).toBe("function"); expect(typeof utilities.getAlignmentSize).toBe("fun...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/debug-print-comments.js
tests/integration/__tests__/debug-print-comments.js
describe("prints information for debugging comment attachment with --debug-print-comments", () => { runCli("cli/with-shebang", ["--debug-print-comments", "--parser", "babel"], { input: "/* 1 */\nconsole.log(foo /* 2 */); // 3", }).test({ stderr: "", status: 0, }); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/plugins.js
tests/integration/__tests__/plugins.js
import url from "node:url"; import prettier from "../../config/prettier-entry.js"; const pluginUrl = new URL( "../../config/prettier-plugins/prettier-plugin-uppercase-rocks/index.js", import.meta.url, ); test("plugins", async () => { const input = "foo"; const expectedOutput = "FOO\n"; await expect( pr...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/patterns-glob.js
tests/integration/__tests__/patterns-glob.js
/* fixtures-1/ ├─ !file.js ├─ a.js └─ b.js */ describe("fixtures-1: Should match all files", () => { runCli("cli/patterns-glob/fixtures-1", ["*.js", "!file.js", "-l"]).test({ status: 1, }); }); describe("fixtures-1: Should match files except `a.js`", () => { runCli("cli/patterns-glob/fixtures-1", ["*.js", "...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/config-resolution.js
tests/integration/__tests__/config-resolution.js
import path from "node:path"; import url from "node:url"; import prettier from "../../config/prettier-entry.js"; test("resolves configuration from external files and overrides by extname", async () => { await expect( prettier.resolveConfig( new URL("../cli/config/external-overrides/file.js", import.meta.ur...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/piped-output.js
tests/integration/__tests__/piped-output.js
describe("output with --check + unformatted differs when piped", () => { const cli0 = runCli( "cli/write", ["--write", "--check", "--no-color", "unformatted.js"], { stdoutIsTTY: true }, ).test({ status: 0, }); const cli1 = runCli( "cli/write", ["--write", "--check", "--no-color", "unfor...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/plugin-extensions.js
tests/integration/__tests__/plugin-extensions.js
describe("uses 'extensions' from languages to determine parser", () => { runCli("plugins/extensions", ["*.foo", "--plugin=./plugin.cjs"], { ignoreLineEndings: true, }).test({ stdout: "!contents", stderr: "", status: 0, write: [], }); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/debug-print-ast.js
tests/integration/__tests__/debug-print-ast.js
test("prints information for debugging AST --debug-print-ast", async () => { const { stdout } = await runCli( "cli/with-shebang", ["--debug-print-ast", "--parser", "babel"], { input: "const foo = 'foo';", }, ); const data = JSON.parse(stdout); expect(data).toHaveProperty("type", "File");...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/plugin-override-buitin-plugins.js
tests/integration/__tests__/plugin-override-buitin-plugins.js
import prettier from "../../config/prettier-entry.js"; import createPlugin from "../../config/utilities/create-plugin.cjs"; test("plugins can override builtin plugins", async () => { const outputWithoutPlugin = await prettier.format("foo()", { parser: "babel", }); const outputWithPlugin = await prettier.form...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/debug-api.js
tests/integration/__tests__/debug-api.js
import { outdent } from "outdent"; import prettier from "../../config/prettier-entry.js"; const { __debug: { parse, formatAST, formatDoc, printToDoc, printDocToString }, doc: { builders, utils: { findInDoc }, }, } = prettier; const code = outdent` const foo = 'bar' `; const formatted = 'c...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/invalid-ignore.js
tests/integration/__tests__/invalid-ignore.js
import path from "node:path"; import createEsmUtils from "esm-utils"; import prettier from "../../config/prettier-entry.js"; const { __dirname } = createEsmUtils(import.meta); describe("throw error with invalid ignore", () => { runCli("cli/invalid-ignore", ["something.js"]).test({ status: "non-zero", }); t...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/early-exit.js
tests/integration/__tests__/early-exit.js
import prettier from "../../config/prettier-entry.js"; describe("show version with --version", () => { runCli("cli/with-shebang", ["--version"]).test({ stdout: prettier.version, status: 0, }); }); describe("show usage with --help", () => { runCli("cli", ["--help"]).test({ status: 0, }); }); descr...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/plugin-preprocess.js
tests/integration/__tests__/plugin-preprocess.js
describe("parser preprocess function is used to reshape input text", () => { runCli("plugins/preprocess", ["*.foo", "--plugin=./plugin.cjs"], { ignoreLineEndings: true, }).test({ stdout: "preprocessed:contents", stderr: "", status: 0, write: [], }); runCli( "plugins/preprocess", ["*....
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/cache.js
tests/integration/__tests__/cache.js
import fs from "node:fs/promises"; import path from "node:path"; import { fileURLToPath } from "node:url"; function resolveDir(dir) { return fileURLToPath(new URL(`../${dir}/`, import.meta.url)); } const runCliWithoutGitignore = (dir, args, options) => runCli(dir, [...args, "--ignore-path", ".prettierignore"], op...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/with-shebang.js
tests/integration/__tests__/with-shebang.js
describe("preserves shebang", () => { runCli("cli/with-shebang", ["--end-of-line", "lf", "issue1890.js"]).test({ status: 0, }); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/bundle.js
tests/integration/__tests__/bundle.js
import fs from "node:fs/promises"; import path from "node:path"; import { inspect } from "node:util"; import createEsmUtils from "esm-utils"; import fastGlob from "fast-glob"; import coreOptions from "../../../src/main/core-options.evaluate.js"; import codeSamples from "../../../website/playground/codeSamples.mjs"; imp...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/plugin-options.js
tests/integration/__tests__/plugin-options.js
import { createTwoFilesPatch } from "diff"; test("show external options with `--help`", async () => { const originalStdout = await runCli("plugins/options", ["--help"]).stdout; const pluggedStdout = await runCli("plugins/options", [ "--help", "--plugin=./plugin.cjs", ]).stdout; expect( createTwoFi...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/ignore-unknown.js
tests/integration/__tests__/ignore-unknown.js
describe("ignore-unknown dir", () => { runCli("cli/ignore-unknown", [ ".", "--ignore-unknown", "--list-different", ]).test({ status: "non-zero", stderr: "", write: [], }); }); describe("ignore-unknown alias", () => { runCli("cli/ignore-unknown", [".", "-u", "--list-different"]).test({ ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/printer-and-parser.js
tests/integration/__tests__/printer-and-parser.js
import prettier from "../../config/prettier-entry.js"; test("Should use printer and parser from the same plugin", async () => { const createPlugin = (name) => ({ name, parsers: { foo: { parse: () => ({ parsedBy: name }), astFormat: "foo", }, }, printers: { foo: { ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/ignore-relative-path.js
tests/integration/__tests__/ignore-relative-path.js
describe("support relative paths", () => { runCli("cli/ignore-relative-path", [ "./shouldNotBeIgnored.js", "./level1/level2/level3/shouldNotBeFormat.js", "level1-glob/level2-glob/level3-glob/shouldNotBeFormat.js", "./level1-glob/level2-glob/level3-glob/shouldNotBeIgnored.scss", "level1-glob/should...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/ignore-path.js
tests/integration/__tests__/ignore-path.js
import fs from "node:fs/promises"; // `.js` files are ignored in `.gitignore` const files = [ "ignored-by-customignore.js", "ignored-by-gitignore.js", "ignored-by-prettierignore.js", ].map( (file) => new URL(`../cli/ignore-path/ignore-path-test/${file}`, import.meta.url), ); const clean = () => Promise.a...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/performance-flags.js
tests/integration/__tests__/performance-flags.js
describe("should not write file or print code when `--debug-benchmark` or `--debug-repeat` found", () => { const assertStderr = (message) => { expect( message.includes( "'--debug-repeat' found, running formatWithCursor 2 times", ), ).toBe(true); }; // Can't test `--debug-benchmark`, s...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/config-invalid.js
tests/integration/__tests__/config-invalid.js
import fs from "node:fs/promises"; import outdent from "outdent"; import jestPathSerializer from "../path-serializer.js"; expect.addSnapshotSerializer(jestPathSerializer); describe("throw error for unsupported extension", () => { runCli("cli/config/invalid", [ "--config", "file/.prettierrc.unsupported", ]...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/doc-utilities-clean-doc.js
tests/integration/__tests__/doc-utilities-clean-doc.js
import { align, cleanDoc, fill, group, ifBreak, indent, line, lineSuffix, } from "../../../src/document/index.js"; describe("cleanDoc", () => { test.each([ [ "fill", [fill([""]), fill([]), fill(["1"]), fill(["2", line, "3"])], [fill(["1"]), fill(["2", line, "3"])], ], ["...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/debug-print-doc.js
tests/integration/__tests__/debug-print-doc.js
describe("prints doc with --debug-print-doc", () => { runCli("cli/with-shebang", ["--debug-print-doc", "--parser", "babel"], { input: "0", }).test({ stdout: '["0", ";", hardline]', stderr: "", status: 0, write: [], }); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/infer-plugins-ext-dir.js
tests/integration/__tests__/infer-plugins-ext-dir.js
import { outdent } from "outdent"; describe("infer file ext that supported by only plugins", () => { describe("basic", () => { runCli("cli/infer-plugins-ext-dir/", ["--write", "src"]).test({ status: 0, stdout: "src/file.foo 0ms", write: [ { content: "!contents\n", fi...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/log-level.js
tests/integration/__tests__/log-level.js
test("do not show logs with --log-level silent", async () => { await runCliWithLogLevel("silent", null); }); test("do not show warnings with --log-level error", async () => { await runCliWithLogLevel("error", ["[error]"]); }); test("show errors and warnings with --log-level warn", async () => { await runCliWith...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/support-info.js
tests/integration/__tests__/support-info.js
import prettier from "../../config/prettier-entry.js"; test("API getSupportInfo()", async () => { expect(await getCoreInfo()).toMatchSnapshot(); }); describe("CLI --support-info", () => { runCli("cli", "--support-info").test({ status: 0 }); }); async function getCoreInfo() { const supportInfo = await prettier....
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/with-config-precedence.js
tests/integration/__tests__/with-config-precedence.js
import { outdent } from "outdent"; const TAB_WIDTH_3_OUTPUT = outdent` function foo() { ${" ".repeat(3)}return bar; } `; const TAB_WIDTH_5_OUTPUT = outdent` function foo() { ${" ".repeat(5)}return bar; } `; test("CLI overrides take precedence --config-precedence", async () => { const withoutFlag = await...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/debug-check.js
tests/integration/__tests__/debug-check.js
describe("doesn't crash when --debug-check is passed", () => { runCli("cli/with-shebang", ["issue1890.js", "--debug-check"]).test({ stdout: "issue1890.js", stderr: "", status: 0, }); }); describe("checks stdin with --debug-check", () => { runCli("cli/with-shebang", ["--debug-check", "--parser", "babe...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/check.js
tests/integration/__tests__/check.js
describe("checks stdin with --check", () => { runCli("cli/with-shebang", ["--check", "--parser", "babel"], { input: "0", }).test({ stdout: "(stdin)", stderr: "", status: "non-zero", }); }); describe("checks stdin with -c (alias for --check)", () => { runCli("cli/with-shebang", ["-c", "--parser"...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/schema.js
tests/integration/__tests__/schema.js
import { generateSchemaData } from "../../../scripts/utilities/generate-schema.js"; import prettier from "../../config/prettier-entry.js"; test("schema", async () => { const { options } = await prettier.getSupportInfo(); const schema = generateSchemaData(options); expect(schema).toMatchSnapshot(); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/integration/__tests__/print-code.js
tests/integration/__tests__/print-code.js
describe("Line breaking after filepath with errors", () => { runCli("cli/print-code", ["./ignored.js"], { stdoutIsTTY: true, }).test({ status: 0, write: [], stderr: "" }); runCli("cli/print-code", ["./not-ignored.js"], { stdoutIsTTY: true, }).test({ status: 0, write: [], stderr: "" }); });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false