Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9,679 changes: 5,546 additions & 4,133 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"compile:watch": "tsc --outDir dist --watch",
"format": "npm run compile && node dist/bin.js --write src test",
"prepublishOnly": "npm run compile",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --rootDir test/__tests__ --testTimeout 60000",
"test": "jest --rootDir test/__tests__ --testTimeout 60000 --runner=jest-light-runner",
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
Expand Down Expand Up @@ -65,7 +65,8 @@
"@types/js-yaml": "^4.0.9",
"@types/node": "^22.14.1",
"cross-env": "^7.0.3",
"jest": "^29.7.0",
"jest": "^30.0.0-alpha.7",
"jest-light-runner": "^0.7.8",
"jest-snapshot-serializer-ansi": "^2.2.1",
"jest-snapshot-serializer-raw": "^2.0.0",
"json-archive": "^2.1.0",
Expand Down
9 changes: 0 additions & 9 deletions test/__tests__/__snapshots__/arg-parsing.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ exports[`number file/dir (stdout) 5`] = `
4.44"
`;

exports[`options with \`cliName\` should not allow to pass directly (stderr) 1`] = `
"[warn] Ignored unknown option --filepath=file.js.
[error] No parser and no file path given, couldn't infer a parser."
`;

exports[`options with \`cliName\` should not allow to pass directly (stdout) 1`] = `"prettier();"`;

exports[`options with \`cliName\` should not allow to pass directly (stdout) 2`] = `""`;

exports[`unknown negated options are errored (stderr) 1`] = `
"
Unknown option: "unknown"
Expand Down
6 changes: 0 additions & 6 deletions test/__tests__/__snapshots__/ignore-emoji.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,3 @@ exports[`ignores file name contains emoji (stderr) 1`] = `""`;
exports[`ignores file name contains emoji (stdout) 1`] = `"not-ignored.js"`;

exports[`ignores file name contains emoji (write) 1`] = `[]`;

exports[`stdin (stderr) 1`] = `""`;

exports[`stdin (stdout) 1`] = `".name { display: none; }"`;

exports[`stdin (write) 1`] = `[]`;
11 changes: 0 additions & 11 deletions test/__tests__/__snapshots__/patterns.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ regular-module.js"

exports[`multiple patterns with a negated pattern (write) 1`] = `[]`;

exports[`multiple patterns with a negated pattern and leading \`./\`, ignores node_modules by default (stderr) 1`] = `""`;

exports[`multiple patterns with a negated pattern and leading \`./\`, ignores node_modules by default (stdout) 1`] = `
"other-directory/file.js
other-directory/nested-directory/nested-directory-file.js
other-regular-modules.js
regular-module.js"
`;

exports[`multiple patterns with a negated pattern and leading \`./\`, ignores node_modules by default (write) 1`] = `[]`;

exports[`multiple patterns with a negated pattern, doesn't ignore node_modules with the --with-node-modules flag (stderr) 1`] = `""`;

exports[`multiple patterns with a negated pattern, doesn't ignore node_modules with the --with-node-modules flag (stdout) 1`] = `
Expand Down
41 changes: 0 additions & 41 deletions test/__tests__/__snapshots__/write.js.snap

This file was deleted.

2 changes: 1 addition & 1 deletion test/__tests__/arg-parsing.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("boolean flags do not swallow the next argument", () => {
runCli("arg-parsing", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/check.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("checks stdin with --check", () => {
runCli("with-shebang", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/cursor-offset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("write cursorOffset to stderr with --cursor-offset <int>", () => {
runCli("", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/early-exit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";
import { PRETTIER_VERSION } from "../../dist/constants.js";

describe("show version with --version", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/error-on-unmatched-pattern.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("no error on unmatched pattern", () => {
runCli("error-on-unmatched-pattern", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/ignore-absolute-path.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from "node:path";
import dirname from "tiny-dirname";
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("support absolute filename", () => {
runCli("ignore-absolute-path", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/ignore-emoji.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("ignores file name contains emoji", () => {
runCli("ignore-emoji", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/ignore-folder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("ignores files in ignored folders", () => {
runCli("ignore-folder", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/ignore-in-subdirectories.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("ignores files when executing in a subdirectory", () => {
runCli("ignore-in-subdirectories/web1", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/ignore-path.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "node:fs";
import { getFixturesPath, runCli } from "../utils";
import { getFixturesPath, runCli } from "../utils.js";

// These `.js` files are ignored in `.gitignore`, so we need to write them manually here
[
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/ignore-relative-path.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("support relative paths", () => {
runCli("ignore-relative-path", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/ignore-unknown.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("ignore-unknown dir", () => {
runCli("ignore-unknown", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/ignore-vcs-files.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("ignores files in version control systems, if discovered", () => {
runCli("ignore-vcs-files", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/invalid-ignore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("ignores .prettierignore folder", () => {
runCli("invalid-ignore", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/list-different.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("checks stdin with --list-different", () => {
runCli("with-shebang", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/patterns-glob.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

/*
fixtures-1/
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/patterns.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("multiple patterns", () => {
runCli("patterns", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/plugin-default-options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("plugin default options should work", () => {
runCli("plugin-default-options", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/plugin-extensions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("uses 'extensions' from languages to determine parser", () => {
runCli("plugin-extensions", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/plugin-flush-line-suffix.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("flush all line-suffix content", () => {
runCli("plugin-flush-line-suffix", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/plugin-options-string.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

test("show external options with `--help`", async () => {
const originalStdout = await runCli("plugin-options-string", ["--help"])
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/plugin-options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

test("show external options with `--help`", async () => {
const originalStdout = await runCli("plugin-options", ["--help"]).stdout;
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/plugin-precedence.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("json-stringify takes precedence over json for package.json", () => {
runCli("", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/plugin-preprocess.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("parser preprocess function is used to reshape input text", () => {
runCli("plugin-preprocess", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/print-code.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("Line breaking after filepath with errors", () => {
runCli("print-code", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/skip-folders.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("skips folders in glob", () => {
runCli("skip-folders", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/syntax-error.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("exits with non-zero code when input has a syntax error", () => {
runCli("with-shebang", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/with-node-modules.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("ignores node_modules by default", () => {
runCli("with-node-modules", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/with-parser-inference.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("infers postcss parser", () => {
runCli("with-parser-inference", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/with-shebang.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

describe("preserves shebang", () => {
runCli("with-shebang", [
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/write.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "../utils";
import { runCli } from "../utils.js";

//TODO: Align the output for the following tests

Expand Down
1 change: 0 additions & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import process from "node:process";
import Base64 from "radix64-encoding";
import zeptoid from "zeptoid";

import { expect, test } from "@jest/globals";
import serializerRaw from "jest-snapshot-serializer-raw";
import serializerAnsi from "jest-snapshot-serializer-ansi";

Expand Down