diff --git a/package.json b/package.json index 80d3624c..15b8e4d7 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "cjk-regex": "1.0.2", "cosmiconfig": "3.1.0", "dashify": "0.2.2", + "dedent": "0.7.0", "diff": "3.2.0", "editorconfig": "0.14.2", "editorconfig-to-prettier": "0.0.6", @@ -80,6 +81,7 @@ "rollup-plugin-node-resolve": "2.0.0", "rollup-plugin-replace": "1.2.1", "shelljs": "0.7.8", + "snapshot-diff": "0.2.2", "strip-ansi": "4.0.0", "sw-toolbox": "3.6.0", "uglify-es": "3.0.28", diff --git a/src/cli/constant.js b/src/cli/constant.js index ce665189..7bf45adc 100644 --- a/src/cli/constant.js +++ b/src/cli/constant.js @@ -1,6 +1,7 @@ "use strict"; const camelCase = require("camelcase"); +const dedent = require("dedent"); const CATEGORY_CONFIG = "Config"; const CATEGORY_EDITOR = "Editor"; @@ -135,10 +136,10 @@ const detailedOptions = normalizeDetailedOptions({ }, { value: "prefer-file", - description: dedent(` + description: dedent` If a config file is found will evaluate it and ignore other CLI options. If no config file is found CLI options will evaluate as normal. - `) + ` } ], description: @@ -149,10 +150,10 @@ const detailedOptions = normalizeDetailedOptions({ category: CATEGORY_EDITOR, exception: -1, forwardToApi: true, - description: dedent(` + description: dedent` Print (to stderr) where a cursor at the given position would move to after formatting. This option cannot be used with --range-start and --range-end. - `) + ` }, "debug-check": { type: "boolean" @@ -183,10 +184,10 @@ const detailedOptions = normalizeDetailedOptions({ help: { type: "flag", alias: "h", - description: dedent(` + description: dedent` Show CLI usage, or details about the given flag. Example: --help write - `) + ` }, "ignore-path": { type: "path", @@ -197,9 +198,9 @@ const detailedOptions = normalizeDetailedOptions({ "insert-pragma": { type: "boolean", forwardToApi: true, - description: dedent(` + description: dedent` Insert @format pragma into file's first docblock comment. - `) + ` }, "jsx-bracket-same-line": { type: "boolean", @@ -276,29 +277,29 @@ const detailedOptions = normalizeDetailedOptions({ category: CATEGORY_EDITOR, forwardToApi: true, exception: Infinity, - description: dedent(` + description: dedent` Format code ending at a given character offset (exclusive). The range will extend forwards to the end of the selected statement. This option cannot be used with --cursor-offset. - `) + ` }, "range-start": { type: "int", category: CATEGORY_EDITOR, forwardToApi: true, - description: dedent(` + description: dedent` Format code starting at a given character offset. The range will extend backwards to the start of the first line containing the selected statement. This option cannot be used with --cursor-offset. - `) + ` }, "require-pragma": { type: "boolean", forwardToApi: true, - description: dedent(` + description: dedent` Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted. - `) + ` }, semi: { type: "boolean", @@ -399,17 +400,12 @@ const minimistOptions = { ) }; -const usageSummary = ` -Usage: prettier [options] [file/glob ...] +const usageSummary = dedent` + Usage: prettier [options] [file/glob ...] -By default, output is written to stdout. -Stdin is read if it is piped to Prettier and no files are given. -`.trim(); - -function dedent(str) { - const spaces = str.match(/\n^( +)/m)[1].length; - return str.replace(new RegExp(`^ {${spaces}}`, "gm"), "").trim(); -} + By default, output is written to stdout. + Stdin is read if it is piped to Prettier and no files are given. +`; function normalizeDetailedOptions(rawDetailedOptions) { const names = Object.keys(rawDetailedOptions).sort(); diff --git a/src/common/support.js b/src/common/support.js index 89797c36..c153a410 100644 --- a/src/common/support.js +++ b/src/common/support.js @@ -1,17 +1,225 @@ "use strict"; +const util = require("./util"); +const dedent = require("dedent"); const semver = require("semver"); const currentVersion = require("../../package.json").version; const loadPlugins = require("./load-plugins"); -function getSupportInfo(version, options) { +const CATEGORY_GLOBAL = "Global"; +const CATEGORY_SPECIAL = "Special"; + +/** + * @typedef {Object} OptionInfo + * @property {string} since - available since version + * @property {string} category + * @property {'int' | 'boolean' | 'choice' | 'path'} type + * @property {boolean?} deprecated - deprecated since version + * @property {OptionRedirectInfo?} redirect - redirect deprecated option + * @property {string} description + * @property {string?} oppositeDescription - for `false` option + * @property {OptionValueInfo} default + * @property {OptionRangeInfo?} range - for type int + * @property {OptionChoiceInfo?} choices - for type choice + * + * @typedef {number | boolean | string} OptionValue + * @typedef {OptionValue | Array<{ since: string, value: OptionValue}>} OptionValueInfo + * + * @typedef {Object} OptionRedirectInfo + * @property {string} option + * @property {OptionValue} value + * + * @typedef {Object} OptionRangeInfo + * @property {number} start - recommended range start + * @property {number} end - recommended range end + * @property {number} step - recommended range step + * + * @typedef {Object} OptionChoiceInfo + * @property {boolean | string} value - boolean for the option that is originally boolean type + * @property {string?} description - undefined if redirect + * @property {string?} since - undefined if available since the first version of the option + * @property {string?} deprecated - deprecated since version + * @property {OptionValueInfo?} redirect - redirect deprecated value + */ +/** @type {{ [name: string]: OptionInfo } */ +const supportOptions = { + cursorOffset: { + since: "1.4.0", + category: CATEGORY_SPECIAL, + type: "int", + default: -1, + range: { start: -1, end: Infinity, step: 1 }, + description: dedent` + Print (to stderr) where a cursor at the given position would move to after formatting. + This option cannot be used with --range-start and --range-end. + ` + }, + filepath: { + since: "1.4.0", + category: CATEGORY_SPECIAL, + type: "path", + default: undefined, + description: + "Specify the input filepath. This will be used to do parser inference." + }, + insertPragma: { + since: "1.8.0", + category: CATEGORY_SPECIAL, + type: "boolean", + default: false, + description: "Insert @format pragma into file's first docblock comment." + }, + parser: { + since: "0.0.10", + category: CATEGORY_GLOBAL, + type: "choice", + default: "babylon", + description: "Which parser to use.", + choices: [ + { value: "babylon", description: "JavaScript" }, + { value: "flow", description: "Flow" }, + { value: "typescript", since: "1.4.0", description: "TypeScript" }, + { value: "css", since: "1.7.1", description: "CSS" }, + { + value: "postcss", + since: "1.4.0", + description: "CSS/Less/SCSS", + deprecated: "1.7.1", + redirect: "css" + }, + { value: "less", since: "1.7.1", description: "Less" }, + { value: "scss", since: "1.7.1", description: "SCSS" }, + { value: "json", since: "1.5.0", description: "JSON" }, + { value: "graphql", since: "1.5.0", description: "GraphQL" }, + { value: "markdown", since: "1.8.0", description: "Markdown" } + ] + }, + printWidth: { + since: "0.0.0", + category: CATEGORY_GLOBAL, + type: "int", + default: 80, + description: "The line length where Prettier will try wrap.", + range: { start: 0, end: Infinity, step: 1 } + }, + rangeEnd: { + since: "1.4.0", + category: CATEGORY_SPECIAL, + type: "int", + default: Infinity, + range: { start: 0, end: Infinity, step: 1 }, + description: dedent` + Format code ending at a given character offset (exclusive). + The range will extend forwards to the end of the selected statement. + This option cannot be used with --cursor-offset. + ` + }, + rangeStart: { + since: "1.4.0", + category: CATEGORY_SPECIAL, + type: "int", + default: 0, + range: { start: 0, end: Infinity, step: 1 }, + description: dedent` + Format code starting at a given character offset. + The range will extend backwards to the start of the first line containing the selected statement. + This option cannot be used with --cursor-offset. + ` + }, + requirePragma: { + since: "1.7.0", + category: CATEGORY_SPECIAL, + type: "boolean", + default: false, + description: dedent` + Require either '@prettier' or '@format' to be present in the file's first docblock comment + in order for it to be formatted. + ` + }, + tabWidth: { + type: "int", + category: CATEGORY_GLOBAL, + default: 2, + description: "Number of spaces per indentation level.", + range: { start: 0, end: Infinity, step: 1 } + }, + useFlowParser: { + since: "0.0.0", + category: CATEGORY_GLOBAL, + type: "boolean", + default: false, + deprecated: "0.0.10", + description: "Use flow parser.", + redirect: { option: "parser", value: "flow" } + }, + useTabs: { + since: "1.0.0", + category: CATEGORY_GLOBAL, + type: "boolean", + default: false, + description: "Indent with tabs instead of spaces." + } +}; + +function getSupportInfo(version, opts) { + opts = opts || {}; + if (!version) { version = currentVersion; } + const plugins = loadPlugins(); + + const options = util + .arrayify( + Object.assign( + plugins + .reduce( + (currentPrinters, plugin) => + currentPrinters.concat( + Object.keys(plugin.printers).map( + printerName => plugin.printers[printerName] + ) + ), + [] + ) + .reduce( + (currentOptions, printer) => + Object.assign(currentOptions, printer.options), + {} + ), + supportOptions + ), + "name" + ) + .sort((a, b) => (a.name === b.name ? 0 : a.name < b.name ? -1 : 1)) + .filter(filterSince) + .filter(filterDeprecated) + .map(mapDeprecated) + .map(option => { + const newOption = Object.assign({}, option); + + if (Array.isArray(newOption.default)) { + newOption.default = newOption.default + .filter(filterSince) + .sort((info1, info2) => + semver.compare(info2.since, info1.since) + )[0].value; + } + + if (Array.isArray(newOption.choices)) { + newOption.choices = newOption.choices + .filter(filterSince) + .filter(filterDeprecated) + .map(mapDeprecated); + } + + return newOption; + }); + const usePostCssParser = semver.lt(version, "1.7.1"); - const languages = loadPlugins(options) + const languages = plugins .reduce((all, plugin) => all.concat(plugin.languages), []) .filter(language => language.since && semver.gte(version, language.since)) .map(language => { @@ -35,7 +243,31 @@ function getSupportInfo(version, options) { return language; }); - return { languages }; + return { languages, options }; + + function filterSince(object) { + return ( + opts.showUnreleased || + !("since" in object) || + (object.since && semver.gte(version, object.since)) + ); + } + function filterDeprecated(object) { + return ( + opts.showDeprecated || + !("deprecated" in object) || + (object.deprecated && semver.lt(version, object.deprecated)) + ); + } + function mapDeprecated(object) { + if (!object.deprecated || opts.showDeprecated) { + return object; + } + const newObject = Object.assign({}, object); + delete newObject.deprecated; + delete newObject.redirect; + return newObject; + } } module.exports = { diff --git a/src/common/util.js b/src/common/util.js index c4c1e550..dd856448 100644 --- a/src/common/util.js +++ b/src/common/util.js @@ -805,7 +805,16 @@ function hasNodeIgnoreComment(node) { ); } +function arrayify(object, keyName) { + return Object.keys(object).reduce( + (array, key) => + array.concat(Object.assign({ [keyName]: key }, object[key])), + [] + ); +} + module.exports = { + arrayify, punctuationRegex, punctuationCharRange, getStringWidth, diff --git a/src/language-css/options.js b/src/language-css/options.js new file mode 100644 index 00000000..7a79abde --- /dev/null +++ b/src/language-css/options.js @@ -0,0 +1,8 @@ +"use strict"; + +const jsOptions = require("../language-js/options"); + +// format based on https://github.com/prettier/prettier/blob/master/src/common/support.js +module.exports = { + singleQuote: jsOptions.singleQuote +}; diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js index 57b4b2de..794ae803 100644 --- a/src/language-css/printer-postcss.js +++ b/src/language-css/printer-postcss.js @@ -12,6 +12,7 @@ const softline = docBuilders.softline; const group = docBuilders.group; const fill = docBuilders.fill; const indent = docBuilders.indent; +const printerOptions = require("./options"); const removeLines = doc.utils.removeLines; @@ -535,6 +536,7 @@ function maybeToLowerCase(value) { } module.exports = { + options: printerOptions, print: genericPrint, hasPrettierIgnore: util.hasIgnoreComment, massageAstNode: clean diff --git a/src/language-graphql/options.js b/src/language-graphql/options.js new file mode 100644 index 00000000..f6d3821a --- /dev/null +++ b/src/language-graphql/options.js @@ -0,0 +1,8 @@ +"use strict"; + +const jsOptions = require("../language-js/options"); + +// format based on https://github.com/prettier/prettier/blob/master/src/common/support.js +module.exports = { + bracketSpacing: jsOptions.bracketSpacing +}; diff --git a/src/language-graphql/printer-graphql.js b/src/language-graphql/printer-graphql.js index 53b3cf77..94b953fb 100644 --- a/src/language-graphql/printer-graphql.js +++ b/src/language-graphql/printer-graphql.js @@ -9,6 +9,7 @@ const softline = docBuilders.softline; const group = docBuilders.group; const indent = docBuilders.indent; const ifBreak = docBuilders.ifBreak; +const printerOptions = require("./options"); const util = require("../common/util"); @@ -555,6 +556,7 @@ function printComment(commentPath) { } module.exports = { + options: printerOptions, print: genericPrint, hasPrettierIgnore: util.hasIgnoreComment, printComment, diff --git a/src/language-js/options.js b/src/language-js/options.js new file mode 100644 index 00000000..acbc13d5 --- /dev/null +++ b/src/language-js/options.js @@ -0,0 +1,80 @@ +"use strict"; + +const CATEGORY_JAVASCRIPT = "JavaScript"; + +// format based on https://github.com/prettier/prettier/blob/master/src/common/support.js +module.exports = { + arrowParens: { + since: "1.9.0", + category: CATEGORY_JAVASCRIPT, + type: "choice", + default: "avoid", + description: "Include parentheses around a sole arrow function parameter.", + choices: [ + { + value: "avoid", + description: "Omit parens when possible. Example: `x => x`" + }, + { + value: "always", + description: "Always include parens. Example: `(x) => x`" + } + ] + }, + bracketSpacing: { + since: "0.0.0", + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: true, + description: "Print spaces between brackets.", + oppositeDescription: "Do not print spaces between brackets." + }, + jsxBracketSameLine: { + since: "0.17.0", + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: false, + description: "Put > on the last line instead of at a new line." + }, + semi: { + since: "1.0.0", + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: true, + description: "Print semicolons.", + oppositeDescription: + "Do not print semicolons, except at the beginning of lines which may need them." + }, + singleQuote: { + since: "0.0.0", + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: false, + description: "Use single quotes instead of double quotes." + }, + trailingComma: { + since: "0.0.0", + category: CATEGORY_JAVASCRIPT, + type: "choice", + default: [ + { since: "0.0.0", value: false }, + { since: "0.19.0", value: "none" } + ], + description: "Print trailing commas wherever possible when multi-line.", + choices: [ + { value: "none", description: "No trailing commas." }, + { + value: "es5", + description: + "Trailing commas where valid in ES5 (objects, arrays, etc.)" + }, + { + value: "all", + description: + "Trailing commas wherever possible (including function arguments)." + }, + { value: true, deprecated: "0.19.0", redirect: "es5" }, + { value: false, deprecated: "0.19.0", redirect: "none" } + ] + } +}; diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index bb5c4489..09fbf017 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -6,6 +6,7 @@ const comments = require("../main/comments"); const util = require("../common/util"); const isIdentifierName = require("esutils").keyword.isIdentifierNameES6; const embed = require("./embed"); +const printerOptions = require("./options"); const clean = require("./clean"); const doc = require("../doc"); @@ -5236,6 +5237,7 @@ function printJsDocComment(comment) { } module.exports = { + options: printerOptions, print: genericPrint, embed, massageAstNode: clean, diff --git a/src/language-markdown/options.js b/src/language-markdown/options.js new file mode 100644 index 00000000..dc030476 --- /dev/null +++ b/src/language-markdown/options.js @@ -0,0 +1,39 @@ +"use strict"; + +const jsOptions = require("../language-js/options"); + +const CATEGORY_MARKDOWN = "Markdown"; + +// format based on https://github.com/prettier/prettier/blob/master/src/common/support.js +module.exports = { + proseWrap: { + since: "1.8.2", + category: CATEGORY_MARKDOWN, + type: "choice", + default: [ + { since: "1.8.2", value: true }, + { since: "1.9.0", value: "preserve" } + ], + description: "How to wrap prose. (markdown)", + choices: [ + { + since: "1.9.0", + value: "always", + description: "Wrap prose if it exceeds the print width." + }, + { + since: "1.9.0", + value: "never", + description: "Do not wrap prose." + }, + { + since: "1.9.0", + value: "preserve", + description: "Wrap prose as-is." + }, + { value: false, deprecated: "1.9.0", redirect: "never" }, + { value: true, deprecated: "1.9.0", redirect: "always" } + ] + }, + singleQuote: jsOptions.singleQuote +}; diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js index 36c41bbb..497eb349 100644 --- a/src/language-markdown/printer-markdown.js +++ b/src/language-markdown/printer-markdown.js @@ -12,6 +12,7 @@ const softline = docBuilders.softline; const fill = docBuilders.fill; const align = docBuilders.align; const printDocToString = doc.printer.printDocToString; +const printerOptions = require("./options"); const SINGLE_LINE_NODE_TYPES = [ "heading", @@ -670,6 +671,7 @@ function clean(ast, newObj) { } module.exports = { + options: printerOptions, print: genericPrint, embed, massageAstNode: clean, diff --git a/tests_integration/__tests__/__snapshots__/support-info.js.snap b/tests_integration/__tests__/__snapshots__/support-info.js.snap index 05b3a22c..b4ca8b0f 100644 --- a/tests_integration/__tests__/__snapshots__/support-info.js.snap +++ b/tests_integration/__tests__/__snapshots__/support-info.js.snap @@ -1,390 +1,438 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`API getSupportInfo() no arguments 1`] = ` -Object { - "languages": Array [ - Object { - "aceMode": "javascript", - "aliases": Array [ - "js", - "node", - ], - "codemirrorMimeType": "text/javascript", - "codemirrorMode": "javascript", - "extensions": Array [ - ".js", - "._js", - ".bones", - ".es", - ".es6", - ".frag", - ".gs", - ".jake", - ".jsb", - ".jscad", - ".jsfl", - ".jsm", - ".jss", - ".mjs", - ".njs", - ".pac", - ".sjs", - ".ssjs", - ".xsjs", - ".xsjslib", - ], - "filenames": Array [ - "Jakefile", - ], - "group": "JavaScript", - "linguistLanguageId": 183, - "name": "JavaScript", - "parsers": Array [ - "babylon", - "flow", - ], - "since": "0.0.0", - "tmScope": "source.js", - "vscodeLanguageIds": Array [ - "javascript", - ], +exports[`API getSupportInfo() with version 0.0.0 -> 1.0.0 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -12,19 +12,35 @@ + \\"options\\": Object { + \\"bracketSpacing\\": Object { + \\"default\\": true, + \\"type\\": \\"boolean\\", + }, ++ \\"jsxBracketSameLine\\": Object { ++ \\"default\\": false, ++ \\"type\\": \\"boolean\\", ++ }, ++ \\"parser\\": Object { ++ \\"choices\\": Array [ ++ \\"babylon\\", ++ \\"flow\\", ++ ], ++ \\"default\\": \\"babylon\\", ++ \\"type\\": \\"choice\\", ++ }, + \\"printWidth\\": Object { + \\"default\\": 80, + \\"range\\": Object { + \\"end\\": Infinity, + \\"start\\": 0, + \\"step\\": 1, + }, + \\"type\\": \\"int\\", + }, ++ \\"semi\\": Object { ++ \\"default\\": true, ++ \\"type\\": \\"boolean\\", ++ }, + \\"singleQuote\\": Object { + \\"default\\": false, + \\"type\\": \\"boolean\\", + }, + \\"tabWidth\\": Object { +@@ -39,17 +55,15 @@ + \\"trailingComma\\": Object { + \\"choices\\": Array [ + \\"none\\", + \\"es5\\", + \\"all\\", +- true, +- false, + ], +- \\"default\\": false, ++ \\"default\\": \\"none\\", + \\"type\\": \\"choice\\", + }, +- \\"useFlowParser\\": Object { ++ \\"useTabs\\": Object { + \\"default\\": false, + \\"type\\": \\"boolean\\", + }, }, - Object { - "aceMode": "javascript", - "codemirrorMimeType": "text/jsx", - "codemirrorMode": "jsx", - "extensions": Array [ - ".jsx", - ], - "group": "JavaScript", - "liguistLanguageId": 178, - "name": "JSX", - "parsers": Array [ - "babylon", - "flow", - ], - "since": "0.0.0", - "tmScope": "source.js.jsx", - "vscodeLanguageIds": Array [ - "javascriptreact", - ], - }, - Object { - "aceMode": "typescript", - "aliases": Array [ - "ts", - ], - "codemirrorMimeType": "application/typescript", - "codemirrorMode": "javascript", - "extensions": Array [ - ".ts", - ".tsx", - ], - "group": "JavaScript", - "liguistLanguageId": 378, - "name": "TypeScript", - "parsers": Array [ - "typescript", - ], - "since": "1.4.0", - "tmScope": "source.ts", - "vscodeLanguageIds": Array [ - "typescript", - "typescriptreact", - ], - }, - Object { - "aceMode": "json", - "codemirrorMimeType": "application/json", - "codemirrorMode": "javascript", - "extensions": Array [ - ".json", - ".json5", - ".geojson", - ".JSON-tmLanguage", - ".topojson", - ], - "filenames": Array [ - ".arcconfig", - ".jshintrc", - ".babelrc", - ".eslintrc", - ".prettierrc", - "composer.lock", - "mcmod.info", - ], - "group": "JavaScript", - "linguistLanguageId": 174, - "name": "JSON", - "parsers": Array [ - "json", - ], - "since": "1.5.0", - "tmScope": "source.json", - "vscodeLanguageIds": Array [ - "json", - "jsonc", - ], - }, - Object { - "aceMode": "css", - "codemirrorMimeType": "text/css", - "codemirrorMode": "css", - "extensions": Array [ - ".css", - ".pcss", - ".postcss", - ], - "group": "CSS", - "liguistLanguageId": 50, - "name": "CSS", - "parsers": Array [ - "css", - ], - "since": "1.4.0", - "tmScope": "source.css", - "vscodeLanguageIds": Array [ - "css", - "postcss", - ], - }, - Object { - "aceMode": "less", - "codemirrorMimeType": "text/css", - "codemirrorMode": "css", - "extensions": Array [ - ".less", - ], - "group": "CSS", - "liguistLanguageId": 198, - "name": "Less", - "parsers": Array [ - "less", - ], - "since": "1.4.0", - "tmScope": "source.css.less", - "vscodeLanguageIds": Array [ - "less", - ], - }, - Object { - "aceMode": "scss", - "codemirrorMimeType": "text/x-scss", - "codemirrorMode": "css", - "extensions": Array [ - ".scss", - ], - "group": "CSS", - "liguistLanguageId": 329, - "name": "SCSS", - "parsers": Array [ - "scss", - ], - "since": "1.4.0", - "tmScope": "source.scss", - "vscodeLanguageIds": Array [ - "scss", - ], - }, - Object { - "aceMode": "text", - "extensions": Array [ - ".graphql", - ".gql", - ], - "liguistLanguageId": 139, - "name": "GraphQL", - "parsers": Array [ - "graphql", - ], - "since": "1.5.0", - "tmScope": "source.graphql", - "vscodeLanguageIds": Array [ - "graphql", - ], - }, - Object { - "aceMode": "markdown", - "aliases": Array [ - "pandoc", - ], - "codemirrorMimeType": "text/x-gfm", - "codemirrorMode": "gfm", - "extensions": Array [ - ".md", - ".markdown", - ".mdown", - ".mdwn", - ".mkd", - ".mkdn", - ".mkdown", - ".ron", - ".workbook", - ], - "filenames": Array [ - "README", - ], - "linguistLanguageId": 222, - "name": "Markdown", - "parsers": Array [ - "markdown", - ], - "since": "1.8.0", - "tmScope": "source.gfm", - "vscodeLanguageIds": Array [ - "markdown", - ], - "wrap": true, - }, - ], -} + }" `; exports[`API getSupportInfo() with version 0.0.0 1`] = ` Object { - "JSX": Array [ - "babylon", - "flow", - ], - "JavaScript": Array [ - "babylon", - "flow", - ], + "languages": Object { + "JSX": Array [ + "babylon", + "flow", + ], + "JavaScript": Array [ + "babylon", + "flow", + ], + }, + "options": Object { + "bracketSpacing": Object { + "default": true, + "type": "boolean", + }, + "printWidth": Object { + "default": 80, + "range": Object { + "end": Infinity, + "start": 0, + "step": 1, + }, + "type": "int", + }, + "singleQuote": Object { + "default": false, + "type": "boolean", + }, + "tabWidth": Object { + "default": 2, + "range": Object { + "end": Infinity, + "start": 0, + "step": 1, + }, + "type": "int", + }, + "trailingComma": Object { + "choices": Array [ + "none", + "es5", + "all", + true, + false, + ], + "default": false, + "type": "choice", + }, + "useFlowParser": Object { + "default": false, + "type": "boolean", + }, + }, } `; -exports[`API getSupportInfo() with version 1.0.0 1`] = ` -Object { - "JSX": Array [ - "babylon", - "flow", - ], - "JavaScript": Array [ - "babylon", - "flow", - ], -} +exports[`API getSupportInfo() with version 1.0.0 -> 1.4.0 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -1,29 +1,56 @@ + Object { + \\"languages\\": Object { ++ \\"CSS\\": Array [ ++ \\"postcss\\", ++ ], + \\"JSX\\": Array [ + \\"babylon\\", + \\"flow\\", + ], + \\"JavaScript\\": Array [ + \\"babylon\\", + \\"flow\\", + ], ++ \\"Less\\": Array [ ++ \\"postcss\\", ++ ], ++ \\"SCSS\\": Array [ ++ \\"postcss\\", ++ ], ++ \\"TypeScript\\": Array [ ++ \\"typescript\\", ++ ], + }, + \\"options\\": Object { + \\"bracketSpacing\\": Object { + \\"default\\": true, + \\"type\\": \\"boolean\\", + }, ++ \\"cursorOffset\\": Object { ++ \\"default\\": -1, ++ \\"range\\": Object { ++ \\"end\\": Infinity, ++ \\"start\\": -1, ++ \\"step\\": 1, ++ }, ++ \\"type\\": \\"int\\", ++ }, ++ \\"filepath\\": Object { ++ \\"default\\": undefined, ++ \\"type\\": \\"path\\", ++ }, + \\"jsxBracketSameLine\\": Object { + \\"default\\": false, + \\"type\\": \\"boolean\\", + }, + \\"parser\\": Object { + \\"choices\\": Array [ + \\"babylon\\", + \\"flow\\", ++ \\"typescript\\", ++ \\"postcss\\", + ], + \\"default\\": \\"babylon\\", + \\"type\\": \\"choice\\", + }, + \\"printWidth\\": Object { +@@ -33,10 +60,28 @@ + \\"start\\": 0, + \\"step\\": 1, + }, + \\"type\\": \\"int\\", + }, ++ \\"rangeEnd\\": Object { ++ \\"default\\": Infinity, ++ \\"range\\": Object { ++ \\"end\\": Infinity, ++ \\"start\\": 0, ++ \\"step\\": 1, ++ }, ++ \\"type\\": \\"int\\", ++ }, ++ \\"rangeStart\\": Object { ++ \\"default\\": 0, ++ \\"range\\": Object { ++ \\"end\\": Infinity, ++ \\"start\\": 0, ++ \\"step\\": 1, ++ }, ++ \\"type\\": \\"int\\", ++ }, + \\"semi\\": Object { + \\"default\\": true, + \\"type\\": \\"boolean\\", + }, + \\"singleQuote\\": Object {" `; -exports[`API getSupportInfo() with version 1.4.0 1`] = ` -Object { - "CSS": Array [ - "postcss", - ], - "JSX": Array [ - "babylon", - "flow", - ], - "JavaScript": Array [ - "babylon", - "flow", - ], - "Less": Array [ - "postcss", - ], - "SCSS": Array [ - "postcss", - ], - "TypeScript": Array [ - "typescript", - ], -} +exports[`API getSupportInfo() with version 1.4.0 -> 1.5.0 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -1,10 +1,16 @@ + Object { + \\"languages\\": Object { + \\"CSS\\": Array [ + \\"postcss\\", + ], ++ \\"GraphQL\\": Array [ ++ \\"graphql\\", ++ ], ++ \\"JSON\\": Array [ ++ \\"json\\", ++ ], + \\"JSX\\": Array [ + \\"babylon\\", + \\"flow\\", + ], + \\"JavaScript\\": Array [ +@@ -47,10 +53,12 @@ + \\"choices\\": Array [ + \\"babylon\\", + \\"flow\\", + \\"typescript\\", + \\"postcss\\", ++ \\"json\\", ++ \\"graphql\\", + ], + \\"default\\": \\"babylon\\", + \\"type\\": \\"choice\\", + }, + \\"printWidth\\": Object {" `; -exports[`API getSupportInfo() with version 1.5.0 1`] = ` -Object { - "CSS": Array [ - "postcss", - ], - "GraphQL": Array [ - "graphql", - ], - "JSON": Array [ - "json", - ], - "JSX": Array [ - "babylon", - "flow", - ], - "JavaScript": Array [ - "babylon", - "flow", - ], - "Less": Array [ - "postcss", - ], - "SCSS": Array [ - "postcss", - ], - "TypeScript": Array [ - "typescript", - ], -} +exports[`API getSupportInfo() with version 1.5.0 -> 1.7.1 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -1,9 +1,9 @@ + Object { + \\"languages\\": Object { + \\"CSS\\": Array [ +- \\"postcss\\", ++ \\"css\\", + ], + \\"GraphQL\\": Array [ + \\"graphql\\", + ], + \\"JSON\\": Array [ +@@ -16,14 +16,14 @@ + \\"JavaScript\\": Array [ + \\"babylon\\", + \\"flow\\", + ], + \\"Less\\": Array [ +- \\"postcss\\", ++ \\"less\\", + ], + \\"SCSS\\": Array [ +- \\"postcss\\", ++ \\"scss\\", + ], + \\"TypeScript\\": Array [ + \\"typescript\\", + ], + }, +@@ -52,11 +52,13 @@ + \\"parser\\": Object { + \\"choices\\": Array [ + \\"babylon\\", + \\"flow\\", + \\"typescript\\", +- \\"postcss\\", ++ \\"css\\", ++ \\"less\\", ++ \\"scss\\", + \\"json\\", + \\"graphql\\", + ], + \\"default\\": \\"babylon\\", + \\"type\\": \\"choice\\", +@@ -86,10 +88,14 @@ + \\"start\\": 0, + \\"step\\": 1, + }, + \\"type\\": \\"int\\", + }, ++ \\"requirePragma\\": Object { ++ \\"default\\": false, ++ \\"type\\": \\"boolean\\", ++ }, + \\"semi\\": Object { + \\"default\\": true, + \\"type\\": \\"boolean\\", + }, + \\"singleQuote\\": Object {" `; -exports[`API getSupportInfo() with version 1.7.1 1`] = ` -Object { - "CSS": Array [ - "css", - ], - "GraphQL": Array [ - "graphql", - ], - "JSON": Array [ - "json", - ], - "JSX": Array [ - "babylon", - "flow", - ], - "JavaScript": Array [ - "babylon", - "flow", - ], - "Less": Array [ - "less", - ], - "SCSS": Array [ - "scss", - ], - "TypeScript": Array [ - "typescript", - ], -} +exports[`API getSupportInfo() with version 1.7.1 -> 1.8.0 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -18,10 +18,13 @@ + \\"flow\\", + ], + \\"Less\\": Array [ + \\"less\\", + ], ++ \\"Markdown\\": Array [ ++ \\"markdown\\", ++ ], + \\"SCSS\\": Array [ + \\"scss\\", + ], + \\"TypeScript\\": Array [ + \\"typescript\\", +@@ -43,10 +46,14 @@ + }, + \\"filepath\\": Object { + \\"default\\": undefined, + \\"type\\": \\"path\\", + }, ++ \\"insertPragma\\": Object { ++ \\"default\\": false, ++ \\"type\\": \\"boolean\\", ++ }, + \\"jsxBracketSameLine\\": Object { + \\"default\\": false, + \\"type\\": \\"boolean\\", + }, + \\"parser\\": Object { +@@ -57,10 +64,11 @@ + \\"css\\", + \\"less\\", + \\"scss\\", + \\"json\\", + \\"graphql\\", ++ \\"markdown\\", + ], + \\"default\\": \\"babylon\\", + \\"type\\": \\"choice\\", + }, + \\"printWidth\\": Object {" `; -exports[`API getSupportInfo() with version 1.8.0 1`] = ` -Object { - "CSS": Array [ - "css", - ], - "GraphQL": Array [ - "graphql", - ], - "JSON": Array [ - "json", - ], - "JSX": Array [ - "babylon", - "flow", - ], - "JavaScript": Array [ - "babylon", - "flow", - ], - "Less": Array [ - "less", - ], - "Markdown": Array [ - "markdown", - ], - "SCSS": Array [ - "scss", - ], - "TypeScript": Array [ - "typescript", - ], -} +exports[`API getSupportInfo() with version 1.8.0 -> 1.8.2 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -78,10 +78,18 @@ + \\"start\\": 0, + \\"step\\": 1, + }, + \\"type\\": \\"int\\", + }, ++ \\"proseWrap\\": Object { ++ \\"choices\\": Array [ ++ false, ++ true, ++ ], ++ \\"default\\": true, ++ \\"type\\": \\"choice\\", ++ }, + \\"rangeEnd\\": Object { + \\"default\\": Infinity, + \\"range\\": Object { + \\"end\\": Infinity, + \\"start\\": 0," +`; + +exports[`API getSupportInfo() with version 1.8.2 -> undefined 1`] = ` +"Snapshot Diff: +- First value ++ Second value + +@@ -29,10 +29,18 @@ + \\"TypeScript\\": Array [ + \\"typescript\\", + ], + }, + \\"options\\": Object { ++ \\"arrowParens\\": Object { ++ \\"choices\\": Array [ ++ \\"avoid\\", ++ \\"always\\", ++ ], ++ \\"default\\": \\"avoid\\", ++ \\"type\\": \\"choice\\", ++ }, + \\"bracketSpacing\\": Object { + \\"default\\": true, + \\"type\\": \\"boolean\\", + }, + \\"cursorOffset\\": Object { +@@ -80,14 +88,15 @@ + }, + \\"type\\": \\"int\\", + }, + \\"proseWrap\\": Object { + \\"choices\\": Array [ +- false, +- true, ++ \\"always\\", ++ \\"never\\", ++ \\"preserve\\", + ], +- \\"default\\": true, ++ \\"default\\": \\"preserve\\", + \\"type\\": \\"choice\\", + }, + \\"rangeEnd\\": Object { + \\"default\\": Infinity, + \\"range\\": Object {" `; exports[`CLI --support-info (stderr) 1`] = `""`; @@ -557,6 +605,211 @@ exports[`CLI --support-info (stdout) 1`] = ` \\"linguistLanguageId\\": 222, \\"vscodeLanguageIds\\": [\\"markdown\\"] } + ], + \\"options\\": [ + { + \\"name\\": \\"arrowParens\\", + \\"since\\": \\"1.9.0\\", + \\"category\\": \\"JavaScript\\", + \\"type\\": \\"choice\\", + \\"default\\": \\"avoid\\", + \\"description\\": + \\"Include parentheses around a sole arrow function parameter.\\", + \\"choices\\": [ + { + \\"value\\": \\"avoid\\", + \\"description\\": \\"Omit parens when possible. Example: \`x => x\`\\" + }, + { + \\"value\\": \\"always\\", + \\"description\\": \\"Always include parens. Example: \`(x) => x\`\\" + } + ] + }, + { + \\"name\\": \\"bracketSpacing\\", + \\"since\\": \\"0.0.0\\", + \\"category\\": \\"JavaScript\\", + \\"type\\": \\"boolean\\", + \\"default\\": true, + \\"description\\": \\"Print spaces between brackets.\\", + \\"oppositeDescription\\": \\"Do not print spaces between brackets.\\" + }, + { + \\"name\\": \\"cursorOffset\\", + \\"since\\": \\"1.4.0\\", + \\"category\\": \\"Special\\", + \\"type\\": \\"int\\", + \\"default\\": -1, + \\"range\\": { \\"start\\": -1, \\"end\\": null, \\"step\\": 1 }, + \\"description\\": + \\"Print (to stderr) where a cursor at the given position would move to after formatting.\\\\nThis option cannot be used with --range-start and --range-end.\\" + }, + { + \\"name\\": \\"filepath\\", + \\"since\\": \\"1.4.0\\", + \\"category\\": \\"Special\\", + \\"type\\": \\"path\\", + \\"description\\": + \\"Specify the input filepath. This will be used to do parser inference.\\" + }, + { + \\"name\\": \\"insertPragma\\", + \\"since\\": \\"1.8.0\\", + \\"category\\": \\"Special\\", + \\"type\\": \\"boolean\\", + \\"default\\": false, + \\"description\\": \\"Insert @format pragma into file's first docblock comment.\\" + }, + { + \\"name\\": \\"jsxBracketSameLine\\", + \\"since\\": \\"0.17.0\\", + \\"category\\": \\"JavaScript\\", + \\"type\\": \\"boolean\\", + \\"default\\": false, + \\"description\\": \\"Put > on the last line instead of at a new line.\\" + }, + { + \\"name\\": \\"parser\\", + \\"since\\": \\"0.0.10\\", + \\"category\\": \\"Global\\", + \\"type\\": \\"choice\\", + \\"default\\": \\"babylon\\", + \\"description\\": \\"Which parser to use.\\", + \\"choices\\": [ + { \\"value\\": \\"babylon\\", \\"description\\": \\"JavaScript\\" }, + { \\"value\\": \\"flow\\", \\"description\\": \\"Flow\\" }, + { + \\"value\\": \\"typescript\\", + \\"since\\": \\"1.4.0\\", + \\"description\\": \\"TypeScript\\" + }, + { \\"value\\": \\"css\\", \\"since\\": \\"1.7.1\\", \\"description\\": \\"CSS\\" }, + { \\"value\\": \\"less\\", \\"since\\": \\"1.7.1\\", \\"description\\": \\"Less\\" }, + { \\"value\\": \\"scss\\", \\"since\\": \\"1.7.1\\", \\"description\\": \\"SCSS\\" }, + { \\"value\\": \\"json\\", \\"since\\": \\"1.5.0\\", \\"description\\": \\"JSON\\" }, + { \\"value\\": \\"graphql\\", \\"since\\": \\"1.5.0\\", \\"description\\": \\"GraphQL\\" }, + { \\"value\\": \\"markdown\\", \\"since\\": \\"1.8.0\\", \\"description\\": \\"Markdown\\" } + ] + }, + { + \\"name\\": \\"printWidth\\", + \\"since\\": \\"0.0.0\\", + \\"category\\": \\"Global\\", + \\"type\\": \\"int\\", + \\"default\\": 80, + \\"description\\": \\"The line length where Prettier will try wrap.\\", + \\"range\\": { \\"start\\": 0, \\"end\\": null, \\"step\\": 1 } + }, + { + \\"name\\": \\"proseWrap\\", + \\"since\\": \\"1.8.2\\", + \\"category\\": \\"Markdown\\", + \\"type\\": \\"choice\\", + \\"default\\": \\"preserve\\", + \\"description\\": \\"How to wrap prose. (markdown)\\", + \\"choices\\": [ + { + \\"since\\": \\"1.9.0\\", + \\"value\\": \\"always\\", + \\"description\\": \\"Wrap prose if it exceeds the print width.\\" + }, + { + \\"since\\": \\"1.9.0\\", + \\"value\\": \\"never\\", + \\"description\\": \\"Do not wrap prose.\\" + }, + { + \\"since\\": \\"1.9.0\\", + \\"value\\": \\"preserve\\", + \\"description\\": \\"Wrap prose as-is.\\" + } + ] + }, + { + \\"name\\": \\"rangeEnd\\", + \\"since\\": \\"1.4.0\\", + \\"category\\": \\"Special\\", + \\"type\\": \\"int\\", + \\"default\\": null, + \\"range\\": { \\"start\\": 0, \\"end\\": null, \\"step\\": 1 }, + \\"description\\": + \\"Format code ending at a given character offset (exclusive).\\\\nThe range will extend forwards to the end of the selected statement.\\\\nThis option cannot be used with --cursor-offset.\\" + }, + { + \\"name\\": \\"rangeStart\\", + \\"since\\": \\"1.4.0\\", + \\"category\\": \\"Special\\", + \\"type\\": \\"int\\", + \\"default\\": 0, + \\"range\\": { \\"start\\": 0, \\"end\\": null, \\"step\\": 1 }, + \\"description\\": + \\"Format code starting at a given character offset.\\\\nThe range will extend backwards to the start of the first line containing the selected statement.\\\\nThis option cannot be used with --cursor-offset.\\" + }, + { + \\"name\\": \\"requirePragma\\", + \\"since\\": \\"1.7.0\\", + \\"category\\": \\"Special\\", + \\"type\\": \\"boolean\\", + \\"default\\": false, + \\"description\\": + \\"Require either '@prettier' or '@format' to be present in the file's first docblock comment\\\\nin order for it to be formatted.\\" + }, + { + \\"name\\": \\"semi\\", + \\"since\\": \\"1.0.0\\", + \\"category\\": \\"JavaScript\\", + \\"type\\": \\"boolean\\", + \\"default\\": true, + \\"description\\": \\"Print semicolons.\\", + \\"oppositeDescription\\": + \\"Do not print semicolons, except at the beginning of lines which may need them.\\" + }, + { + \\"name\\": \\"singleQuote\\", + \\"since\\": \\"0.0.0\\", + \\"category\\": \\"JavaScript\\", + \\"type\\": \\"boolean\\", + \\"default\\": false, + \\"description\\": \\"Use single quotes instead of double quotes.\\" + }, + { + \\"name\\": \\"tabWidth\\", + \\"type\\": \\"int\\", + \\"category\\": \\"Global\\", + \\"default\\": 2, + \\"description\\": \\"Number of spaces per indentation level.\\", + \\"range\\": { \\"start\\": 0, \\"end\\": null, \\"step\\": 1 } + }, + { + \\"name\\": \\"trailingComma\\", + \\"since\\": \\"0.0.0\\", + \\"category\\": \\"JavaScript\\", + \\"type\\": \\"choice\\", + \\"default\\": \\"none\\", + \\"description\\": \\"Print trailing commas wherever possible when multi-line.\\", + \\"choices\\": [ + { \\"value\\": \\"none\\", \\"description\\": \\"No trailing commas.\\" }, + { + \\"value\\": \\"es5\\", + \\"description\\": + \\"Trailing commas where valid in ES5 (objects, arrays, etc.)\\" + }, + { + \\"value\\": \\"all\\", + \\"description\\": + \\"Trailing commas wherever possible (including function arguments).\\" + } + ] + }, + { + \\"name\\": \\"useTabs\\", + \\"since\\": \\"1.0.0\\", + \\"category\\": \\"Global\\", + \\"type\\": \\"boolean\\", + \\"default\\": false, + \\"description\\": \\"Indent with tabs instead of spaces.\\" + } ] } diff --git a/tests_integration/__tests__/support-info.js b/tests_integration/__tests__/support-info.js index f7dc6a2a..32c11bb9 100644 --- a/tests_integration/__tests__/support-info.js +++ b/tests_integration/__tests__/support-info.js @@ -2,29 +2,66 @@ const prettier = require("../../tests_config/require_prettier"); const runPrettier = require("../runPrettier"); +const snapshotDiff = require("snapshot-diff"); describe("API getSupportInfo()", () => { - test("no arguments", () => { - expect(prettier.getSupportInfo()).toMatchSnapshot(); - }); + const testVersions = [ + "0.0.0", + "1.0.0", + "1.4.0", + "1.5.0", + "1.7.1", + "1.8.0", + "1.8.2", + undefined + ]; - const testVersions = ["0.0.0", "1.0.0", "1.4.0", "1.5.0", "1.7.1", "1.8.0"]; - - testVersions.forEach(version => { - test(`with version ${version}`, () => { - expect( - prettier - .getSupportInfo(version) - .languages.reduce( - (obj, language) => - Object.assign({ [language.name]: language.parsers }, obj), - {} - ) - ).toMatchSnapshot(); - }); + testVersions.forEach((version, index) => { + const info = getCoreInfo(version); + if (index === 0) { + test(`with version ${version}`, () => { + expect(info).toMatchSnapshot(); + }); + } else { + const previousVersion = testVersions[index - 1]; + const previousInfo = getCoreInfo(previousVersion); + test(`with version ${previousVersion} -> ${version}`, () => { + expect(snapshotDiff(previousInfo, info)).toMatchSnapshot(); + }); + } }); }); describe("CLI --support-info", () => { runPrettier("cli", "--support-info").test({ status: 0 }); }); + +function getCoreInfo(version) { + const supportInfo = prettier.getSupportInfo(version); + const languages = supportInfo.languages.reduce( + (obj, language) => + Object.assign({ [language.name]: language.parsers }, obj), + {} + ); + const options = supportInfo.options.reduce( + (obj, option) => + Object.assign( + { + [option.name]: Object.assign( + { + type: option.type, + default: option.default + }, + option.type === "int" + ? { range: option.range } + : option.type === "choice" + ? { choices: option.choices.map(choice => choice.value) } + : null + ) + }, + obj + ), + {} + ); + return { languages, options }; +} diff --git a/yarn.lock b/yarn.lock index c2bf42ba..a52c7515 100644 --- a/yarn.lock +++ b/yarn.lock @@ -112,7 +112,7 @@ ansi-escapes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" -ansi-regex@^2.0.0: +ansi-regex@^2.0.0, ansi-regex@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -124,18 +124,18 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.0.0, ansi-styles@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + ansi-styles@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.1.0.tgz#09c202d5c917ec23188caa5c9cb9179cd9547750" dependencies: color-convert "^1.0.0" -ansi-styles@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" - dependencies: - color-convert "^1.9.0" - anymatch@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" @@ -1337,6 +1337,10 @@ decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" +dedent@0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + deep-extend@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" @@ -2538,6 +2542,15 @@ jest-config@^21.2.1: jest-validate "^21.2.1" pretty-format "^21.2.1" +jest-diff@21.3.0-beta.15, jest-diff@test: + version "21.3.0-beta.15" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-21.3.0-beta.15.tgz#13efca4723fc2f452f8143fe0df5515c5128c672" + dependencies: + chalk "^2.0.1" + diff "^3.2.0" + jest-get-type "21.3.0-beta.15" + pretty-format "21.3.0-beta.15" + jest-diff@^21.2.1: version "21.2.1" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-21.2.1.tgz#46cccb6cab2d02ce98bc314011764bb95b065b4f" @@ -2572,6 +2585,10 @@ jest-environment-node@^21.2.1: jest-mock "^21.2.0" jest-util "^21.2.1" +jest-get-type@21.3.0-beta.15: + version "21.3.0-beta.15" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.3.0-beta.15.tgz#d5a510c32683124576eaba69b66a1ba3c25ed67c" + jest-get-type@^21.0.2: version "21.0.2" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.0.2.tgz#304e6b816dd33cd1f47aba0597bcad258a509fc6" @@ -2604,6 +2621,14 @@ jest-jasmine2@^21.2.1: jest-snapshot "^21.2.1" p-cancelable "^0.3.0" +jest-matcher-utils@21.3.0-beta.15: + version "21.3.0-beta.15" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-21.3.0-beta.15.tgz#b033ee41f9d60c5bf338928b36e8e612fe19d54f" + dependencies: + chalk "^2.0.1" + jest-get-type "21.3.0-beta.15" + pretty-format "21.3.0-beta.15" + jest-matcher-utils@^21.2.1: version "21.2.1" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz#72c826eaba41a093ac2b4565f865eb8475de0f64" @@ -2690,6 +2715,17 @@ jest-snapshot@^21.2.1: natural-compare "^1.4.0" pretty-format "^21.2.1" +jest-snapshot@test: + version "21.3.0-beta.15" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-21.3.0-beta.15.tgz#7f07a6efaee9d62d1befa60e39fa03f775e30707" + dependencies: + chalk "^2.0.1" + jest-diff "21.3.0-beta.15" + jest-matcher-utils "21.3.0-beta.15" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "21.3.0-beta.15" + jest-util@^21.2.1: version "21.2.1" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-21.2.1.tgz#a274b2f726b0897494d694a6c3d6a61ab819bb78" @@ -3521,6 +3557,20 @@ prettier@1.9.2: version "1.9.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.9.2.tgz#96bc2132f7a32338e6078aeb29727178c6335827" +pretty-format@21.3.0-beta.15: + version "21.3.0-beta.15" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.3.0-beta.15.tgz#702708a64be53619b2c10138dc5a594056fd1569" + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + +pretty-format@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.3.tgz#020e350a560a1fe1a98dc3beb6ccffb386de8b14" + dependencies: + ansi-regex "^2.1.1" + ansi-styles "^3.0.0" + pretty-format@^21.1.0: version "21.1.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.1.0.tgz#557428254323832ee8b7c971cb613442bea67f61" @@ -4091,6 +4141,15 @@ slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" +snapshot-diff@0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/snapshot-diff/-/snapshot-diff-0.2.2.tgz#26f836f5da8baad46e2986cec75799758eb83210" + dependencies: + jest-diff test + jest-snapshot test + pretty-format "^20.0.3" + strip-ansi "^4.0.0" + sntp@1.x.x: version "1.0.9" resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198"