Fix integration test (#12859)
This commit is contained in:
1 parent
8397527c05
commit
592f27ce0b
43 files changed
+236
-246
No files matched your search
@@ -50,4 +50,4 @@ jobs:
|
||||
run: npm install --global pnpm
|
||||
|
||||
- name: Run Tests
|
||||
run: yarn test:dev-package --maxWorkers=2
|
||||
run: yarn test:dev-package
|
||||
@@ -53,27 +53,13 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
# - name: Run Integration Tests (macOS)
|
||||
# if: ${{ matrix.os == 'macos-latest' }}
|
||||
# run: yarn test:integration --maxWorkers=4
|
||||
- name: Run Tests
|
||||
if: ${{ !matrix.ENABLE_CODE_COVERAGE }}
|
||||
run: yarn test
|
||||
|
||||
# - name: Run Integration Tests (Linux and Windows)
|
||||
# if: ${{ matrix.os != 'macos-latest' }}
|
||||
# run: yarn test:integration --maxWorkers=2
|
||||
|
||||
# - name: Upload Coverage
|
||||
# uses: codecov/codecov-action@v2.1.0
|
||||
# if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
||||
# with:
|
||||
# fail_ci_if_error: true
|
||||
|
||||
- name: Run Format Tests (macOS)
|
||||
if: ${{ matrix.os == 'macos-latest' }}
|
||||
run: yarn test:format --maxWorkers=4
|
||||
|
||||
- name: Run Format Tests (Linux and Windows)
|
||||
if: ${{ matrix.os != 'macos-latest' }}
|
||||
run: yarn c8 yarn test:format --maxWorkers=2
|
||||
- name: Run Tests (coverage)
|
||||
if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
||||
run: yarn c8 yarn test
|
||||
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@v3.1.0
|
||||
@@ -81,14 +67,14 @@ jobs:
|
||||
with:
|
||||
fail_ci_if_error: true
|
||||
|
||||
# # #8073 test
|
||||
# - name: Run Tests (PRETTIER_FALLBACK_RESOLVE)
|
||||
# run: yarn test "tests/integration/__tests__/(config|plugin)"
|
||||
# env:
|
||||
# PRETTIER_FALLBACK_RESOLVE: true
|
||||
# #8073 test
|
||||
- name: Run Tests (PRETTIER_FALLBACK_RESOLVE)
|
||||
run: yarn c8 yarn test "tests/integration/__tests__/(config|plugin)"
|
||||
env:
|
||||
PRETTIER_FALLBACK_RESOLVE: true
|
||||
|
||||
# - name: Upload Coverage (PRETTIER_FALLBACK_RESOLVE)
|
||||
# uses: codecov/codecov-action@v3.1.0
|
||||
# if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
||||
# with:
|
||||
# fail_ci_if_error: true
|
||||
- name: Upload Coverage (PRETTIER_FALLBACK_RESOLVE)
|
||||
uses: codecov/codecov-action@v3.1.0
|
||||
if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
||||
with:
|
||||
fail_ci_if_error: true
|
||||
@@ -104,21 +104,11 @@ jobs:
|
||||
name: dist
|
||||
path: dist
|
||||
|
||||
- name: Run Tests (macOS)
|
||||
if: ${{ matrix.os == 'macos-latest' }}
|
||||
run: yarn test:dist --maxWorkers=4
|
||||
- name: Run Tests
|
||||
run: yarn test:dist
|
||||
|
||||
- name: Run Tests (Linux and Windows)
|
||||
if: ${{ matrix.os != 'macos-latest' }}
|
||||
run: yarn test:dist --maxWorkers=2
|
||||
|
||||
- name: Run Format Tests (standalone) (macOS)
|
||||
if: ${{ matrix.os == 'macos-latest' }}
|
||||
run: yarn test:dist-standalone --maxWorkers=4
|
||||
|
||||
- name: Run Format Tests (standalone) (Linux and Windows)
|
||||
if: ${{ matrix.os != 'macos-latest' }}
|
||||
run: yarn test:dist-standalone --maxWorkers=2
|
||||
- name: Run Format Tests (standalone)
|
||||
run: yarn test:dist-standalone
|
||||
|
||||
# #8073 test
|
||||
- name: Run Tests (PRETTIER_FALLBACK_RESOLVE)
|
||||
|
||||
+19
-3
@@ -1,13 +1,29 @@
|
||||
.tmp
|
||||
dist/
|
||||
.cache/
|
||||
coverage/
|
||||
.nyc_output/
|
||||
.yarn/
|
||||
dist/
|
||||
node_modules/
|
||||
|
||||
/tests/format/**/*.*
|
||||
!/tests/format/**/jsfmt.spec.js
|
||||
/tests/integration/cli/
|
||||
/tests/integration/plugins/
|
||||
/tests/integration/plugins/**/*.*
|
||||
!/tests/integration/plugins/automatic/node_modules/@prettier/plugin-foo/index.js
|
||||
!/tests/integration/plugins/automatic/node_modules/@user/prettier-plugin-foobar/index.js
|
||||
!/tests/integration/plugins/automatic/node_modules/prettier-plugin-bar/index.js
|
||||
!/tests/integration/plugins/automatic/package.json
|
||||
!/tests/integration/plugins/automatic/prettier-plugin-bar.js
|
||||
!/tests/integration/plugins/bespoke/node_modules/@company/prettier-plugin-bespoke/main.js
|
||||
!/tests/integration/plugins/defaultOptions/plugin.cjs
|
||||
!/tests/integration/plugins/extensions/plugin.cjs
|
||||
!/tests/integration/plugins/flushLineSuffix/plugin.cjs
|
||||
!/tests/integration/plugins/options-string/plugin.cjs
|
||||
!/tests/integration/plugins/options/plugin.cjs
|
||||
!/tests/integration/plugins/preprocess/plugin.cjs
|
||||
/tests/integration/custom-parsers/
|
||||
|
||||
/website/build/
|
||||
/website/static/lib/
|
||||
/website/static/playground.js
|
||||
.nyc_output
|
||||
@@ -1,11 +0,0 @@
|
||||
import baseConfig from "./jest.config.mjs";
|
||||
|
||||
const config = {
|
||||
...baseConfig,
|
||||
runner: "jest-light-runner",
|
||||
testRegex: "tests/format/.*/jsfmt\\.spec\\.js$",
|
||||
setupFiles: ["<rootDir>/tests/config/format-test-setup.js"],
|
||||
projects: [],
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -1,14 +0,0 @@
|
||||
import baseConfig from "./jest.config.mjs";
|
||||
|
||||
const config = {
|
||||
...baseConfig,
|
||||
testRegex: "tests/integration/__tests__/.*\\.js$",
|
||||
setupFiles: ["<rootDir>/tests/integration/integration-test-setup.js"],
|
||||
projects: [],
|
||||
moduleNameMapper: {
|
||||
...baseConfig.moduleNameMapper,
|
||||
"prettier-local": "<rootDir>/tests/config/prettier-entry.common.cjs",
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
+6
-4
@@ -33,10 +33,11 @@ if (!isProduction) {
|
||||
}
|
||||
|
||||
const config = {
|
||||
projects: [
|
||||
"<rootDir>/jest-format-test.config.mjs",
|
||||
isProduction && "<rootDir>/jest-integration-test.config.mjs",
|
||||
].filter(Boolean),
|
||||
setupFiles: [
|
||||
"<rootDir>/tests/config/format-test-setup.js",
|
||||
"<rootDir>/tests/integration/integration-test-setup.js",
|
||||
],
|
||||
runner: "jest-light-runner",
|
||||
snapshotSerializers: [
|
||||
"jest-snapshot-serializer-raw",
|
||||
"jest-snapshot-serializer-ansi",
|
||||
@@ -45,6 +46,7 @@ const config = {
|
||||
escapeString: false,
|
||||
printBasicPrototype: false,
|
||||
},
|
||||
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
|
||||
testPathIgnorePatterns,
|
||||
collectCoverage: ENABLE_CODE_COVERAGE,
|
||||
collectCoverageFrom: ["<rootDir>/src/**/*.js", "<rootDir>/bin/**/*.js"],
|
||||
|
||||
+2
-4
@@ -123,7 +123,7 @@
|
||||
"esm-utils": "4.0.0",
|
||||
"execa": "6.1.0",
|
||||
"jest": "28.1.0",
|
||||
"jest-light-runner": "0.2.2",
|
||||
"jest-light-runner": "fisker/jest-light-runner#b5e893d3a7d301bfb5d68ed81eebadbe2bb0577d",
|
||||
"jest-snapshot-serializer-ansi": "1.0.0",
|
||||
"jest-snapshot-serializer-raw": "1.2.0",
|
||||
"jest-watch-typeahead": "1.1.0",
|
||||
@@ -140,9 +140,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test:integration": "echo \"Disabled temporary\" && exit 1",
|
||||
"test:format": "yarn test --config=jest-format-test.config.mjs",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand",
|
||||
"test:dev-package": "cross-env INSTALL_PACKAGE=1 yarn test",
|
||||
"test:dist": "cross-env NODE_ENV=production yarn test",
|
||||
"test:dist-standalone": "cross-env TEST_STANDALONE=1 yarn test:dist",
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
// This file exists because plugins for test use `require('prettier-local')`
|
||||
|
||||
const path = require("path");
|
||||
|
||||
module.exports = require(path.join(process.env.PRETTIER_DIR, "index.js"));
|
||||
@@ -8,7 +8,7 @@ import * as coreOptions from "../../../src/main/core-options.js";
|
||||
import codeSamples from "../../../website/playground/codeSamples.mjs";
|
||||
import jestPathSerializer from "../path-serializer.js";
|
||||
|
||||
const { require } = createEsmUtils(import.meta);
|
||||
const { require, importModule } = createEsmUtils(import.meta);
|
||||
|
||||
expect.addSnapshotSerializer(jestPathSerializer);
|
||||
|
||||
@@ -41,13 +41,13 @@ describe("standalone", () => {
|
||||
let esmStandalone;
|
||||
let esmPlugins;
|
||||
beforeAll(async () => {
|
||||
esmStandalone = await import(
|
||||
esmStandalone = await importModule(
|
||||
path.join(distDirectory, "esm/standalone.mjs")
|
||||
);
|
||||
esmPlugins = await Promise.all(
|
||||
fastGlob
|
||||
.sync(["esm/parser-*.mjs"], { cwd: distDirectory, absolute: true })
|
||||
.map(async (file) => (await import(file)).default)
|
||||
.map(async (file) => (await importModule(file)).default)
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from "node:path";
|
||||
import prettier from "prettier-local";
|
||||
import createEsmUtils from "esm-utils";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
import runPrettier from "../run-prettier.js";
|
||||
import jestPathSerializer from "../path-serializer.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import prettier from "prettier-local";
|
||||
import { outdent } from "outdent";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
|
||||
const {
|
||||
__debug: { parse, formatAST, formatDoc, printToDoc, printDocToString },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
const {
|
||||
concat,
|
||||
join,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
const docPrinter = prettier.doc.printer;
|
||||
const docBuilders = prettier.doc.builders;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import prettier from "prettier-local";
|
||||
import { outdent } from "outdent";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
|
||||
const docPrinter = prettier.doc.printer;
|
||||
const docBuilders = prettier.doc.builders;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
const docBuilders = prettier.doc.builders;
|
||||
const docUtils = prettier.doc.utils;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
|
||||
describe("show version with --version", () => {
|
||||
runPrettier("cli/with-shebang", ["--version"]).test({
|
||||
stdout: prettier.version + "\n",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
import { temporaryDirectory as getTemporaryDirectory } from "tempy";
|
||||
import prettier from "prettier-local";
|
||||
import createEsmUtils from "esm-utils";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
import runPrettier from "../run-prettier.js";
|
||||
import jestPathSerializer from "../path-serializer.js";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
const { formatAST } = prettier.__debug;
|
||||
|
||||
describe("formatAST", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import prettier from "prettier-local";
|
||||
import { outdent } from "outdent";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
import fooPlugin from "../plugins/defaultOptions/plugin.cjs";
|
||||
|
||||
test("yaml parser should handle CRLF correctly", async () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import prettier from "prettier-local";
|
||||
const { jest } = import.meta;
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
|
||||
describe("stdin no path and no parser", () => {
|
||||
describe("logs error and exits with 2", () => {
|
||||
@@ -169,25 +168,33 @@ describe("--write and --list-different with unknown path and no parser", () => {
|
||||
|
||||
describe("API with no path and no parser", () => {
|
||||
const _console = global.console;
|
||||
const result = { called: 0, arguments: [] };
|
||||
|
||||
beforeEach(() => {
|
||||
global.console = { warn: jest.fn() };
|
||||
global.console = {
|
||||
warn(...args) {
|
||||
result.called += 1;
|
||||
result.arguments = args;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
result.called = 0;
|
||||
result.arguments = [];
|
||||
global.console = _console;
|
||||
});
|
||||
|
||||
test("prettier.format", async () => {
|
||||
expect(await prettier.format(" foo ( )")).toBe("foo();\n");
|
||||
expect(global.console.warn).toHaveBeenCalledTimes(1);
|
||||
expect(global.console.warn.mock.calls[0]).toMatchSnapshot();
|
||||
expect(result.called).toBe(1);
|
||||
expect(result.arguments).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test("prettier.check", async () => {
|
||||
expect(await prettier.check(" foo ( )")).toBe(false);
|
||||
expect(global.console.warn).toHaveBeenCalledTimes(1);
|
||||
expect(global.console.warn.mock.calls[0]).toMatchSnapshot();
|
||||
expect(result.called).toBe(1);
|
||||
expect(result.arguments).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from "node:path";
|
||||
import prettier from "prettier-local";
|
||||
import createEsmUtils from "esm-utils";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
import runPrettier from "../run-prettier.js";
|
||||
import jestPathSerializer from "../path-serializer.js";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @type {import('prettier')} */
|
||||
import prettier from "prettier-local";
|
||||
import { outdent } from "outdent";
|
||||
/** @type {import('prettier')} */
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
import printDoc from "../print-doc.js";
|
||||
|
||||
const { group, indent, line, lineSuffix, lineSuffixBoundary, softline } =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
const docBuilders = prettier.doc.builders;
|
||||
const docUtils = prettier.doc.utils;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
|
||||
test("allows custom parser provided as object", async () => {
|
||||
const output = await prettier.format("1", {
|
||||
parser(text) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from "node:path";
|
||||
import prettier from "prettier-local";
|
||||
import createEsmUtils from "esm-utils";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
|
||||
const { __dirname } = createEsmUtils(import.meta);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
import generateSchema from "../../../scripts/utils/generate-schema.mjs";
|
||||
|
||||
test("schema", async () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
|
||||
test("API getSupportInfo()", async () => {
|
||||
expect(await getCoreInfo()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import prettier from "prettier-local";
|
||||
import { outdent } from "outdent";
|
||||
import prettier from "../../config/prettier-entry.js";
|
||||
|
||||
describe("infers postcss parser", () => {
|
||||
runPrettier("cli/with-parser-inference", ["--end-of-line", "lf", "*"]).test({
|
||||
status: 0,
|
||||
|
||||
+13
-10
@@ -1,25 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
const prettier = require('../../../../../../config/prettier-entry.common.cjs');
|
||||
const concat = prettier.doc.builders.concat;
|
||||
|
||||
module.exports = {
|
||||
languages: [
|
||||
{
|
||||
name: "foo",
|
||||
parsers: ["foo"],
|
||||
extensions: [".foo"]
|
||||
}
|
||||
extensions: [".foo"],
|
||||
},
|
||||
],
|
||||
parsers: {
|
||||
foo: {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "foo"
|
||||
}
|
||||
astFormat: "foo",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
foo: {
|
||||
print: path => concat(["foo+", path.getValue().text])
|
||||
}
|
||||
}
|
||||
async print(path) {
|
||||
const { default: prettier } = await import(
|
||||
"../../../../../../config/prettier-entry.js"
|
||||
);
|
||||
const { concat } = prettier.doc.builders;
|
||||
return concat(["foo+", path.getValue().text]);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
Generated
Vendored
+13
-10
@@ -1,25 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
const prettier = require('../../../../../../config/prettier-entry.common.cjs');
|
||||
const concat = prettier.doc.builders.concat;
|
||||
|
||||
module.exports = {
|
||||
languages: [
|
||||
{
|
||||
name: "foobar",
|
||||
parsers: ["foobar"],
|
||||
extensions: [".foobar"]
|
||||
}
|
||||
extensions: [".foobar"],
|
||||
},
|
||||
],
|
||||
parsers: {
|
||||
foobar: {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "foobar"
|
||||
}
|
||||
astFormat: "foobar",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
foobar: {
|
||||
print: path => concat(["foobar+", path.getValue().text])
|
||||
}
|
||||
}
|
||||
async print(path) {
|
||||
const { default: prettier } = await import(
|
||||
"../../../../../../config/prettier-entry.js"
|
||||
);
|
||||
const { concat } = prettier.doc.builders;
|
||||
return concat(["foobar+", path.getValue().text]);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
+14
-15
@@ -1,31 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
const prettier = require('../../../../../config/prettier-entry.common.cjs');
|
||||
const { concat } = prettier.doc.builders;
|
||||
|
||||
module.exports = {
|
||||
languages: [
|
||||
{
|
||||
name: "bar",
|
||||
parsers: ["bar"]
|
||||
}
|
||||
parsers: ["bar"],
|
||||
},
|
||||
],
|
||||
parsers: {
|
||||
bar: {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "bar"
|
||||
}
|
||||
astFormat: "bar",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
bar: {
|
||||
print: path =>
|
||||
concat([
|
||||
"content from `prettier-plugin-bar` package + ",
|
||||
path.getValue().text
|
||||
])
|
||||
}
|
||||
async print(path) {
|
||||
const { default: prettier } = await import(
|
||||
"../../../../../config/prettier-entry.js"
|
||||
);
|
||||
const { concat } = prettier.doc.builders;
|
||||
return concat(["content from `prettier-plugin-bar` package + ", path.getValue().text]);
|
||||
},
|
||||
},
|
||||
},
|
||||
defaultOptions: {
|
||||
tabWidth: 4
|
||||
}
|
||||
tabWidth: 4,
|
||||
},
|
||||
};
|
||||
@@ -1 +1,3 @@
|
||||
{"type": "commonjs"}
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
@@ -1,31 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
const prettier = require("../../../config/prettier-entry.common.cjs");
|
||||
const { concat } = prettier.doc.builders;
|
||||
|
||||
module.exports = {
|
||||
languages: [
|
||||
{
|
||||
name: "bar",
|
||||
parsers: ["bar"]
|
||||
}
|
||||
parsers: ["bar"],
|
||||
},
|
||||
],
|
||||
parsers: {
|
||||
bar: {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "bar"
|
||||
}
|
||||
parse: (text) => ({ text }),
|
||||
astFormat: "bar",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
bar: {
|
||||
print: path =>
|
||||
concat([
|
||||
async print(path) {
|
||||
const { default: prettier } = await import(
|
||||
"../../../config/prettier-entry.js"
|
||||
);
|
||||
const { concat } = prettier.doc.builders;
|
||||
|
||||
return concat([
|
||||
"content from `prettier-plugin-bar.js` file + ",
|
||||
path.getValue().text
|
||||
])
|
||||
}
|
||||
path.getValue().text,
|
||||
]);
|
||||
},
|
||||
},
|
||||
},
|
||||
defaultOptions: {
|
||||
tabWidth: 4
|
||||
}
|
||||
tabWidth: 4,
|
||||
},
|
||||
};
|
||||
Generated
Vendored
+12
-9
@@ -1,24 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
const prettier = require('../../../../../../config/prettier-entry.common.cjs');
|
||||
const concat = prettier.doc.builders.concat;
|
||||
|
||||
module.exports = {
|
||||
languages: [
|
||||
{
|
||||
name: "bespoke",
|
||||
parsers: ["bespoke"]
|
||||
}
|
||||
parsers: ["bespoke"],
|
||||
},
|
||||
],
|
||||
parsers: {
|
||||
bespoke: {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "bespoke"
|
||||
}
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
bespoke: {
|
||||
print: path => concat(["bespoke+", path.getValue().text])
|
||||
}
|
||||
}
|
||||
async print(path) {
|
||||
const { default: prettier } = await import(
|
||||
"../../../../../../config/prettier-entry.js"
|
||||
);
|
||||
const { concat } = prettier.doc.builders;
|
||||
return concat(["bespoke+", path.getValue().text]);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -5,26 +5,26 @@ module.exports = {
|
||||
{
|
||||
name: "foo",
|
||||
parsers: ["foo-parser"],
|
||||
extensions: [".foo"]
|
||||
}
|
||||
extensions: [".foo"],
|
||||
},
|
||||
],
|
||||
defaultOptions: {
|
||||
tabWidth: 8,
|
||||
bracketSpacing: false
|
||||
bracketSpacing: false,
|
||||
},
|
||||
parsers: {
|
||||
"foo-parser": {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "foo-ast"
|
||||
}
|
||||
parse: (text) => ({ text }),
|
||||
astFormat: "foo-ast",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
"foo-ast": {
|
||||
print: (path, options) =>
|
||||
JSON.stringify({
|
||||
tabWidth: options.tabWidth,
|
||||
bracketSpacing: options.bracketSpacing
|
||||
})
|
||||
}
|
||||
}
|
||||
bracketSpacing: options.bracketSpacing,
|
||||
}),
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,25 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
const prettier = require("../../../config/prettier-entry.common.cjs");
|
||||
const { concat } = prettier.doc.builders;
|
||||
|
||||
module.exports = {
|
||||
languages: [
|
||||
{
|
||||
name: "foo",
|
||||
parsers: ["foo-parser"],
|
||||
extensions: [".foo"]
|
||||
}
|
||||
extensions: [".foo"],
|
||||
},
|
||||
],
|
||||
parsers: {
|
||||
"foo-parser": {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "foo-ast"
|
||||
}
|
||||
parse: (text) => ({ text }),
|
||||
astFormat: "foo-ast",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
"foo-ast": {
|
||||
print: path => concat(["!", path.getValue().text])
|
||||
}
|
||||
}
|
||||
async print(path) {
|
||||
const { default: prettier } = await import(
|
||||
"../../../config/prettier-entry.js"
|
||||
);
|
||||
const { concat } = prettier.doc.builders;
|
||||
return concat(["!", path.getValue().text]);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,25 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
const prettier = require("../../../config/prettier-entry.common.cjs");
|
||||
const { lineSuffix } = prettier.doc.builders;
|
||||
|
||||
module.exports = {
|
||||
languages: [
|
||||
{
|
||||
name: "foo",
|
||||
parsers: ["foo-parser"],
|
||||
extensions: [".foo"]
|
||||
}
|
||||
extensions: [".foo"],
|
||||
},
|
||||
],
|
||||
parsers: {
|
||||
"foo-parser": {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "foo-ast"
|
||||
}
|
||||
parse: (text) => ({ text }),
|
||||
astFormat: "foo-ast",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
"foo-ast": {
|
||||
print: path => lineSuffix(path.getValue().text.trim())
|
||||
}
|
||||
}
|
||||
async print(path) {
|
||||
const { default: prettier } = await import(
|
||||
"../../../config/prettier-entry.js"
|
||||
);
|
||||
const { lineSuffix } = prettier.doc.builders;
|
||||
return lineSuffix(path.getValue().text.trim());
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -6,26 +6,26 @@ module.exports = {
|
||||
name: "foo",
|
||||
parsers: ["foo-parser"],
|
||||
extensions: [".foo"],
|
||||
since: "1.0.0"
|
||||
}
|
||||
since: "1.0.0",
|
||||
},
|
||||
],
|
||||
options: {
|
||||
fooString: {
|
||||
type: "string",
|
||||
default: "bar",
|
||||
description: "foo description"
|
||||
}
|
||||
description: "foo description",
|
||||
},
|
||||
},
|
||||
parsers: {
|
||||
"foo-parser": {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "foo-ast"
|
||||
}
|
||||
parse: (text) => ({ text }),
|
||||
astFormat: "foo-ast",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
"foo-ast": {
|
||||
print: (path, options) =>
|
||||
options.fooString ? `foo:${options.fooString}` : path.getValue().text
|
||||
}
|
||||
}
|
||||
options.fooString ? `foo:${options.fooString}` : path.getValue().text,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -6,8 +6,8 @@ module.exports = {
|
||||
name: "foo",
|
||||
parsers: ["foo-parser"],
|
||||
extensions: [".foo"],
|
||||
since: "1.0.0"
|
||||
}
|
||||
since: "1.0.0",
|
||||
},
|
||||
],
|
||||
options: {
|
||||
fooOption: {
|
||||
@@ -17,25 +17,25 @@ module.exports = {
|
||||
choices: [
|
||||
{
|
||||
value: "bar",
|
||||
description: "bar description"
|
||||
description: "bar description",
|
||||
},
|
||||
{
|
||||
value: "baz",
|
||||
description: "baz description"
|
||||
}
|
||||
]
|
||||
}
|
||||
description: "baz description",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
parsers: {
|
||||
"foo-parser": {
|
||||
parse: text => ({ text }),
|
||||
astFormat: "foo-ast"
|
||||
}
|
||||
parse: (text) => ({ text }),
|
||||
astFormat: "foo-ast",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
"foo-ast": {
|
||||
print: (path, options) =>
|
||||
options.fooOption ? `foo:${options.fooOption}` : path.getValue().text
|
||||
}
|
||||
}
|
||||
options.fooOption ? `foo:${options.fooOption}` : path.getValue().text,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -6,19 +6,19 @@ module.exports = {
|
||||
name: "foo",
|
||||
parsers: ["foo-parser"],
|
||||
extensions: [".foo"],
|
||||
since: "1.0.0"
|
||||
}
|
||||
since: "1.0.0",
|
||||
},
|
||||
],
|
||||
parsers: {
|
||||
"foo-parser": {
|
||||
preprocess: text => `preprocessed:${text}`,
|
||||
parse: text => ({ text }),
|
||||
astFormat: "foo-ast"
|
||||
}
|
||||
preprocess: (text) => `preprocessed:${text}`,
|
||||
parse: (text) => ({ text }),
|
||||
astFormat: "foo-ast",
|
||||
},
|
||||
},
|
||||
printers: {
|
||||
"foo-ast": {
|
||||
print: path => path.getValue().text
|
||||
}
|
||||
}
|
||||
print: (path) => path.getValue().text,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @type {import('prettier')} */
|
||||
import prettier from "prettier-local";
|
||||
import prettier from "../config/prettier-entry.js";
|
||||
|
||||
function printDoc(doc) {
|
||||
// This dummy plugin ignores the input and simply returns the given doc.
|
||||
|
||||
@@ -5060,9 +5060,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jest-light-runner@npm:0.2.2":
|
||||
"jest-light-runner@fisker/jest-light-runner#b5e893d3a7d301bfb5d68ed81eebadbe2bb0577d":
|
||||
version: 0.2.2
|
||||
resolution: "jest-light-runner@npm:0.2.2"
|
||||
resolution: "jest-light-runner@https://github.com/fisker/jest-light-runner.git#commit=b5e893d3a7d301bfb5d68ed81eebadbe2bb0577d"
|
||||
dependencies:
|
||||
"@jest/expect": ^28.0.2
|
||||
jest-circus: ^28.0.0
|
||||
@@ -5073,7 +5073,7 @@ __metadata:
|
||||
supports-color: ^9.2.1
|
||||
peerDependencies:
|
||||
jest: ^27.0.0 || ^28.0.0
|
||||
checksum: cf837fc1fbd1bb370dcf93f346d500118ba53b968594a36752cd67c1e57c0262334897919ccd188943b13b4262e5194502de5eca20c79c76f33c4ccabb01dd00
|
||||
checksum: 9eb43cacaad844853d1e53bf3205c5729fef6569e45407dd51cd39c18fa8491cfe981245dec49b0bbf4965cbd2e77730d41fba4836baf98b00b843a1b307e986
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6850,7 +6850,7 @@ __metadata:
|
||||
ignore: 5.2.0
|
||||
jest: 28.1.0
|
||||
jest-docblock: 28.1.1
|
||||
jest-light-runner: 0.2.2
|
||||
jest-light-runner: "fisker/jest-light-runner#b5e893d3a7d301bfb5d68ed81eebadbe2bb0577d"
|
||||
jest-snapshot-serializer-ansi: 1.0.0
|
||||
jest-snapshot-serializer-raw: 1.2.0
|
||||
jest-watch-typeahead: 1.1.0
|
||||
|
||||
Reference in new issue
Block a user