From f3e832b00c8e37542dc328a90fd413730925e675 Mon Sep 17 00:00:00 2001 From: Caleb-Irwin <56744087+Caleb-Irwin@users.noreply.github.com> Date: Wed, 30 Dec 2020 20:54:40 -0600 Subject: [PATCH 1/4] Added missing single quote in error message Without the extra quotation mark, you can not know if the first quotation mark is part of the problem or part of the error message. --- packages/parse/src/parser/column/QuotedColumnParser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/parse/src/parser/column/QuotedColumnParser.ts b/packages/parse/src/parser/column/QuotedColumnParser.ts index 2f5edbf0..23c3a6e6 100644 --- a/packages/parse/src/parser/column/QuotedColumnParser.ts +++ b/packages/parse/src/parser/column/QuotedColumnParser.ts @@ -98,7 +98,7 @@ export class QuotedColumnParser { // tldr: only part of the column was quoted const linePreview = scanner.lineFromCursor.substr(0, 10).replace(/[\r\n]/g, "\\n'"); throw new Error( - `Parse Error: expected: '${parserOptions.escapedDelimiter}' OR new line got: '${nextNonSpaceToken.token}'. at '${linePreview}`, + `Parse Error: expected: '${parserOptions.escapedDelimiter}' OR new line got: '${nextNonSpaceToken.token}'. at '${linePreview}'`, ); } scanner.advanceToToken(nextNonSpaceToken); From d7e4615cdb72d88c651c203b85c935543ce2e2e4 Mon Sep 17 00:00:00 2001 From: Caleb-Irwin <56744087+Caleb-Irwin@users.noreply.github.com> Date: Tue, 9 Feb 2021 19:57:00 -0600 Subject: [PATCH 2/4] Fixed Test Fixed Test for commit. --- packages/parse/__tests__/CsvParsingStream.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/parse/__tests__/CsvParsingStream.spec.ts b/packages/parse/__tests__/CsvParsingStream.spec.ts index edeecf99..06d9e6a8 100644 --- a/packages/parse/__tests__/CsvParsingStream.spec.ts +++ b/packages/parse/__tests__/CsvParsingStream.spec.ts @@ -479,7 +479,7 @@ describe('CsvParserStream', () => { return new Promise((res, rej) => { write(malformed); const stream = parseFile(malformed.path, { headers: true }); - expectErrorEvent(stream, "Parse Error: expected: ',' OR new line got: 'a'. at 'a \", Las", res, rej); + expectErrorEvent(stream, "Parse Error: expected: ',' OR new line got: 'a'. at 'a \'", Las", res, rej); }); }); From 876be5b83895a454b351d18b5efa450eb6b95f4b Mon Sep 17 00:00:00 2001 From: Caleb-Irwin <56744087+Caleb-Irwin@users.noreply.github.com> Date: Tue, 9 Feb 2021 20:15:20 -0600 Subject: [PATCH 3/4] Fixed Tests --- packages/parse/__tests__/CsvParsingStream.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/parse/__tests__/CsvParsingStream.spec.ts b/packages/parse/__tests__/CsvParsingStream.spec.ts index 06d9e6a8..c86ca80c 100644 --- a/packages/parse/__tests__/CsvParsingStream.spec.ts +++ b/packages/parse/__tests__/CsvParsingStream.spec.ts @@ -479,7 +479,7 @@ describe('CsvParserStream', () => { return new Promise((res, rej) => { write(malformed); const stream = parseFile(malformed.path, { headers: true }); - expectErrorEvent(stream, "Parse Error: expected: ',' OR new line got: 'a'. at 'a \'", Las", res, rej); + expectErrorEvent(stream, "Parse Error: expected: ',' OR new line got: 'a'. at 'a '\", Las", res, rej); }); }); From e975cf63578345ecd39771eb90d04a9190f972dc Mon Sep 17 00:00:00 2001 From: Caleb-Irwin <56744087+Caleb-Irwin@users.noreply.github.com> Date: Tue, 9 Feb 2021 20:33:14 -0600 Subject: [PATCH 4/4] Actually Fixed Test Third times the charm? --- packages/parse/__tests__/CsvParsingStream.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/parse/__tests__/CsvParsingStream.spec.ts b/packages/parse/__tests__/CsvParsingStream.spec.ts index c86ca80c..9f02e0a4 100644 --- a/packages/parse/__tests__/CsvParsingStream.spec.ts +++ b/packages/parse/__tests__/CsvParsingStream.spec.ts @@ -479,7 +479,7 @@ describe('CsvParserStream', () => { return new Promise((res, rej) => { write(malformed); const stream = parseFile(malformed.path, { headers: true }); - expectErrorEvent(stream, "Parse Error: expected: ',' OR new line got: 'a'. at 'a '\", Las", res, rej); + expectErrorEvent(stream, "Parse Error: expected: ',' OR new line got: 'a'. at 'a \", Las'", res, rej); }); });