From dc019ba816117a9978a41daa69cdc3cef4b793b4 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 7 Nov 2018 15:23:14 -0500 Subject: [PATCH 01/10] Add azure pipelines --- azure-pipelines.yml | 90 +++++++++++++++++++++++++++ azure-pipelines/production-bundle.yml | 34 ++++++++++ azure-pipelines/run-tests.yml | 19 ++++++ 3 files changed, 143 insertions(+) create mode 100644 azure-pipelines.yml create mode 100644 azure-pipelines/production-bundle.yml create mode 100644 azure-pipelines/run-tests.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000000..56dff2fbf0d9 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,90 @@ +trigger: +- master +- releases/* + +jobs: + +# Test production bundle on Linux using Node 4 +- job: prod_linux_node_4 + displayName: Test production bundle (Linux, node 4) + pool: + vmImage: 'Ubuntu 16.04' + variables: + node_version: 4.x + steps: + - template: azure-pipelines/production-bundle.yml + +# Test production bundle on Linux using Node 9 +- job: prod_linux_node_9 + displayName: Test production bundle (Linux, node 9) + pool: + vmImage: 'Ubuntu 16.04' + variables: + node_version: 9.x + report_summaries: true + steps: + - template: azure-pipelines/production-bundle.yml + +# Build and test on Windows using Node 8 +- job: build_all_windows + displayName: Run tests using Node 8 (Windows) + pool: + vmImage: vs2017-win2016 + variables: + node_version: 8.x + report_summaries: true + steps: + - template: azure-pipelines/run-tests.yml + +# Build and test on macOS using Node 8 +- job: build_all_darwin + displayName: Run tests using Node 8 (macOS) + pool: + vmImage: macos-10.13 + variables: + node_version: 8.x + report_summaries: true + steps: + - template: azure-pipelines/run-tests.yml + +# Build and test on Linux using Node 8 +- job: build_all_linux_node_8 + displayName: Run tests using Node 8 (Linux) + pool: + vmImage: 'Ubuntu 16.04' + variables: + node_version: 8.x + report_summaries: true + steps: + - template: azure-pipelines/run-tests.yml + +# Build and test on Linux using Node 11 +- job: build_all_linux_node_11 + displayName: Run tests using Node 11 (Linux) + pool: + vmImage: 'Ubuntu 16.04' + variables: + node_version: 11.x + report_summaries: true + steps: + - template: azure-pipelines/run-tests.yml + +# Lint checks on Linux +- job: lint_linux + displayName: Lint (Linux) + pool: + vmImage: 'Ubuntu 16.04' + steps: + - task: NodeTool@0 + inputs: + versionSpec: '8.x' + displayName: 'Install Node.js' + + - script: yarn install + displayName: 'yarn install' + + - script: yarn lint + displayName: 'Lint code' + + - script: yarn lint-docs + displayName: 'Lint docs' \ No newline at end of file diff --git a/azure-pipelines/production-bundle.yml b/azure-pipelines/production-bundle.yml new file mode 100644 index 000000000000..edba1bc9af12 --- /dev/null +++ b/azure-pipelines/production-bundle.yml @@ -0,0 +1,34 @@ +steps: +- task: NodeTool@0 + inputs: + versionSpec: '11.x' + displayName: 'Install Node.js' + +- script: npm install -g yarn + displayName: 'Get yarn' + +- script: yarn install + displayName: 'yarn install' + +- script: yarn check-deps + displayName: 'Check dependencies' + +- script: yarn build + displayName: 'Build' + +- task: NodeTool@0 + inputs: + versionSpec: '$(node_version)' + displayName: 'Use Node.js $(node_version)' + +- script: npm install -g yarn@1.5 + displayName: 'Get yarn compatible with node 4' + condition: eq(variables['node_version'], '4.x') + +- script: node ./scripts/test-dist.js + displayName: 'Test' + +- task: PublishTestResults@2 + inputs: + testResultsFiles: '**/junit.xml' + condition: and(variables['report_summaries'], succeededOrFailed()) \ No newline at end of file diff --git a/azure-pipelines/run-tests.yml b/azure-pipelines/run-tests.yml new file mode 100644 index 000000000000..7197b9880ec2 --- /dev/null +++ b/azure-pipelines/run-tests.yml @@ -0,0 +1,19 @@ +steps: +- task: NodeTool@0 + inputs: + versionSpec: '$(node_version)' + displayName: 'Install Node.js' + +- script: npm install -g yarn + displayName: 'Get yarn' + +- script: yarn install + displayName: 'yarn install' + +- script: yarn test + displayName: 'Test' + +- task: PublishTestResults@2 + inputs: + testResultsFiles: '**/junit.xml' + condition: succeededOrFailed() From a4eee8d5e0728b660624219a56a5305f65700295 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 7 Nov 2018 15:24:35 -0500 Subject: [PATCH 02/10] Add gitattributes --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..04f32be0f134 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Make sure baseline files have consistent line endings +*.txt text eol=lf +*.snap text eol=lf +*.debug-check text eol=lf \ No newline at end of file From df48a7d3078906930228241dc052d474babd9549 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 7 Nov 2018 15:34:42 -0500 Subject: [PATCH 03/10] Updating tests to work on Windows or Unix --- jest.config.js | 10 ++- .../__snapshots__/config-resolution.js.snap | 23 ++----- .../__tests__/__snapshots__/unix_only.js.snap | 62 +++++++++++++++++++ .../__snapshots__/windows_only.js.snap | 62 +++++++++++++++++++ .../with-config-precedence.js.snap | 30 +++------ tests_integration/__tests__/arg-parsing.js | 42 +++++++++++-- .../__tests__/config-resolution.js | 19 ++++-- tests_integration/__tests__/debug-check.js | 2 + tests_integration/__tests__/ignore-path.js | 4 +- tests_integration/__tests__/infer-parser.js | 4 +- tests_integration/__tests__/parser-api.js | 2 + .../__tests__/plugin-extensions.js | 4 +- .../__tests__/plugin-preprocess.js | 4 +- .../__tests__/plugin-resolution.js | 16 +++-- tests_integration/__tests__/support-info.js | 2 +- tests_integration/__tests__/unix_only.js | 11 ++++ tests_integration/__tests__/windows_only.js | 11 ++++ .../__tests__/with-config-precedence.js | 16 ++++- .../__tests__/with-parser-inference.js | 2 +- tests_integration/__tests__/with-shebang.js | 8 ++- tests_integration/cli/config/.prettierrc | 1 + .../cli/config/editorconfig/.editorconfig | 12 +--- .../cli/config/editorconfig/eol/cr.js | 3 - .../cli/config/editorconfig/eol/crlf.js | 3 - .../cli/config/editorconfig/eol/lf.js | 3 - .../cli/config/js/prettier.config.js | 1 + tests_integration/runPrettier.js | 5 +- 27 files changed, 272 insertions(+), 90 deletions(-) create mode 100644 tests_integration/__tests__/__snapshots__/unix_only.js.snap create mode 100644 tests_integration/__tests__/__snapshots__/windows_only.js.snap create mode 100644 tests_integration/__tests__/unix_only.js create mode 100644 tests_integration/__tests__/windows_only.js delete mode 100644 tests_integration/cli/config/editorconfig/eol/cr.js delete mode 100644 tests_integration/cli/config/editorconfig/eol/crlf.js delete mode 100644 tests_integration/cli/config/editorconfig/eol/lf.js diff --git a/jest.config.js b/jest.config.js index c837041ac2d4..27f5356d673a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -17,9 +17,13 @@ module.exports = { "jest-snapshot-serializer-ansi" ], testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$", - testPathIgnorePatterns: ["tests/new_react", "tests/more_react"].concat( - isOldNode ? requiresPrettierInternals : [] - ), + testPathIgnorePatterns: ["tests/new_react", "tests/more_react"] + .concat(isOldNode ? requiresPrettierInternals : []) + .concat( + require("os").EOL == "\n" + ? ["tests_integration/__tests__/windows_only.js"] + : ["tests_integration/__tests__/unix_only.js"] + ), collectCoverage: ENABLE_COVERAGE, collectCoverageFrom: ["src/**/*.js", "index.js", "!/node_modules/"], coveragePathIgnorePatterns: [ diff --git a/tests_integration/__tests__/__snapshots__/config-resolution.js.snap b/tests_integration/__tests__/__snapshots__/config-resolution.js.snap index 0e3519797f91..c23a07772445 100644 --- a/tests_integration/__tests__/__snapshots__/config-resolution.js.snap +++ b/tests_integration/__tests__/__snapshots__/config-resolution.js.snap @@ -3,17 +3,7 @@ exports[`CLI overrides take precedence (stderr) 1`] = `""`; exports[`CLI overrides take precedence (stdout) 1`] = ` -"function f() {/*CR*/ console.log(/*CR*/ \\"line endings should be CR\\"/*CR*/ )/*CR*/}/*CR*/function f() {/*CR*/ - console.log(/*CR*/ - \\"line endings should be CRLF\\"/*CR*/ - )/*CR*/ -}/*CR*/ -function f() { - console.log( - \\"line endings should be LF\\" - ) -} -function f() { +"function f() { console.log( \\"should have tab width 8\\" ) @@ -50,6 +40,8 @@ function js() { \\"use strict\\"; module.exports = { + endOfLine: + \\"lf\\", tabWidth: 8 }; function noConfigJs() { @@ -124,13 +116,7 @@ exports[`resolves configuration file with --find-config-path file (write) 1`] = exports[`resolves configuration from external files (stderr) 1`] = `""`; exports[`resolves configuration from external files (stdout) 1`] = ` -"function f() {/*CR*/ console.log(\\"line endings should be CR\\")/*CR*/}/*CR*/function f() {/*CR*/ - console.log(\\"line endings should be CRLF\\")/*CR*/ -}/*CR*/ -function f() { - console.log(\\"line endings should be LF\\") -} -function f() { +"function f() { console.log(\\"should have tab width 8\\") } function f() { @@ -153,6 +139,7 @@ function js() { \\"use strict\\"; module.exports = { + endOfLine: \\"lf\\", tabWidth: 8 }; function noConfigJs() { diff --git a/tests_integration/__tests__/__snapshots__/unix_only.js.snap b/tests_integration/__tests__/__snapshots__/unix_only.js.snap new file mode 100644 index 000000000000..02ef9a4faddc --- /dev/null +++ b/tests_integration/__tests__/__snapshots__/unix_only.js.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Has correct default Unix line endings (stderr) 1`] = `""`; + +exports[`Has correct default Unix line endings (stdout) 1`] = ` +"function f() { + console.log(\\"should have tab width 8\\") +} +function f() { + console.log(\\"should have space width 2\\") +} +function f() { + console.log(\\"should have space width 8\\") +} +function f() { + console.log( + \\"should have space width 2 despite ../.editorconfig specifying 8, because ./.hg is present\\" + ) +} +console.log(\\"jest/__best-tests__/file.js should have semi\\"); +console.log(\\"jest/Component.js should not have semi\\") +console.log(\\"jest/Component.test.js should have semi\\"); +function js() { + console.log(\\"js/file.js should have tab width 8 (1 if CLI)\\"); +} +\\"use strict\\"; + +module.exports = { + endOfLine: \\"lf\\", + tabWidth: 8 +}; +function noConfigJs() { + console.log(\\"no-config/file.js should have no semicolons\\") +} +function packageJs() { + console.log(\\"package/file.js should have tab width 3\\"); +} +function rcJson() { + console.log.apply(null, [ + 'rc-json/file.js', + 'should have trailing comma', + 'and single quotes', + ]); +} +function rcToml() { + console.log.apply(null, [ + 'rc-toml/file.js', + 'should have trailing comma', + 'and single quotes', + ]); +} +function rcYaml() { + console.log.apply(null, [ + 'rc-yaml/file.js', + 'should have trailing comma', + 'and single quotes', + ]); +} +" +`; + +exports[`Has correct default Unix line endings (write) 1`] = `Array []`; diff --git a/tests_integration/__tests__/__snapshots__/windows_only.js.snap b/tests_integration/__tests__/__snapshots__/windows_only.js.snap new file mode 100644 index 000000000000..07511e6156a9 --- /dev/null +++ b/tests_integration/__tests__/__snapshots__/windows_only.js.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Has correct default Windows line endings (stderr) 1`] = `""`; + +exports[`Has correct default Windows line endings (stdout) 1`] = ` +"function f() { + console.log(\\"should have tab width 8\\") +} +function f() { + console.log(\\"should have space width 2\\") +} +function f() { + console.log(\\"should have space width 8\\") +} +function f() { + console.log( + \\"should have space width 2 despite ../.editorconfig specifying 8, because ./.hg is present\\" + ) +} +console.log(\\"jest/__best-tests__/file.js should have semi\\");/*CR*/ +console.log(\\"jest/Component.js should not have semi\\")/*CR*/ +console.log(\\"jest/Component.test.js should have semi\\");/*CR*/ +function js() { + console.log(\\"js/file.js should have tab width 8 (1 if CLI)\\"); +} +\\"use strict\\"; + +module.exports = { + endOfLine: \\"lf\\", + tabWidth: 8 +}; +function noConfigJs() { + console.log(\\"no-config/file.js should have no semicolons\\") +} +function packageJs() {/*CR*/ + console.log(\\"package/file.js should have tab width 3\\");/*CR*/ +}/*CR*/ +function rcJson() {/*CR*/ + console.log.apply(null, [/*CR*/ + 'rc-json/file.js',/*CR*/ + 'should have trailing comma',/*CR*/ + 'and single quotes',/*CR*/ + ]);/*CR*/ +}/*CR*/ +function rcToml() {/*CR*/ + console.log.apply(null, [/*CR*/ + 'rc-toml/file.js',/*CR*/ + 'should have trailing comma',/*CR*/ + 'and single quotes',/*CR*/ + ]);/*CR*/ +}/*CR*/ +function rcYaml() {/*CR*/ + console.log.apply(null, [/*CR*/ + 'rc-yaml/file.js',/*CR*/ + 'should have trailing comma',/*CR*/ + 'and single quotes',/*CR*/ + ]);/*CR*/ +}/*CR*/ +" +`; + +exports[`Has correct default Windows line endings (write) 1`] = `Array []`; diff --git a/tests_integration/__tests__/__snapshots__/with-config-precedence.js.snap b/tests_integration/__tests__/__snapshots__/with-config-precedence.js.snap index 3ff3063e9652..9ac3ca80403a 100644 --- a/tests_integration/__tests__/__snapshots__/with-config-precedence.js.snap +++ b/tests_integration/__tests__/__snapshots__/with-config-precedence.js.snap @@ -54,6 +54,7 @@ exports[`CLI overrides gets ignored when config exists with --config-precedence \\"use strict\\"; module.exports = { + endOfLine: \\"lf\\", tabWidth: 8 }; " @@ -70,6 +71,7 @@ exports[`CLI overrides take lower precedence with --config-precedence file-overr \\"use strict\\"; module.exports = { + endOfLine: \\"lf\\", tabWidth: 8 }; " @@ -80,17 +82,7 @@ exports[`CLI overrides take lower precedence with --config-precedence file-overr exports[`CLI overrides take precedence with --config-precedence cli-override (stderr) 1`] = `""`; exports[`CLI overrides take precedence with --config-precedence cli-override (stdout) 1`] = ` -"function f() {/*CR*/ console.log(/*CR*/ \\"line endings should be CR\\"/*CR*/ )/*CR*/}/*CR*/function f() {/*CR*/ - console.log(/*CR*/ - \\"line endings should be CRLF\\"/*CR*/ - )/*CR*/ -}/*CR*/ -function f() { - console.log( - \\"line endings should be LF\\" - ) -} -function f() { +"function f() { console.log( \\"should have tab width 8\\" ) @@ -127,6 +119,8 @@ function js() { \\"use strict\\"; module.exports = { + endOfLine: + \\"lf\\", tabWidth: 8 }; function noConfigJs() { @@ -177,17 +171,7 @@ exports[`CLI overrides take precedence with --config-precedence cli-override (wr exports[`CLI overrides take precedence without --config-precedence (stderr) 1`] = `""`; exports[`CLI overrides take precedence without --config-precedence (stdout) 1`] = ` -"function f() {/*CR*/ console.log(/*CR*/ \\"line endings should be CR\\"/*CR*/ )/*CR*/}/*CR*/function f() {/*CR*/ - console.log(/*CR*/ - \\"line endings should be CRLF\\"/*CR*/ - )/*CR*/ -}/*CR*/ -function f() { - console.log( - \\"line endings should be LF\\" - ) -} -function f() { +"function f() { console.log( \\"should have tab width 8\\" ) @@ -224,6 +208,8 @@ function js() { \\"use strict\\"; module.exports = { + endOfLine: + \\"lf\\", tabWidth: 8 }; function noConfigJs() { diff --git a/tests_integration/__tests__/arg-parsing.js b/tests_integration/__tests__/arg-parsing.js index 36420e2d1779..0b76417b562f 100644 --- a/tests_integration/__tests__/arg-parsing.js +++ b/tests_integration/__tests__/arg-parsing.js @@ -3,37 +3,67 @@ const runPrettier = require("../runPrettier"); describe("boolean flags do not swallow the next argument", () => { - runPrettier("cli/arg-parsing", ["--single-quote", "file.js"]).test({ + runPrettier("cli/arg-parsing", [ + "--end-of-line", + "lf", + "--single-quote", + "file.js" + ]).test({ status: 0 }); }); describe("negated options work", () => { - runPrettier("cli/arg-parsing", ["--no-semi", "file.js"]).test({ + runPrettier("cli/arg-parsing", [ + "--end-of-line", + "lf", + "--no-semi", + "file.js" + ]).test({ status: 0 }); }); describe("unknown options are warned", () => { - runPrettier("cli/arg-parsing", ["file.js", "--unknown"]).test({ + runPrettier("cli/arg-parsing", [ + "--end-of-line", + "lf", + "file.js", + "--unknown" + ]).test({ status: 0 }); }); describe("unknown negated options are warned", () => { - runPrettier("cli/arg-parsing", ["file.js", "--no-unknown"]).test({ + runPrettier("cli/arg-parsing", [ + "--end-of-line", + "lf", + "file.js", + "--no-unknown" + ]).test({ status: 0 }); }); describe("deprecated options are warned", () => { - runPrettier("cli/arg-parsing", ["file.js", "--flow-parser"]).test({ + runPrettier("cli/arg-parsing", [ + "--end-of-line", + "lf", + "file.js", + "--flow-parser" + ]).test({ status: 0 }); }); describe("deprecated option values are warned", () => { - runPrettier("cli/arg-parsing", ["file.js", "--trailing-comma"]).test({ + runPrettier("cli/arg-parsing", [ + "--end-of-line", + "lf", + "file.js", + "--trailing-comma" + ]).test({ status: 0 }); }); diff --git a/tests_integration/__tests__/config-resolution.js b/tests_integration/__tests__/config-resolution.js index 6072fde9796d..96ff204c6506 100644 --- a/tests_integration/__tests__/config-resolution.js +++ b/tests_integration/__tests__/config-resolution.js @@ -8,13 +8,13 @@ const prettier = require("prettier/local"); expect.addSnapshotSerializer(require("../path-serializer")); describe("resolves configuration from external files", () => { - runPrettier("cli/config/", ["**/*.js"]).test({ + runPrettier("cli/config/", ["--end-of-line", "lf", "**/*.js"]).test({ status: 0 }); }); describe("resolves configuration from external files and overrides by extname", () => { - runPrettier("cli/config/", ["**/*.ts"]).test({ + runPrettier("cli/config/", ["--end-of-line", "lf", "**/*.ts"]).test({ status: 0 }); }); @@ -50,14 +50,25 @@ describe("resolves toml configuration file with --find-config-path file", () => }); describe("prints nothing when no file found with --find-config-path", () => { - runPrettier("cli/config/", ["--find-config-path", ".."]).test({ + runPrettier("cli/config/", [ + "--end-of-line", + "lf", + "--find-config-path", + ".." + ]).test({ stdout: "", status: 1 }); }); describe("CLI overrides take precedence", () => { - runPrettier("cli/config/", ["--print-width", "1", "**/*.js"]).test({ + runPrettier("cli/config/", [ + "--end-of-line", + "lf", + "--print-width", + "1", + "**/*.js" + ]).test({ status: 0 }); }); diff --git a/tests_integration/__tests__/debug-check.js b/tests_integration/__tests__/debug-check.js index d0641ee64053..3d7ee2530218 100644 --- a/tests_integration/__tests__/debug-check.js +++ b/tests_integration/__tests__/debug-check.js @@ -22,6 +22,8 @@ describe("checks stdin with --debug-check", () => { describe("show diff for 2+ error files with --debug-check", () => { runPrettier("cli/debug-check", [ + "--end-of-line", + "lf", "*.debug-check", "--debug-check", "--plugin", diff --git a/tests_integration/__tests__/ignore-path.js b/tests_integration/__tests__/ignore-path.js index b4afa66e2c3c..f5ef0bed39af 100644 --- a/tests_integration/__tests__/ignore-path.js +++ b/tests_integration/__tests__/ignore-path.js @@ -26,7 +26,9 @@ describe("ignore file when using --debug-check", () => { }); describe("outputs files as-is if no --write", () => { - runPrettier("cli/ignore-path", ["regular-module.js"]).test({ + runPrettier("cli/ignore-path", ["regular-module.js"], { + ignoreLineEndings: true + }).test({ status: 0 }); }); diff --git a/tests_integration/__tests__/infer-parser.js b/tests_integration/__tests__/infer-parser.js index e5e766620166..da2d673fb1e0 100644 --- a/tests_integration/__tests__/infer-parser.js +++ b/tests_integration/__tests__/infer-parser.js @@ -49,7 +49,7 @@ describe("stdin with unknown path and no parser", () => { describe("unknown path and no parser", () => { describe("specific file", () => { - runPrettier("cli/infer-parser/", ["FOO"]).test({ + runPrettier("cli/infer-parser/", ["--end-of-line", "lf", "FOO"]).test({ status: 2, stdout: "", write: [] @@ -57,7 +57,7 @@ describe("unknown path and no parser", () => { }); describe("multiple files", () => { - runPrettier("cli/infer-parser/", ["*"]).test({ + runPrettier("cli/infer-parser/", ["--end-of-line", "lf", "*"]).test({ status: 2, write: [] }); diff --git a/tests_integration/__tests__/parser-api.js b/tests_integration/__tests__/parser-api.js index e1c25e2b6321..e3af8b1281ce 100644 --- a/tests_integration/__tests__/parser-api.js +++ b/tests_integration/__tests__/parser-api.js @@ -31,6 +31,8 @@ test("allows usage of prettier's supported parsers", () => { describe("allows passing a string to resolve a parser", () => { runPrettier("./custom-parsers/", [ + "--end-of-line", + "lf", "./custom-rename-input.js", "--parser", "./custom-rename-parser" diff --git a/tests_integration/__tests__/plugin-extensions.js b/tests_integration/__tests__/plugin-extensions.js index e13d3274693a..78169070149b 100644 --- a/tests_integration/__tests__/plugin-extensions.js +++ b/tests_integration/__tests__/plugin-extensions.js @@ -4,7 +4,9 @@ const runPrettier = require("../runPrettier"); const EOL = "\n"; describe("uses 'extensions' from languages to determine parser", () => { - runPrettier("plugins/extensions", ["*.foo", "--plugin=./plugin"]).test({ + runPrettier("plugins/extensions", ["*.foo", "--plugin=./plugin"], { + ignoreLineEndings: true + }).test({ stdout: "!contents" + EOL, stderr: "", status: 0, diff --git a/tests_integration/__tests__/plugin-preprocess.js b/tests_integration/__tests__/plugin-preprocess.js index ee6f97cb2dd8..9f6fba28445c 100644 --- a/tests_integration/__tests__/plugin-preprocess.js +++ b/tests_integration/__tests__/plugin-preprocess.js @@ -4,7 +4,9 @@ const runPrettier = require("../runPrettier"); const EOL = "\n"; describe("parser preprocess function is used to reshape input text", () => { - runPrettier("plugins/preprocess", ["*.foo", "--plugin=./plugin"]).test({ + runPrettier("plugins/preprocess", ["*.foo", "--plugin=./plugin"], { + ignoreLineEndings: true + }).test({ stdout: "preprocessed:contents" + EOL, stderr: "", status: 0, diff --git a/tests_integration/__tests__/plugin-resolution.js b/tests_integration/__tests__/plugin-resolution.js index 2e9a51d6f50c..645346a51495 100644 --- a/tests_integration/__tests__/plugin-resolution.js +++ b/tests_integration/__tests__/plugin-resolution.js @@ -74,11 +74,17 @@ describe("automatically loads '@prettier/plugin-*' from --plugin-search-dir (dif }); describe("does not crash when --plugin-search-dir does not contain node_modules", () => { - runPrettier("plugins/extensions", [ - "file.foo", - "--plugin=./plugin", - "--plugin-search-dir=." - ]).test({ + runPrettier( + "plugins/extensions", + [ + "file.foo", + "--end-of-line", + "lf", + "--plugin=./plugin", + "--plugin-search-dir=." + ], + { ignoreLineEndings: true } + ).test({ stdout: "!contents" + EOL, stderr: "", status: 0, diff --git a/tests_integration/__tests__/support-info.js b/tests_integration/__tests__/support-info.js index eecbdc034ad3..aa10434c8401 100644 --- a/tests_integration/__tests__/support-info.js +++ b/tests_integration/__tests__/support-info.js @@ -64,4 +64,4 @@ function getCoreInfo(version) { {} ); return { languages, options }; -} +} \ No newline at end of file diff --git a/tests_integration/__tests__/unix_only.js b/tests_integration/__tests__/unix_only.js new file mode 100644 index 000000000000..e8730e65f3d6 --- /dev/null +++ b/tests_integration/__tests__/unix_only.js @@ -0,0 +1,11 @@ +"use strict"; + +const runPrettier = require("../runPrettier"); + +expect.addSnapshotSerializer(require("../path-serializer")); + +describe("Has correct default Unix line endings", () => { + runPrettier("cli/config/", ["**/*.js"]).test({ + status: 0 + }); +}); diff --git a/tests_integration/__tests__/windows_only.js b/tests_integration/__tests__/windows_only.js new file mode 100644 index 000000000000..622cc915deaf --- /dev/null +++ b/tests_integration/__tests__/windows_only.js @@ -0,0 +1,11 @@ +"use strict"; + +const runPrettier = require("../runPrettier"); + +expect.addSnapshotSerializer(require("../path-serializer")); + +describe("Has correct default Windows line endings", () => { + runPrettier("cli/config/", ["**/*.js"]).test({ + status: 0 + }); +}); diff --git a/tests_integration/__tests__/with-config-precedence.js b/tests_integration/__tests__/with-config-precedence.js index 19333c35fbd7..d1e58beefcf5 100644 --- a/tests_integration/__tests__/with-config-precedence.js +++ b/tests_integration/__tests__/with-config-precedence.js @@ -3,13 +3,21 @@ const runPrettier = require("../runPrettier"); describe("CLI overrides take precedence without --config-precedence", () => { - runPrettier("cli/config/", ["--print-width", "1", "**/*.js"]).test({ + runPrettier("cli/config/", [ + "--end-of-line", + "lf", + "--print-width", + "1", + "**/*.js" + ]).test({ status: 0 }); }); describe("CLI overrides take precedence with --config-precedence cli-override", () => { runPrettier("cli/config/", [ + "--end-of-line", + "lf", "--print-width", "1", "--config-precedence", @@ -22,6 +30,8 @@ describe("CLI overrides take precedence with --config-precedence cli-override", describe("CLI overrides take lower precedence with --config-precedence file-override", () => { runPrettier("cli/config/js/", [ + "--end-of-line", + "crlf", "--tab-width", "1", "--config-precedence", @@ -34,6 +44,8 @@ describe("CLI overrides take lower precedence with --config-precedence file-over describe("CLI overrides are still applied when no config is found with --config-precedence file-override", () => { runPrettier("cli/config/no-config/", [ + "--end-of-line", + "lf", "--tab-width", "6", "--config-precedence", @@ -60,6 +72,8 @@ describe("CLI overrides gets ignored when config exists with --config-precedence describe("CLI overrides gets applied when no config exists with --config-precedence prefer-file", () => { runPrettier("cli/config/no-config/", [ + "--end-of-line", + "lf", "--print-width", "1", "--tab-width", diff --git a/tests_integration/__tests__/with-parser-inference.js b/tests_integration/__tests__/with-parser-inference.js index a0b7ac8636d8..c8ca46a2ee5e 100644 --- a/tests_integration/__tests__/with-parser-inference.js +++ b/tests_integration/__tests__/with-parser-inference.js @@ -4,7 +4,7 @@ const runPrettier = require("../runPrettier"); const prettier = require("prettier/local"); describe("infers postcss parser", () => { - runPrettier("cli/with-parser-inference", ["*"]).test({ + runPrettier("cli/with-parser-inference", ["--end-of-line", "lf", "*"]).test({ status: 0 }); }); diff --git a/tests_integration/__tests__/with-shebang.js b/tests_integration/__tests__/with-shebang.js index e90f63633fde..ceda4c5c9fd2 100644 --- a/tests_integration/__tests__/with-shebang.js +++ b/tests_integration/__tests__/with-shebang.js @@ -3,7 +3,9 @@ const runPrettier = require("../runPrettier"); describe("preserves shebang", () => { - runPrettier("cli/with-shebang", ["issue1890.js"]).test({ - status: 0 - }); + runPrettier("cli/with-shebang", ["--end-of-line", "lf", "issue1890.js"]).test( + { + status: 0 + } + ); }); diff --git a/tests_integration/cli/config/.prettierrc b/tests_integration/cli/config/.prettierrc index 8f522b78c33d..7c221bcc11e9 100644 --- a/tests_integration/cli/config/.prettierrc +++ b/tests_integration/cli/config/.prettierrc @@ -1,3 +1,4 @@ +endOfLine: 'lf' overrides: - files: "*.js" options: diff --git a/tests_integration/cli/config/editorconfig/.editorconfig b/tests_integration/cli/config/editorconfig/.editorconfig index 15ea263a8ed3..8bd599323adc 100644 --- a/tests_integration/cli/config/editorconfig/.editorconfig +++ b/tests_integration/cli/config/editorconfig/.editorconfig @@ -12,14 +12,4 @@ indent_style = space indent_size = 2 [lib/indent_size=tab.js] -indent_size = tab - -# End of line (--eol opition) -[eol/cr.js] -end_of_line = cr - -[eol/crlf.js] -end_of_line = crlf - -[eol/lf.js] -end_of_line = lf +indent_size = tab \ No newline at end of file diff --git a/tests_integration/cli/config/editorconfig/eol/cr.js b/tests_integration/cli/config/editorconfig/eol/cr.js deleted file mode 100644 index 6d366df61d87..000000000000 --- a/tests_integration/cli/config/editorconfig/eol/cr.js +++ /dev/null @@ -1,3 +0,0 @@ -function f() { - console.log("line endings should be CR") -} diff --git a/tests_integration/cli/config/editorconfig/eol/crlf.js b/tests_integration/cli/config/editorconfig/eol/crlf.js deleted file mode 100644 index 8b25e5fd3202..000000000000 --- a/tests_integration/cli/config/editorconfig/eol/crlf.js +++ /dev/null @@ -1,3 +0,0 @@ -function f() { - console.log("line endings should be CRLF") -} diff --git a/tests_integration/cli/config/editorconfig/eol/lf.js b/tests_integration/cli/config/editorconfig/eol/lf.js deleted file mode 100644 index d17f615db592..000000000000 --- a/tests_integration/cli/config/editorconfig/eol/lf.js +++ /dev/null @@ -1,3 +0,0 @@ -function f() { - console.log("line endings should be LF") -} diff --git a/tests_integration/cli/config/js/prettier.config.js b/tests_integration/cli/config/js/prettier.config.js index a4b0c1d6b096..da1c5408e77c 100644 --- a/tests_integration/cli/config/js/prettier.config.js +++ b/tests_integration/cli/config/js/prettier.config.js @@ -1,5 +1,6 @@ "use strict"; module.exports = { + endOfLine: 'lf', tabWidth: 8 }; diff --git a/tests_integration/runPrettier.js b/tests_integration/runPrettier.js index b5dd75c62344..99e9a1ede9fd 100644 --- a/tests_integration/runPrettier.js +++ b/tests_integration/runPrettier.js @@ -111,8 +111,11 @@ function runPrettier(dir, args, options) { const value = // \r is trimmed from jest snapshots by default; // manually replacing this character with /*CR*/ to test its true presence + // If ignoreLineEndings is specified, \r is simply deleted instead typeof result[name] === "string" - ? stripAnsi(result[name]).replace(/\r/g, "/*CR*/") + ? options.ignoreLineEndings + ? stripAnsi(result[name]).replace(/\r/g, "") + : stripAnsi(result[name]).replace(/\r/g, "/*CR*/") : result[name]; if (name in testOptions) { if (name === "status" && testOptions[name] === "non-zero") { From a924b3ff604cf988b033c8b40bb6c028c17b4bd9 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 7 Nov 2018 15:48:50 -0500 Subject: [PATCH 04/10] Lint --- tests_integration/__tests__/support-info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests_integration/__tests__/support-info.js b/tests_integration/__tests__/support-info.js index aa10434c8401..eecbdc034ad3 100644 --- a/tests_integration/__tests__/support-info.js +++ b/tests_integration/__tests__/support-info.js @@ -64,4 +64,4 @@ function getCoreInfo(version) { {} ); return { languages, options }; -} \ No newline at end of file +} From 8a5e0d171a5b2ac2fdaef5292c4f5ab1beb2c879 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 8 Nov 2018 13:59:20 -0500 Subject: [PATCH 05/10] Cleaning up --- .gitattributes | 1 - azure-pipelines.yml | 50 +++++++------------ jest.config.js | 4 +- .../windows/__snapshots__/jsfmt.spec.js.snap | 35 ------------- tests/windows/jsfmt.spec.js | 1 - tests/windows/line-ending.js | 5 -- tests/windows/template.js | 7 --- ...{windows_only.js.snap => eol-crlf.js.snap} | 0 .../{unix_only.js.snap => eol-lf.js.snap} | 0 .../{windows_only.js => eol-crlf.js} | 0 .../__tests__/{unix_only.js => eol-lf.js} | 0 11 files changed, 20 insertions(+), 83 deletions(-) delete mode 100644 tests/windows/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/windows/jsfmt.spec.js delete mode 100644 tests/windows/line-ending.js delete mode 100644 tests/windows/template.js rename tests_integration/__tests__/__snapshots__/{windows_only.js.snap => eol-crlf.js.snap} (100%) rename tests_integration/__tests__/__snapshots__/{unix_only.js.snap => eol-lf.js.snap} (100%) rename tests_integration/__tests__/{windows_only.js => eol-crlf.js} (100%) rename tests_integration/__tests__/{unix_only.js => eol-lf.js} (100%) diff --git a/.gitattributes b/.gitattributes index 04f32be0f134..8847e4f9ac6e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,3 @@ # Make sure baseline files have consistent line endings -*.txt text eol=lf *.snap text eol=lf *.debug-check text eol=lf \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 56dff2fbf0d9..1a6d65109b92 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,24 +9,17 @@ jobs: displayName: Test production bundle (Linux, node 4) pool: vmImage: 'Ubuntu 16.04' - variables: - node_version: 4.x - steps: - - template: azure-pipelines/production-bundle.yml - -# Test production bundle on Linux using Node 9 -- job: prod_linux_node_9 - displayName: Test production bundle (Linux, node 9) - pool: - vmImage: 'Ubuntu 16.04' - variables: - node_version: 9.x - report_summaries: true + strategy: + matrix: + Production Bundle Node 4 (Linux): + node.version: '4.x' + Production Bundle Node 9 (Linux): + node.version: '9.x' steps: - template: azure-pipelines/production-bundle.yml -# Build and test on Windows using Node 8 -- job: build_all_windows +# Build and test on Windows +- job: Test(Windows) displayName: Run tests using Node 8 (Windows) pool: vmImage: vs2017-win2016 @@ -36,8 +29,8 @@ jobs: steps: - template: azure-pipelines/run-tests.yml -# Build and test on macOS using Node 8 -- job: build_all_darwin +# Build and test on macOS +- job: Test(macOS) displayName: Run tests using Node 8 (macOS) pool: vmImage: macos-10.13 @@ -47,24 +40,17 @@ jobs: steps: - template: azure-pipelines/run-tests.yml -# Build and test on Linux using Node 8 -- job: build_all_linux_node_8 - displayName: Run tests using Node 8 (Linux) - pool: - vmImage: 'Ubuntu 16.04' - variables: - node_version: 8.x - report_summaries: true - steps: - - template: azure-pipelines/run-tests.yml - -# Build and test on Linux using Node 11 -- job: build_all_linux_node_11 - displayName: Run tests using Node 11 (Linux) +# Build and test on Linux +- job: 'Test(Linux)' pool: vmImage: 'Ubuntu 16.04' + strategy: + matrix: + Run tests using Node 8 (Linux): + node.version: '8.x' + Production Bundle Node 11 (Linux): + node.version: '11.x' variables: - node_version: 11.x report_summaries: true steps: - template: azure-pipelines/run-tests.yml diff --git a/jest.config.js b/jest.config.js index 27f5356d673a..1b6f86a6ed4a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -21,8 +21,8 @@ module.exports = { .concat(isOldNode ? requiresPrettierInternals : []) .concat( require("os").EOL == "\n" - ? ["tests_integration/__tests__/windows_only.js"] - : ["tests_integration/__tests__/unix_only.js"] + ? ["tests_integration/__tests__/eol-crlf.js"] + : ["tests_integration/__tests__/eol-lf.js"] ), collectCoverage: ENABLE_COVERAGE, collectCoverageFrom: ["src/**/*.js", "index.js", "!/node_modules/"], diff --git a/tests/windows/__snapshots__/jsfmt.spec.js.snap b/tests/windows/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 6980c269cd22..000000000000 --- a/tests/windows/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,35 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`line-ending.js - flow-verify 1`] = ` -this; -has; -windows; -line; -endings; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -this; -has; -windows; -line; -endings; - -`; - -exports[`template.js - flow-verify 1`] = ` -const aLongString = \` -Line 1 -Line 2 -Line 3 -Line 4 -Line 5 -\`; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -const aLongString = \` -Line 1 -Line 2 -Line 3 -Line 4 -Line 5 -\`; - -`; diff --git a/tests/windows/jsfmt.spec.js b/tests/windows/jsfmt.spec.js deleted file mode 100644 index a842e1348721..000000000000 --- a/tests/windows/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["flow", "typescript"]); diff --git a/tests/windows/line-ending.js b/tests/windows/line-ending.js deleted file mode 100644 index 65eb8ff78071..000000000000 --- a/tests/windows/line-ending.js +++ /dev/null @@ -1,5 +0,0 @@ -this; -has; -windows; -line; -endings; diff --git a/tests/windows/template.js b/tests/windows/template.js deleted file mode 100644 index 5b9e637adc51..000000000000 --- a/tests/windows/template.js +++ /dev/null @@ -1,7 +0,0 @@ -const aLongString = ` -Line 1 -Line 2 -Line 3 -Line 4 -Line 5 -`; diff --git a/tests_integration/__tests__/__snapshots__/windows_only.js.snap b/tests_integration/__tests__/__snapshots__/eol-crlf.js.snap similarity index 100% rename from tests_integration/__tests__/__snapshots__/windows_only.js.snap rename to tests_integration/__tests__/__snapshots__/eol-crlf.js.snap diff --git a/tests_integration/__tests__/__snapshots__/unix_only.js.snap b/tests_integration/__tests__/__snapshots__/eol-lf.js.snap similarity index 100% rename from tests_integration/__tests__/__snapshots__/unix_only.js.snap rename to tests_integration/__tests__/__snapshots__/eol-lf.js.snap diff --git a/tests_integration/__tests__/windows_only.js b/tests_integration/__tests__/eol-crlf.js similarity index 100% rename from tests_integration/__tests__/windows_only.js rename to tests_integration/__tests__/eol-crlf.js diff --git a/tests_integration/__tests__/unix_only.js b/tests_integration/__tests__/eol-lf.js similarity index 100% rename from tests_integration/__tests__/unix_only.js rename to tests_integration/__tests__/eol-lf.js From 99841097a9fa179694271e788ea5676f58b2a417 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 8 Nov 2018 14:01:53 -0500 Subject: [PATCH 06/10] Fixing names --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1a6d65109b92..545091c53fa9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,7 +19,7 @@ jobs: - template: azure-pipelines/production-bundle.yml # Build and test on Windows -- job: Test(Windows) +- job: Test_Windows displayName: Run tests using Node 8 (Windows) pool: vmImage: vs2017-win2016 @@ -30,7 +30,7 @@ jobs: - template: azure-pipelines/run-tests.yml # Build and test on macOS -- job: Test(macOS) +- job: Test_macOS displayName: Run tests using Node 8 (macOS) pool: vmImage: macos-10.13 @@ -41,7 +41,7 @@ jobs: - template: azure-pipelines/run-tests.yml # Build and test on Linux -- job: 'Test(Linux)' +- job: 'Test_Linux' pool: vmImage: 'Ubuntu 16.04' strategy: From 58268956209ba25dbc733d6d7b864aae1741c441 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 8 Nov 2018 14:05:37 -0500 Subject: [PATCH 07/10] Clean up naming --- azure-pipelines.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 545091c53fa9..4517fdfbe7a1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,22 +5,22 @@ trigger: jobs: # Test production bundle on Linux using Node 4 -- job: prod_linux_node_4 - displayName: Test production bundle (Linux, node 4) +- job: Prod_Linux + displayName: Test production bundle on Linux pool: vmImage: 'Ubuntu 16.04' strategy: matrix: - Production Bundle Node 4 (Linux): - node.version: '4.x' - Production Bundle Node 9 (Linux): - node.version: '9.x' + Node4: + node_version: '4.x' + Node9: + node_version: '9.x' steps: - template: azure-pipelines/production-bundle.yml # Build and test on Windows - job: Test_Windows - displayName: Run tests using Node 8 (Windows) + displayName: Tests on Windows Node8 pool: vmImage: vs2017-win2016 variables: @@ -31,7 +31,7 @@ jobs: # Build and test on macOS - job: Test_macOS - displayName: Run tests using Node 8 (macOS) + displayName: Tests on macOS Node8 pool: vmImage: macos-10.13 variables: @@ -41,22 +41,23 @@ jobs: - template: azure-pipelines/run-tests.yml # Build and test on Linux -- job: 'Test_Linux' +- job: Test_Linux + displayName: Tests on Linux pool: vmImage: 'Ubuntu 16.04' strategy: matrix: - Run tests using Node 8 (Linux): - node.version: '8.x' - Production Bundle Node 11 (Linux): - node.version: '11.x' + Node8: + node_version: '8.x' + Node11: + node_version: '11.x' variables: report_summaries: true steps: - template: azure-pipelines/run-tests.yml # Lint checks on Linux -- job: lint_linux +- job: Lint_linux displayName: Lint (Linux) pool: vmImage: 'Ubuntu 16.04' From e47ea5ae93c4d42d353b158c9205207e871e3857 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 8 Nov 2018 14:13:34 -0500 Subject: [PATCH 08/10] try to consolidate images --- azure-pipelines.yml | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4517fdfbe7a1..da941947b006 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,39 +18,25 @@ jobs: steps: - template: azure-pipelines/production-bundle.yml -# Build and test on Windows -- job: Test_Windows - displayName: Tests on Windows Node8 - pool: - vmImage: vs2017-win2016 - variables: - node_version: 8.x - report_summaries: true - steps: - - template: azure-pipelines/run-tests.yml - -# Build and test on macOS -- job: Test_macOS - displayName: Tests on macOS Node8 - pool: - vmImage: macos-10.13 - variables: - node_version: 8.x - report_summaries: true - steps: - - template: azure-pipelines/run-tests.yml - # Build and test on Linux -- job: Test_Linux - displayName: Tests on Linux - pool: - vmImage: 'Ubuntu 16.04' +- job: Tests + displayName: Run tests strategy: matrix: - Node8: + Linux_Node_8: node_version: '8.x' - Node11: + image: 'Ubuntu 16.04' + Linux_Node_11: node_version: '11.x' + image: 'Ubuntu 16.04' + MacOS_Node_8: + node_version: '8.x' + image: 'macos-10.13' + Windows_Node_8: + node_version: '8.x' + image: 'vs2017-win2016' + pool: + vmImage: '$(image)' variables: report_summaries: true steps: From a613dfffd5154b0854ab7513c8a8d4ad7e02a55b Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 8 Nov 2018 14:17:56 -0500 Subject: [PATCH 09/10] Clean up --- ...run-tests.yml => azure-pipelines-tests.yml | 0 azure-pipelines.yml | 94 ++++++++++++++----- azure-pipelines/production-bundle.yml | 34 ------- 3 files changed, 70 insertions(+), 58 deletions(-) rename azure-pipelines/run-tests.yml => azure-pipelines-tests.yml (100%) delete mode 100644 azure-pipelines/production-bundle.yml diff --git a/azure-pipelines/run-tests.yml b/azure-pipelines-tests.yml similarity index 100% rename from azure-pipelines/run-tests.yml rename to azure-pipelines-tests.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index da941947b006..7a323b1d11a6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,6 +4,44 @@ trigger: jobs: +# Build and test on Windows +- job: Test_Windows + displayName: Tests on Windows Node8 + pool: + vmImage: vs2017-win2016 + variables: + node_version: 8.x + report_summaries: true + steps: + - template: azure-pipelines-tests.yml + +# Build and test on macOS +- job: Test_macOS + displayName: Tests on macOS Node8 + pool: + vmImage: macos-10.13 + variables: + node_version: 8.x + report_summaries: true + steps: + - template: azure-pipelines-tests.yml + +# Test on Linux +- job: Test_Linux + displayName: Run tests + pool: + vmImage: 'Ubuntu 16.04' + strategy: + matrix: + Node8: + node_version: '8.x' + Node11: + node_version: '11.x' + variables: + report_summaries: true + steps: + - template: azure-pipelines-tests.yml + # Test production bundle on Linux using Node 4 - job: Prod_Linux displayName: Test production bundle on Linux @@ -16,31 +54,39 @@ jobs: Node9: node_version: '9.x' steps: - - template: azure-pipelines/production-bundle.yml + - task: NodeTool@0 + inputs: + versionSpec: '11.x' + displayName: 'Install Node.js' -# Build and test on Linux -- job: Tests - displayName: Run tests - strategy: - matrix: - Linux_Node_8: - node_version: '8.x' - image: 'Ubuntu 16.04' - Linux_Node_11: - node_version: '11.x' - image: 'Ubuntu 16.04' - MacOS_Node_8: - node_version: '8.x' - image: 'macos-10.13' - Windows_Node_8: - node_version: '8.x' - image: 'vs2017-win2016' - pool: - vmImage: '$(image)' - variables: - report_summaries: true - steps: - - template: azure-pipelines/run-tests.yml + - script: npm install -g yarn + displayName: 'Get yarn' + + - script: yarn install + displayName: 'yarn install' + + - script: yarn check-deps + displayName: 'Check dependencies' + + - script: yarn build + displayName: 'Build' + + - task: NodeTool@0 + inputs: + versionSpec: '$(node_version)' + displayName: 'Use Node.js $(node_version)' + + - script: npm install -g yarn@1.5 + displayName: 'Get yarn compatible with node 4' + condition: eq(variables['node_version'], '4.x') + + - script: node ./scripts/test-dist.js + displayName: 'Test' + + - task: PublishTestResults@2 + inputs: + testResultsFiles: '**/junit.xml' + condition: and(variables['report_summaries'], succeededOrFailed()) # Lint checks on Linux - job: Lint_linux diff --git a/azure-pipelines/production-bundle.yml b/azure-pipelines/production-bundle.yml deleted file mode 100644 index edba1bc9af12..000000000000 --- a/azure-pipelines/production-bundle.yml +++ /dev/null @@ -1,34 +0,0 @@ -steps: -- task: NodeTool@0 - inputs: - versionSpec: '11.x' - displayName: 'Install Node.js' - -- script: npm install -g yarn - displayName: 'Get yarn' - -- script: yarn install - displayName: 'yarn install' - -- script: yarn check-deps - displayName: 'Check dependencies' - -- script: yarn build - displayName: 'Build' - -- task: NodeTool@0 - inputs: - versionSpec: '$(node_version)' - displayName: 'Use Node.js $(node_version)' - -- script: npm install -g yarn@1.5 - displayName: 'Get yarn compatible with node 4' - condition: eq(variables['node_version'], '4.x') - -- script: node ./scripts/test-dist.js - displayName: 'Test' - -- task: PublishTestResults@2 - inputs: - testResultsFiles: '**/junit.xml' - condition: and(variables['report_summaries'], succeededOrFailed()) \ No newline at end of file From ccb0d7fbd07404c6715cda0f254cd79c483ca33e Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 8 Nov 2018 14:24:21 -0500 Subject: [PATCH 10/10] Add back txt to gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 8847e4f9ac6e..04f32be0f134 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ # Make sure baseline files have consistent line endings +*.txt text eol=lf *.snap text eol=lf *.debug-check text eol=lf \ No newline at end of file