Skip to content

Commit

Permalink
don't add a dep. use require() directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Grimes committed Mar 16, 2017
1 parent 89fb4a1 commit f9eae49
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
30 changes: 14 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
'use strict';

const readPkg = require('read-pkg').sync;

const pkg = {};
try {
const config = (readPkg(process.cwd()) || {})['jest-junit'];
if (config) {
Object.assign(pgk, config);
}
} catch (e) {
//don't blowup if there was an error...just skip
}

const xml = require('xml');
const mkdirp = require('mkdirp');
const fs = require('fs');
Expand All @@ -21,11 +9,21 @@ const path = require('path');
const CLASSNAME_VAR = '{classname}';
const TITLE_VAR = '{title}';

const SUITE_NAME = process.env.JEST_SUITE_NAME || pkg.suiteName || 'jest tests';
const OUTPUT_PATH = process.env.JEST_JUNIT_OUTPUT || pkg.output ||
const cfg = {};
try {
const config = (require(path.join(process.cwd(), 'package.json')) || {})['jest-junit'];
if (config) {
Object.assign(pgk, config);
}
} catch (e) {
//don't blowup if there was an error...just skip
}

const SUITE_NAME = process.env.JEST_SUITE_NAME || cfg.suiteName || 'jest tests';
const OUTPUT_PATH = process.env.JEST_JUNIT_OUTPUT || cfg.output ||
path.join(process.cwd(), './junit.xml');
const CLASSNAME_TEMPLATE = process.env.JEST_JUNIT_CLASSNAME || pkg.classNameTemplate || '{classname} {title}';
const TITLE_TEMPLATE = process.env.JEST_JUNIT_TITLE || pkg.titleTemplate || '{classname} {title}';
const CLASSNAME_TEMPLATE = process.env.JEST_JUNIT_CLASSNAME || cfg.classNameTemplate || '{classname} {title}';
const TITLE_TEMPLATE = process.env.JEST_JUNIT_TITLE || cfg.titleTemplate || '{classname} {title}';

const replaceVars = function (str, classname, title) {
return str
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
],
"dependencies": {
"mkdirp": "^0.5.1",
"read-pkg": "^2.0.0",
"xml": "^1.0.1"
}
}

0 comments on commit f9eae49

Please sign in to comment.