From f2141b1272542cb9eb6c0118224143319ca5dcb6 Mon Sep 17 00:00:00 2001 From: Jason Cheatham Date: Fri, 10 Nov 2017 10:31:18 -0500 Subject: [PATCH] Ignore existing report dir in JUnit reporter fixes #837 --- docs/api.json | 30 +++++++++++++++--------------- src/lib/reporters/JUnit.ts | 8 +++++++- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/docs/api.json b/docs/api.json index 7261253a0..094870572 100644 --- a/docs/api.json +++ b/docs/api.json @@ -84835,7 +84835,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 29, + "line": 35, "character": 7 } ] @@ -84988,7 +84988,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 55, + "line": 61, "character": 17 } ] @@ -85005,7 +85005,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 55, + "line": 61, "character": 11 } ], @@ -85026,7 +85026,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 54, + "line": 60, "character": 11 } ], @@ -85051,7 +85051,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 53, + "line": 59, "character": 9 } ], @@ -85103,7 +85103,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 81, + "line": 87, "character": 8 } ] @@ -85135,7 +85135,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 88, + "line": 94, "character": 21 } ] @@ -85167,7 +85167,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 101, + "line": 107, "character": 18 } ] @@ -85238,7 +85238,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 75, + "line": 81, "character": 11 } ] @@ -85274,7 +85274,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 119, + "line": 125, "character": 9 } ] @@ -85312,7 +85312,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 52, + "line": 58, "character": 13 } ] @@ -85369,7 +85369,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 43, + "line": 49, "character": 9 } ], @@ -85430,7 +85430,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 42, + "line": 48, "character": 32 } ], @@ -85500,7 +85500,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 133, + "line": 139, "character": 24 } ] @@ -85573,7 +85573,7 @@ "sources": [ { "fileName": "lib/reporters/JUnit.ts", - "line": 144, + "line": 150, "character": 23 } ] diff --git a/src/lib/reporters/JUnit.ts b/src/lib/reporters/JUnit.ts index 8af824b8e..3a00e08d2 100644 --- a/src/lib/reporters/JUnit.ts +++ b/src/lib/reporters/JUnit.ts @@ -19,7 +19,13 @@ export default class JUnit extends Reporter { if (options.filename) { this.filename = options.filename; if (dirname(this.filename) !== '.') { - mkdirSync(dirname(this.filename)); + try { + mkdirSync(dirname(this.filename)); + } catch (error) { + if (error.code !== 'EEXIST') { + throw error; + } + } } this.output = createWriteStream(this.filename); }