diff --git a/lib/formatters/__tests__/compactFormatter.test.js b/lib/formatters/__tests__/compactFormatter.test.js index e99cc9d80b..e8bb1521b8 100644 --- a/lib/formatters/__tests__/compactFormatter.test.js +++ b/lib/formatters/__tests__/compactFormatter.test.js @@ -2,7 +2,6 @@ const compactFormatter = require('../compactFormatter'); const prepareFormatterOutput = require('./prepareFormatterOutput'); -const stripIndent = require('common-tags').stripIndent; describe('compactFormatter', () => { let actualTTY; @@ -55,9 +54,7 @@ describe('compactFormatter', () => { const output = prepareFormatterOutput(results, compactFormatter); - expect(output).toBe(stripIndent` - path/to/file.css: line 1, col 1, error - Unexpected foo - `); + expect(output).toBe('path/to/file.css: line 1, col 1, error - Unexpected foo'); }); it('outputs warnings without stdout `TTY`', () => { @@ -83,9 +80,7 @@ describe('compactFormatter', () => { const output = prepareFormatterOutput(results, compactFormatter); - expect(output).toBe(stripIndent` - path/to/file.css: line 1, col 1, error - Unexpected foo - `); + expect(output).toBe('path/to/file.css: line 1, col 1, error - Unexpected foo'); }); it('output warnings with more than 80 characters and `process.stdout.columns` equal 90 characters', () => { @@ -114,9 +109,9 @@ describe('compactFormatter', () => { const output = prepareFormatterOutput(results, compactFormatter); - expect(output).toBe(stripIndent` - path/to/file.css: line 1, col 1, error - Unexpected very very very very very very very very very very very very very long foo - `); + expect(output).toBe( + 'path/to/file.css: line 1, col 1, error - Unexpected very very very very very very very very very very very very very long foo', + ); }); it('handles ignored file', () => { diff --git a/lib/formatters/__tests__/disableOptionsReportStringFormatter.test.js b/lib/formatters/__tests__/disableOptionsReportStringFormatter.test.js index 28f336e465..a55249e46c 100644 --- a/lib/formatters/__tests__/disableOptionsReportStringFormatter.test.js +++ b/lib/formatters/__tests__/disableOptionsReportStringFormatter.test.js @@ -2,7 +2,6 @@ const disableOptionsReportStringFormatterTest = require('../disableOptionsReportStringFormatter'); const stripAnsi = require('strip-ansi'); -const stripIndent = require('common-tags').stripIndent; describe('disableOptionsReportStringFormatter', () => { it('formatter stringified', () => { @@ -32,16 +31,15 @@ describe('disableOptionsReportStringFormatter', () => { ), ); - let expected = stripIndent` - foo - wrong disable: baz, start line: 1, end line: 3 - wrong disable: all, start line: 7 + const expected = ` +foo +wrong disable: baz, start line: 1, end line: 3 +wrong disable: all, start line: 7 - bar - wrong disable: all, start line: 19, end line: 33 - wrong disable: baz, start line: 99, end line: 102`; - - expected = `\n${expected}\n`; +bar +wrong disable: all, start line: 19, end line: 33 +wrong disable: baz, start line: 99, end line: 102 +`; expect(actual).toBe(expected); }); diff --git a/lib/formatters/__tests__/stringFormatter.test.js b/lib/formatters/__tests__/stringFormatter.test.js index dc28fa89f0..393b43ea19 100644 --- a/lib/formatters/__tests__/stringFormatter.test.js +++ b/lib/formatters/__tests__/stringFormatter.test.js @@ -2,7 +2,6 @@ const prepareFormatterOutput = require('./prepareFormatterOutput'); const stringFormatter = require('../stringFormatter'); -const stripIndent = require('common-tags').stripIndent; describe('stringFormatter', () => { let actualTTY; @@ -55,10 +54,11 @@ describe('stringFormatter', () => { const output = prepareFormatterOutput(results, stringFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - 1:1 × Unexpected foo bar - `); + expect(output).toBe( + ` +path/to/file.css + 1:1 × Unexpected foo bar`.trimStart(), + ); }); it('outputs warnings without stdout `TTY`', () => { @@ -84,9 +84,11 @@ describe('stringFormatter', () => { const output = prepareFormatterOutput(results, stringFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - 1:1 × Unexpected foo bar`); + expect(output).toBe( + ` +path/to/file.css + 1:1 × Unexpected foo bar`.trimStart(), + ); }); it('output warnings with more than 80 characters and `process.stdout.columns` equal 90 characters', () => { @@ -115,11 +117,12 @@ describe('stringFormatter', () => { const output = prepareFormatterOutput(results, stringFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - 1:1 × Unexpected very very very very very very very bar-very-very-very-very-very-long - very very very very very very long foo - `); + expect(output).toBe( + ` +path/to/file.css + 1:1 × Unexpected very very very very very very very bar-very-very-very-very-very-long + very very very very very very long foo`.trimStart(), + ); }); it('condenses deprecations and invalid option warnings', () => { @@ -160,11 +163,12 @@ describe('stringFormatter', () => { const output = prepareFormatterOutput(results, stringFormatter); - expect(output).toBe(stripIndent` - Invalid Option: Unexpected option for baz + expect(output).toBe( + ` +Invalid Option: Unexpected option for baz - Deprecation Warning: Deprecated foo See: bar - `); +Deprecation Warning: Deprecated foo See: bar`.trimStart(), + ); }); it('handles ignored file', () => { @@ -204,8 +208,10 @@ describe('stringFormatter', () => { const output = prepareFormatterOutput(results, stringFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - 1:1 × bar`); + expect(output).toBe( + ` +path/to/file.css + 1:1 × bar`.trimStart(), + ); }); }); diff --git a/lib/formatters/__tests__/unixFormatter.test.js b/lib/formatters/__tests__/unixFormatter.test.js index b07156a1e7..92e0ae3a1f 100644 --- a/lib/formatters/__tests__/unixFormatter.test.js +++ b/lib/formatters/__tests__/unixFormatter.test.js @@ -1,7 +1,6 @@ 'use strict'; const prepareFormatterOutput = require('./prepareFormatterOutput'); -const stripIndent = require('common-tags').stripIndent; const unixFormatter = require('../unixFormatter'); describe('unixFormatter', () => { @@ -62,12 +61,13 @@ describe('unixFormatter', () => { const output = prepareFormatterOutput(results, unixFormatter); - expect(output).toBe(stripIndent` - path/to/file.css:1:1: Unexpected foo [error] - path/to/file.css:10:1: Unexpected foo 2 [error] + expect(output).toBe( + ` +path/to/file.css:1:1: Unexpected foo [error] +path/to/file.css:10:1: Unexpected foo 2 [error] - 2 problems - `); +2 problems`.trimStart(), + ); }); it('outputs warnings without stdout `TTY`', () => { @@ -93,11 +93,12 @@ describe('unixFormatter', () => { const output = prepareFormatterOutput(results, unixFormatter); - expect(output).toBe(stripIndent` - path/to/file.css:1:1: Unexpected foo [error] + expect(output).toBe( + ` +path/to/file.css:1:1: Unexpected foo [error] - 1 problem - `); +1 problem`.trimStart(), + ); }); it('output warnings with more than 80 characters and `process.stdout.columns` equal 90 characters', () => { @@ -126,11 +127,12 @@ describe('unixFormatter', () => { const output = prepareFormatterOutput(results, unixFormatter); - expect(output).toBe(stripIndent` - path/to/file.css:1:1: Unexpected very very very very very very very very very very very very very long foo [error] + expect(output).toBe( + ` +path/to/file.css:1:1: Unexpected very very very very very very very very very very very very very long foo [error] - 1 problem - `); +1 problem`.trimStart(), + ); }); it('handles ignored file', () => { diff --git a/lib/formatters/__tests__/verboseFormatter.test.js b/lib/formatters/__tests__/verboseFormatter.test.js index 6a98b8c4b8..4d021cd032 100644 --- a/lib/formatters/__tests__/verboseFormatter.test.js +++ b/lib/formatters/__tests__/verboseFormatter.test.js @@ -1,7 +1,6 @@ 'use strict'; const prepareFormatterOutput = require('./prepareFormatterOutput'); -const stripIndent = require('common-tags').stripIndent; const verboseFormatter = require('../verboseFormatter'); describe('verboseFormatter', () => { @@ -18,12 +17,13 @@ describe('verboseFormatter', () => { const output = prepareFormatterOutput(results, verboseFormatter); - expect(output).toBe(stripIndent` - 1 source checked - path/to/file.css + expect(output).toBe( + ` +1 source checked + path/to/file.css - 0 problems found - `); +0 problems found`.trimStart(), + ); }); it("outputs one warnings (of severity 'error')", () => { @@ -47,17 +47,18 @@ describe('verboseFormatter', () => { const output = prepareFormatterOutput(results, verboseFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - 1:2 × Unexpected foo bar + expect(output).toBe( + ` +path/to/file.css + 1:2 × Unexpected foo bar - 1 source checked - path/to/file.css +1 source checked + path/to/file.css - 1 problem found - severity level "error": 1 - bar: 1 - `); +1 problem found + severity level "error": 1 + bar: 1`.trimStart(), + ); }); it('outputs 0 stdout column', () => { @@ -85,17 +86,18 @@ describe('verboseFormatter', () => { const output = prepareFormatterOutput(results, verboseFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - 1:2 × Unexpected foo bar + expect(output).toBe( + ` +path/to/file.css + 1:2 × Unexpected foo bar - 1 source checked - path/to/file.css +1 source checked + path/to/file.css - 1 problem found - severity level "error": 1 - bar: 1 - `); +1 problem found + severity level "error": 1 + bar: 1`.trimStart(), + ); process.stdout.columns = stdoutColumn; }); @@ -125,17 +127,18 @@ describe('verboseFormatter', () => { const output = prepareFormatterOutput(results, verboseFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - 1:2 × Unexpected foo bar + expect(output).toBe( + ` +path/to/file.css + 1:2 × Unexpected foo bar - 1 source checked - path/to/file.css +1 source checked + path/to/file.css - 1 problem found - severity level "error": 1 - bar: 1 - `); +1 problem found + severity level "error": 1 + bar: 1`.trimStart(), + ); process.stdout.columns = stdoutColumn; }); @@ -183,24 +186,25 @@ describe('verboseFormatter', () => { const output = prepareFormatterOutput(results, verboseFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - 1:2 × Unexpected foo bar - 2:3 × Unexpected foo bar - - file2.css - 3:1 ‼ Expected cat baz - - 2 sources checked - path/to/file.css - file2.css - - 3 problems found - severity level "error": 2 - bar: 2 - severity level "warning": 1 - baz: 1 - `); + expect(output).toBe( + ` +path/to/file.css + 1:2 × Unexpected foo bar + 2:3 × Unexpected foo bar + +file2.css + 3:1 ‼ Expected cat baz + +2 sources checked + path/to/file.css + file2.css + +3 problems found + severity level "error": 2 + bar: 2 + severity level "warning": 1 + baz: 1`.trimStart(), + ); }); it('outputs lineless syntax error', () => { @@ -222,17 +226,18 @@ describe('verboseFormatter', () => { const output = prepareFormatterOutput(results, verboseFormatter); - expect(output).toBe(stripIndent` - path/to/file.css - × Unexpected foo SyntaxError + expect(output).toBe( + ` +path/to/file.css + × Unexpected foo SyntaxError - 1 source checked - path/to/file.css +1 source checked + path/to/file.css - 1 problem found - severity level "error": 1 - SyntaxError: 1 - `); +1 problem found + severity level "error": 1 + SyntaxError: 1`.trimStart(), + ); }); it('outputs one ignored file', () => { @@ -248,11 +253,12 @@ describe('verboseFormatter', () => { const output = prepareFormatterOutput(results, verboseFormatter); - expect(output).toBe(stripIndent` - 0 of 1 source checked - file.css (ignored) + expect(output).toBe( + ` +0 of 1 source checked + file.css (ignored) - 0 problems found - `); +0 problems found`.trimStart(), + ); }); });