diff --git a/test/__fixtures__/plugin-extensions/file.foo b/test/__fixtures__/plugin-extensions/file.foo new file mode 100644 index 0000000..12f00e9 --- /dev/null +++ b/test/__fixtures__/plugin-extensions/file.foo @@ -0,0 +1 @@ +contents diff --git a/test/__fixtures__/plugin-extensions/plugin.cjs b/test/__fixtures__/plugin-extensions/plugin.cjs new file mode 100644 index 0000000..be9f6c9 --- /dev/null +++ b/test/__fixtures__/plugin-extensions/plugin.cjs @@ -0,0 +1,24 @@ +"use strict"; + +module.exports = { + languages: [ + { + name: "foo", + parsers: ["foo-parser"], + extensions: [".foo"], + }, + ], + parsers: { + "foo-parser": { + parse: (text) => ({ text }), + astFormat: "foo-ast", + }, + }, + printers: { + "foo-ast": { + print(path) { + return ["!", path.getValue().text]; + }, + }, + }, +}; diff --git a/test/__tests__/plugin-extensions.js b/test/__tests__/plugin-extensions.js new file mode 100644 index 0000000..cbfcbbd --- /dev/null +++ b/test/__tests__/plugin-extensions.js @@ -0,0 +1,15 @@ +import { runCli } from "../utils"; + +describe("uses 'extensions' from languages to determine parser", () => { + runCli("plugin-extensions", [ + "*.foo", + "--plugin=./plugin.cjs", + ], { + ignoreLineEndings: true, + }).test({ + stdout: "!contents", + stderr: "", + status: 0, + write: [], + }); +}); diff --git a/test/__tests__/plugin-flush-line-suffix.js b/test/__tests__/plugin-flush-line-suffix.js index 7e9bc9d..bd25b09 100644 --- a/test/__tests__/plugin-flush-line-suffix.js +++ b/test/__tests__/plugin-flush-line-suffix.js @@ -3,7 +3,7 @@ import { runCli } from "../utils"; describe("flush all line-suffix content", () => { runCli("plugin-flush-line-suffix", [ "*.foo", - "--plugin=./plugin.cjs" + "--plugin=./plugin.cjs", ], { ignoreLineEndings: true, }).test({