Socket
Socket
Sign inDemoInstall

jest-teamcity

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-teamcity - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

4

__tests__/data.json
[
{
"testFilePath": "/Users/test/foo/__tests__/file.js",
"testResults": [

@@ -9,2 +10,3 @@ { "ancestorTitles": ["path", "to", "test1"], "title": "title1", "status": "failed", "duration": 123 },

{
"testFilePath": "/Users/test/foo/__tests__/file2.js",
"testResults": [

@@ -15,2 +17,2 @@ { "ancestorTitles": ["path2", "to", "test3"], "title": "title3", "status": "passed", "duration": 123 },

}
]
]

@@ -5,3 +5,5 @@ 'use strict';

const testData = require('./data');
const consoleOutput = [["##teamcity[testSuiteStarted name=\'path\']"],
const consoleOutput = [
["##teamcity[testSuiteStarted name=\'foo/__tests__/file.js\']"],
["##teamcity[testSuiteStarted name=\'path\']"],
["##teamcity[testSuiteStarted name=\'to\']"],

@@ -20,2 +22,4 @@ ["##teamcity[testSuiteStarted name=\'test1\']"],

["##teamcity[testSuiteFinished name=\'path\']"],
["##teamcity[testSuiteFinished name=\'foo/__tests__/file.js\']"],
["##teamcity[testSuiteStarted name=\'foo/__tests__/file2.js\']"],
["##teamcity[testSuiteStarted name=\'path2\']"],

@@ -33,3 +37,5 @@ ["##teamcity[testSuiteStarted name=\'to\']"],

["##teamcity[testSuiteFinished name=\'to\']"],
["##teamcity[testSuiteFinished name=\'path2\']"]];
["##teamcity[testSuiteFinished name=\'path2\']"],
["##teamcity[testSuiteFinished name=\'foo/__tests__/file2.js\']"]
];

@@ -74,3 +80,3 @@ describe('jest-teamcity', () => {

test('with data', () => {
formatter.printTestLog(formatter.collectSuites(testData));
formatter.printTestLog(formatter.collectSuites(testData, '/Users/test'));
expect(console.log.mock.calls).toEqual(consoleOutput);

@@ -91,20 +97,24 @@ });

expect(formatter.collectSuites('')).toEqual({});
expect(formatter.collectSuites([])).toEqual({});
expect(formatter.collectSuites([], '/')).toEqual({});
});
test('with result', () => {
expect(formatter.collectSuites(testData)).toEqual(expect.objectContaining({
path: expect.objectContaining({
to: expect.objectContaining({
test1: expect.any(Object),
test2: expect.any(Object),
})
}),
path2: expect.objectContaining({
to: expect.objectContaining({
test3: expect.any(Object),
test4: expect.any(Object),
})
})
}));
expect(formatter.collectSuites(testData, '/Users/test')).toEqual({
'foo/__tests__/file.js': {
path: expect.objectContaining({
to: expect.objectContaining({
test1: expect.any(Object),
test2: expect.any(Object),
})
}),
},
'foo/__tests__/file2.js': {
path2: expect.objectContaining({
to: expect.objectContaining({
test3: expect.any(Object),
test4: expect.any(Object),
})
})
}
});
});

@@ -114,6 +124,6 @@ });

test('formatReport', () => {
formatter.formatReport(testData);
formatter.formatReport(testData, '/Users/test/');
expect(console.log.mock.calls).toEqual(consoleOutput);
});
});
});
});
'use strict';
const consoleOutput = [["##teamcity[testSuiteStarted name=\'path\']"],
const consoleOutput = [
["##teamcity[testSuiteStarted name=\'foo/__tests__/file.js\']"],
["##teamcity[testSuiteStarted name=\'path\']"],
["##teamcity[testSuiteStarted name=\'to\']"],

@@ -17,2 +19,4 @@ ["##teamcity[testSuiteStarted name=\'test1\']"],

["##teamcity[testSuiteFinished name=\'path\']"],
["##teamcity[testSuiteFinished name=\'foo/__tests__/file.js\']"],
["##teamcity[testSuiteStarted name=\'foo/__tests__/file2.js\']"],
["##teamcity[testSuiteStarted name=\'path2\']"],

@@ -30,3 +34,5 @@ ["##teamcity[testSuiteStarted name=\'to\']"],

["##teamcity[testSuiteFinished name=\'to\']"],
["##teamcity[testSuiteFinished name=\'path2\']"]];
["##teamcity[testSuiteFinished name=\'path2\']"],
["##teamcity[testSuiteFinished name=\'foo/__tests__/file2.js\']"]
];
const testData = require('./data');

@@ -51,4 +57,7 @@ const reporter = require('../lib/index');

process.env.TEAMCITY_VERSION = '0.0.0';
const originalCwd = process.cwd();
process.cwd = function () { return '/Users/test'; };
reporter({ testResults: testData });
expect(console.log.mock.calls).toEqual(consoleOutput);
process.cwd = originalCwd;
});

@@ -62,2 +71,2 @@

});
});
});
#CHANGELOG
## 1.2.0 - 2017-05-18
### Added
- Included filename into suite hierarchy
## 1.1.0 - 2017-05-04

@@ -17,2 +21,2 @@ ### Added

- Formatter module
- Use `--teamcity` params to enable reporter
- Use `--teamcity` params to enable reporter
'use strict';
const _ = require('lodash');
const path = require('path');

@@ -84,12 +85,15 @@ module.exports = {

*/
collectSuites(testResults) {
collectSuites(testResults, cwd) {
if (!testResults) {
return {};
}
if (!cwd) {
throw new Error('cwd not specified');
}
const suites = {};
testResults.forEach((testFile) => {
const filename = path.relative(cwd, testFile.testFilePath);
testFile.testResults.forEach((test) => {
const path = test.ancestorTitles.join('.') + '._tests_';
const path = [ filename ].concat(test.ancestorTitles).concat('_tests_');
if (!_.has(suites, path )) {

@@ -99,3 +103,2 @@ _.set(suites, path, []);

const testsList = _.get(suites, path);

@@ -115,6 +118,6 @@ testsList.push(test);

*/
formatReport(testResults) {
const suites = this.collectSuites(testResults);
formatReport(testResults, cwd) {
const suites = this.collectSuites(testResults, cwd);
this.printTestLog(suites);
}
};

@@ -14,3 +14,3 @@ /**

return formatter.formatReport(result.testResults);
return formatter.formatReport(result.testResults, process.cwd());
};
{
"name": "jest-teamcity",
"version": "1.1.0",
"version": "1.2.0",
"description": "Teamcity Reporter for Jest Testing framework",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/itereshchenkov/jest-teamcity",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc