karma-sonarqube-reporter
Advanced tools
Comparing version 1.0.3 to 1.0.4
23
index.js
@@ -26,2 +26,5 @@ var fs = require('fs'); | ||
var paths = pathfinder.parseTestFiles( | ||
pattern, encoding); | ||
var reports = {}; | ||
@@ -35,3 +38,3 @@ | ||
if (result.success) { | ||
this.specSuccess(browser, result); | ||
this.specSuccess(browser, result); | ||
} | ||
@@ -48,3 +51,4 @@ else if (result.skipped) { | ||
var report = browserReport(reports, browser); | ||
var path = pathfinder.testFilePath(pattern, encoding, result); | ||
var path = pathfinder.testFile(paths, | ||
result.suite[0], result.description); | ||
reportFile(report, path).testCase.push( | ||
@@ -56,3 +60,4 @@ reportbuilder.createReportTestCaseSuccess(result)); | ||
var report = browserReport(reports, browser); | ||
var path = pathfinder.testFilePath(pattern, encoding, result); | ||
var path = pathfinder.testFile(paths, | ||
result.suite[0], result.description); | ||
reportFile(report, path).testCase.push( | ||
@@ -64,3 +69,4 @@ reportbuilder.createReportTestCaseSkipped(result)); | ||
var report = browserReport(reports, browser); | ||
var path = pathfinder.testFilePath(pattern, encoding, result); | ||
var path = pathfinder.testFile(paths, | ||
result.suite[0], result.description); | ||
reportFile(report, path).testCase.push( | ||
@@ -89,3 +95,3 @@ reportbuilder.createReportTestCaseFailure(result, | ||
var reportFile = report.file.find((currentFile) => { | ||
return currentFile['@'].path == path | ||
return currentFile['@'].path == path | ||
}); | ||
@@ -115,5 +121,3 @@ if (reportFile == undefined) { | ||
mkdirp.sync(outputFolder, (error) => { | ||
if (error) { | ||
throw error | ||
} | ||
if (error) throw error; | ||
}); | ||
@@ -127,3 +131,4 @@ } | ||
function formatReportFileName(reportFileName) { | ||
return reportFileName.replace(/\s/g, '.').replace(/\(|\)/g,'').toLowerCase() + '.xml'; | ||
return reportFileName.replace(/\s/g, '.').replace(/\(|\)/g,'') | ||
.toLowerCase() + '.xml'; | ||
} | ||
@@ -130,0 +135,0 @@ |
var fs = require('fs'); | ||
var glob = require('glob'); | ||
var cloneRegexp = require('clone-regexp'); | ||
function testFilePath(pattern, encoding, result) { | ||
var filePath = glob.sync(pattern).find((path, index, array) => { | ||
return testFileMatch(testFileData(path, encoding), result); | ||
function parseTestFiles(pattern, encoding) { | ||
var paths = {}; | ||
glob.sync(pattern).find((path, index, array) => { | ||
parseTestFile(paths, path, testFileData(path, encoding)); | ||
}); | ||
if (filePath == undefined) { | ||
throw new Error("Test file not found!"); | ||
} | ||
return filePath; | ||
return paths; | ||
} | ||
function testFileData(path, encoding) { | ||
@@ -19,14 +16,2 @@ return removeNewLines(removeComments(fs.readFileSync(path, encoding))); | ||
function testFileMatch(data, result) { | ||
return matchDescribe(data, result) && matchIt(data, result); | ||
} | ||
function matchDescribe(data, result) { | ||
return recursiveMatch(data, describePattern(), describeText(result), 0); | ||
} | ||
function matchIt(data, result) { | ||
return recursiveMatch(data, itPattern(), itText(result), 0); | ||
} | ||
function removeComments(data) { | ||
@@ -40,46 +25,54 @@ return data.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, ''); | ||
function removeSpecialCharacters(data) { | ||
return data.replace(/\W/g, ''); | ||
function parseTestFile(paths, path, data) { | ||
var regex = regexPattern(); | ||
while ((result = regex.exec(data)) != null) { | ||
var type = result[2] || result[3]; | ||
var text = result[5]; | ||
if (paths[path] == undefined) { | ||
paths[path] = { describe: [], it: [] }; | ||
}; | ||
if (type == 'describe') { | ||
paths[path].describe.push(text); | ||
} | ||
if (type == 'it') { | ||
paths[path].it.push(text); | ||
} | ||
} | ||
} | ||
function describePattern() { | ||
return new RegExp('describe\\s*\\(\\s*(?:\`|\'|\")', 'gi'); | ||
} | ||
function regexPattern() { | ||
return new RegExp('((describe)|(it))\\s*\\(\\s*(\`|\'|\")(.*?)\\4,', 'gi'); | ||
} | ||
function itPattern() { | ||
return new RegExp('it\\s*\\(\\s*(?:\`|\'|\")' , 'gi'); | ||
function testFile(paths, describe, it) { | ||
var testFile = Object.keys(paths).find(path => | ||
exist(paths, path, describe, it)); | ||
if (testFile == undefined) { | ||
throw new Error('Test file path not found!'); | ||
} | ||
return testFile; | ||
} | ||
function describeText(result) { | ||
return result.suite [0]; | ||
function exist(paths, path, describe, it) { | ||
return existDescribe(paths, path, describe) && | ||
existIt(paths, path, it); | ||
} | ||
function itText(result) { | ||
return result.description; | ||
function existDescribe(paths, path, describe) { | ||
return (paths[path].describe.includes(describe) || | ||
paths[path].describe.includes(escapeQuotes(describe))); | ||
} | ||
function recursiveMatch(data, regex, text, index) { | ||
if (index >= data.length) { | ||
return false; | ||
} | ||
var slicedData = data.slice(index); | ||
var indexOf = slicedData.search(regex); | ||
if (indexOf === -1) { | ||
return false; | ||
} | ||
var regexMatch = cloneRegexp(regex).exec(slicedData); | ||
if (match(slicedData, text, indexOf + regexMatch[0].length)) { | ||
return true; | ||
} | ||
return recursiveMatch(slicedData, regex, text, | ||
indexOf + regexMatch[0].length); | ||
function existIt(paths, path, it) { | ||
return (paths[path].it.includes(it) || | ||
paths[path].it.includes(escapeQuotes(it))); | ||
} | ||
function match(data, text, index) { | ||
return removeSpecialCharacters(data.substr(index, text.length+1)) === | ||
removeSpecialCharacters(text); | ||
function escapeQuotes(str) { | ||
return str.replace(/\\([\s\S])|("|')/g,"\\$1$2"); | ||
} | ||
module.exports = { | ||
testFilePath: testFilePath | ||
}; | ||
parseTestFiles: parseTestFiles, | ||
testFile: testFile | ||
}; |
{ | ||
"name": "karma-sonarqube-reporter", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A karma reporter plugin for generating Sonarqube generic test reports", | ||
@@ -24,6 +24,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"clone-regexp": "^1.0.1", | ||
"glob": "^7.1.2", | ||
"js2xmlparser": "^3.0.0", | ||
"mkdirp": "^0.5.1", | ||
"clone-regexp": "^1.0.1" | ||
"mkdirp": "^0.5.1" | ||
}, | ||
@@ -35,4 +35,5 @@ "devDependencies": { | ||
"mock-require": "^3.0.2", | ||
"nyc": "^11.6.0" | ||
"nyc": "^11.6.0", | ||
"lodash": "^4.17.10" | ||
} | ||
} |
@@ -40,3 +40,3 @@ # karma-sonarqube-reporter | ||
Click [here][3] to see full `karma.conf.js` example | ||
Click [here][3] to see a full example. | ||
@@ -43,0 +43,0 @@ |
var fs = require('fs'); | ||
var path = require('path'); | ||
var mock = require('mock-require'); | ||
@@ -15,75 +17,142 @@ | ||
var reporter; | ||
beforeAll(function() { | ||
mock('../lib/path-finder', { | ||
testFilePath: function(pattern, encoding, result) { | ||
return 'test/file/path'; | ||
beforeAll(function() { | ||
mock('../lib/path-finder', { | ||
parseTestFiles: function(pattern, encoding) { | ||
return { | ||
's1': { 'd1': 'test/file1/path' }, | ||
's2': { 'd2': 'test/file2/path' }, | ||
's3': { 'd3': 'test/file3/path' } | ||
} | ||
}, | ||
testFile: function(paths, describe, it) { | ||
if (describe == 's1' && it == 'd1') { | ||
testFilePath = 'test/file1/path'; | ||
} | ||
if (describe == 's2' && it == 'd2') { | ||
testFilePath = 'test/file1/path'; | ||
} | ||
if (describe == 's3' && it == 'd3') { | ||
testFilePath = 'test/file3/path'; | ||
} | ||
return testFilePath; | ||
} | ||
}); | ||
}); | ||
beforeEach(function() { | ||
sonarqubeReporter = mock.reRequire('../index')['reporter:sonarqube'][1]; | ||
baseReporterDecorator = jasmine.createSpy('baseReporterDecorator'); | ||
helper = jasmine.createSpy('helper'); | ||
logger = jasmine.createSpy('logger'); | ||
formatError = jasmine.createSpy('formatError'); | ||
reporter = new sonarqubeReporter(baseReporterDecorator, config, | ||
helper, logger, formatError); | ||
reporter = new sonarqubeReporter( | ||
baseReporterDecorator, | ||
config, helper, logger, | ||
formatError); | ||
spyOn(reporter, "specSuccess").and.callThrough(); | ||
spyOn(reporter, "specSkipped").and.callThrough(); | ||
spyOn(reporter, "specFailure").and.callThrough(); | ||
}); | ||
afterAll(function() { | ||
mock.stop('../lib/path-finder'); | ||
}); | ||
it('Sonarqube reporter is defined', function() { | ||
expect(reporter).toBeDefined(); | ||
}); | ||
it('Report with single test case success', function() { | ||
reporter.onSpecComplete({name: 'firefox'}, { success: true, suite: ['s1'], | ||
result: { description: 'd1', time: '1'}}); | ||
expect(reporter.specSuccess).toHaveBeenCalled(); | ||
reporter.onRunComplete({}, {}); | ||
expect(reportFileCreated('firefox')).toBe(true); | ||
describe('Single browsers', function() { | ||
it('Report test case success (firefox)', function() { | ||
reporter.onSpecComplete({name: 'firefox'}, { success: true, suite: ['s1'], | ||
description: 'd1', time: '1'}); | ||
reporter.onSpecComplete({name: 'firefox'}, { success: true, suite: ['s2'], | ||
description: 'd2', time: '1'}); | ||
reporter.onSpecComplete({name: 'firefox'}, { success: true, suite: ['s3'], | ||
description: 'd3', time: '1'}); | ||
// TODO: assert specSuccess arguments | ||
expect(reporter.specSuccess.calls.count()).toEqual(3); | ||
reporter.onRunComplete({}, {}); | ||
// TODO: assert report file content | ||
expect(reportFileCreated('firefox.xml')).toBe(true); | ||
}); | ||
it('Report test case skipped (chrome)', function() { | ||
reporter.onSpecComplete({name: 'chrome'}, { skipped: true, suite: ['s1'], | ||
description: 'd1', time: '2'}); | ||
reporter.onSpecComplete({name: 'chrome'}, { skipped: true, suite: ['s2'], | ||
description: 'd2', time: '2'}); | ||
reporter.onSpecComplete({name: 'chrome'}, { skipped: true, suite: ['s3'], | ||
description: 'd3', time: '2'}); | ||
// TODO: assert specSkipped arguments | ||
expect(reporter.specSkipped.calls.count()).toEqual(3); | ||
reporter.onRunComplete({}, {}); | ||
// TODO: assert report file content | ||
expect(reportFileCreated('chrome.xml')).toBe(true); | ||
}); | ||
it('Report rest case failure (ie)', function() { | ||
reporter.onSpecComplete({name: 'ie'}, { suite: ['s1'], | ||
description: 'd1', time: '3', log: ['e1']}); | ||
reporter.onSpecComplete({name: 'ie'}, { suite: ['s2'], | ||
description: 'd2', time: '3', log: ['e2']}); | ||
reporter.onSpecComplete({name: 'ie'}, { suite: ['s3'], | ||
description: 'd3', time: '3', log: ['e3']}); | ||
// TODO: assert specFailure arguments | ||
expect(reporter.specFailure).toHaveBeenCalled(); | ||
reporter.onRunComplete({}, {}); | ||
// TODO: assert report file content | ||
expect(reportFileCreated('ie.xml')).toBe(true); | ||
}); | ||
}); | ||
it('Report with single test case skipped', function() { | ||
reporter.onSpecComplete({name: 'chrome'}, { skipped: true, suite: ['s2'], | ||
result: { description: 'd2', time: '2'}}); | ||
expect(reporter.specSkipped).toHaveBeenCalled(); | ||
reporter.onRunComplete({}, {}); | ||
expect(reportFileCreated('chrome')).toBe(true); | ||
describe('Multiple browsers (firefox, chrome, ie)', function() { | ||
it('Report test case success', function() { | ||
reporter.onSpecComplete({name: 'firefox'}, { success: true, suite: ['s1'], | ||
description: 'd1', time: '1'}); | ||
reporter.onSpecComplete({name: 'chrome'}, { success: true, suite: ['s1'], | ||
description: 'd1', time: '1'}); | ||
reporter.onSpecComplete({name: 'ie'}, { success: true, suite: ['s1'], | ||
description: 'd1', time: '1'}); | ||
// TODO: assert specSuccess arguments | ||
expect(reporter.specSuccess.calls.count()).toEqual(3); | ||
reporter.onRunComplete({}, {}); | ||
// TODO: assert report file content | ||
expect(reportFileCreated('firefox.xml')).toBe(true); | ||
expect(reportFileCreated('chrome.xml')).toBe(true); | ||
expect(reportFileCreated('ie.xml')).toBe(true); | ||
}); | ||
it('Report test case skipped', function() { | ||
reporter.onSpecComplete({name: 'firefox'}, { skipped: true, suite: ['s2'], | ||
description: 'd2', time: '2'}); | ||
reporter.onSpecComplete({name: 'chrome'}, { skipped: true, suite: ['s2'], | ||
description: 'd2', time: '2'}); | ||
reporter.onSpecComplete({name: 'ie'}, { skipped: true, suite: ['s2'], | ||
description: 'd2', time: '2'}); | ||
// TODO: assert specSkipped arguments | ||
expect(reporter.specSkipped.calls.count()).toEqual(3); | ||
reporter.onRunComplete({}, {}); | ||
// TODO: assert report file content | ||
expect(reportFileCreated('firefox.xml')).toBe(true); | ||
expect(reportFileCreated('chrome.xml')).toBe(true); | ||
expect(reportFileCreated('ie.xml')).toBe(true); | ||
}); | ||
it('Report rest case failure', function() { | ||
reporter.onSpecComplete({name: 'firefox'}, { suite: ['s3'], | ||
description: 'd3', time: '3', log: ['e3']}); | ||
reporter.onSpecComplete({name: 'chrome'}, { suite: ['s3'], | ||
description: 'd3', time: '3', log: ['e3']}); | ||
reporter.onSpecComplete({name: 'ie'}, { suite: ['s3'], | ||
description: 'd3', time: '3', log: ['e3.1', 'e3.2']}); | ||
// TODO: assert specFailure arguments | ||
expect(reporter.specFailure.calls.count()).toEqual(3); | ||
reporter.onRunComplete({}, {}); | ||
// TODO: assert report file content | ||
expect(reportFileCreated('firefox.xml')).toBe(true); | ||
expect(reportFileCreated('chrome.xml')).toBe(true); | ||
expect(reportFileCreated('ie.xml')).toBe(true); | ||
}); | ||
}); | ||
it('Report with single rest case failure', function() { | ||
reporter.onSpecComplete({name: 'ie'}, { suite: ['s3'], | ||
result: { description: 'd3', time: '3'}, log: ['e3']}); | ||
expect(reporter.specFailure).toHaveBeenCalled(); | ||
reporter.onRunComplete({}, {}); | ||
expect(reportFileCreated('ie')).toBe(true); | ||
}); | ||
function reportFileCreated(browserName) { | ||
return fs.existsSync(config.sonarqubeReporter.outputFolder+'/'+browserName+'.xml'); | ||
return fs.existsSync(filePath(browserName)); | ||
} | ||
}); | ||
function filePath(file) { | ||
return path.join(configFolder(), file); | ||
} | ||
function configFolder() { | ||
return config.sonarqubeReporter.outputFolder; | ||
} | ||
}); |
@@ -0,28 +1,43 @@ | ||
var lodash = require('lodash'); | ||
var mock = require('mock-require'); | ||
var testData = { | ||
'path/t1.spec.js':'describe("s1", function() { it("d1", function() {}); });', | ||
'path/t2.spec.js':'describe("s2", function() { it("d2", function() {}); });', | ||
'path/t3.spec.js':'describe("s3", function() { it("d3", function() {}); });' | ||
const testFileData = { | ||
'path/t1.spec.js':'describe(\'s1\', function() { it(\'d1\', function() {}); });', | ||
'path/t2.spec.js':'describe(\'s2\', function() { it(\'d2\', function() {}); });', | ||
'path/t3.spec.js':'describe(\'s3\', function() { ' + | ||
'it(\'d3.1\', function() {}); }); it(\'d3.2\', function() {}); });', | ||
'path/t4.spec.js':'describe(\'\\\'s4\\\'\', function() { it(\'\\\'d4\\\'\', function() {}); });', | ||
'path/t5.spec.js':'describe(\'\\\"s5\\\"\', function() { it(\'\\\"d5\\\"\', function() {}); });', | ||
'path/t6.spec.js':'describe(\'s6\', function() { it(\'d6.1\', function() {}); });' + | ||
'describe(\'s6.2\', function() { it(\'d6.2\', function() {}); });' + | ||
'describe(\'s6.3\', function() { it(\'d6.3\', function() {}); });' + | ||
'describe(\'s6.4\', function() { describe(\'s6.4.1\', function() { ' + | ||
'it(\'d6.4.1\', function() {}); }); });' | ||
} | ||
const parsedTestFiles = { | ||
'path/t1.spec.js': { describe: ['s1'], it: ['d1']}, | ||
'path/t2.spec.js': { describe: ['s2'], it: ['d2']}, | ||
'path/t3.spec.js': { describe: ['s3'], it: ['d3.1', 'd3.2']}, | ||
'path/t4.spec.js': { describe: ['\\\'s4\\\''], it: ['\\\'d4\\\'']}, | ||
'path/t5.spec.js': { describe: ['\\\"s5\\\"'], it: ['\\\"d5\\\"']}, | ||
'path/t6.spec.js': { describe: ['s6', 's6.2', 's6.3', 's6.4', 's6.4.1'], | ||
it: ['d6.1', 'd6.2', 'd6.3', 'd6.4.1']} | ||
} | ||
describe('Path finder tests', function() { | ||
var pathFinder; | ||
beforeAll(function() { | ||
mock('glob', { | ||
sync: function(pattern) { | ||
return Object.keys(testData); | ||
return Object.keys(testFileData); | ||
} | ||
}); | ||
mock('fs', { | ||
readFileSync: function(path, encoding) { | ||
return testData[path]; | ||
return testFileData[path]; | ||
} | ||
}); | ||
pathFinder = mock.reRequire('../../lib/path-finder'); | ||
}); | ||
afterAll(function() { | ||
@@ -32,22 +47,100 @@ mock.stop('glob'); | ||
}); | ||
it('1st test file match suite s1 and description d1', function() { | ||
expect(pathFinder.testFilePath('**/*.spec.ts', 'utf-8', | ||
{ suite: ['s1'], description: 'd1'})).toBe('path/t1.spec.js'); | ||
describe('Parsing test files', function() { | ||
describe('Test files with single test cases', function() { | ||
it('Parsed test paths matched expected test paths', function() { | ||
expect(lodash.isEqual(pathFinder.parseTestFiles( | ||
'**/*.spec.ts', 'utf-8'), parsedTestFiles)).toBe(true); | ||
}); | ||
it('1st test file match suite 1 and description 1', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t1.spec.js']; | ||
expect(path.describe[0]).toBe('s1'); | ||
expect(path.it[0]).toBe('d1'); | ||
}); | ||
it('2sd test file match suite 2 and description 2', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t2.spec.js']; | ||
expect(path.describe[0]).toBe('s2'); | ||
expect(path.it[0]).toBe('d2'); | ||
}); | ||
it('3rd test file match suite 3 and description 3.1 and 3.2', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t3.spec.js']; | ||
expect(path.describe[0]).toBe('s3'); | ||
expect(path.it[0]).toBe('d3.1'); | ||
expect(path.it[1]).toBe('d3.2'); | ||
}); | ||
describe('Test cases with quoted text', function() { | ||
it('4rd test file match suite and description with single quotes', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t4.spec.js']; | ||
expect(path.describe[0]).toBe('\\\'s4\\\''); | ||
expect(path.it[0]).toBe('\\\'d4\\\''); | ||
}); | ||
it('5th test file match suite and description with double quotes', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t5.spec.js']; | ||
expect(path.describe[0]).toBe('\\\"s5\\\"'); | ||
expect(path.it[0]).toBe('\\\"d5\\\"'); | ||
}); | ||
}); | ||
}); | ||
describe('Test files with multiple test cases', function() { | ||
it('6th test file match suite 6 and description 6.1', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t6.spec.js']; | ||
expect(path.describe[0]).toBe('s6'); | ||
expect(path.it[0]).toBe('d6.1'); | ||
}); | ||
it('6th test file match suite 6.2 and description 6.2 (sibling)', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t6.spec.js']; | ||
expect(path.describe[1]).toBe('s6.2'); | ||
expect(path.it[1]).toBe('d6.2'); | ||
}); | ||
it('6th test file match suite 6.3 and description 6.3 (sibling)', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t6.spec.js']; | ||
expect(path.describe[2]).toBe('s6.3'); | ||
expect(path.it[2]).toBe('d6.3'); | ||
}); | ||
it('6th test file match suite 6.4.1 and description 6.4.1 (nested)', function() { | ||
var paths = pathFinder.parseTestFiles('**/*.spec.ts', 'utf-8'); | ||
var path = paths['path/t6.spec.js']; | ||
expect(path.describe[4]).toBe('s6.4.1'); | ||
expect(path.it[3]).toBe('d6.4.1'); | ||
}); | ||
}); | ||
}); | ||
it('2sd test file match suite s2 and description d2', function() { | ||
expect(pathFinder.testFilePath('**/*.spec.ts', 'utf-8', | ||
{ suite: ['s2'], description: 'd2'})).toBe('path/t2.spec.js'); | ||
describe('Find test file path tests', function() { | ||
it('Test file path not found', function() { | ||
expect(function() { | ||
pathFinder.testFile(parsedTestFiles, 's7', 'd7')}) | ||
.toThrow(new Error('Test file path not found!')); | ||
}); | ||
it('Suite 1 and description 1 found in test file 1', function() { | ||
expect(pathFinder.testFile(parsedTestFiles, 's1', 'd1')) | ||
.toBe('path/t1.spec.js'); | ||
}); | ||
it('Suite 2 and description 2 found in test file 2', function() { | ||
expect(pathFinder.testFile(parsedTestFiles, 's2', 'd2')) | ||
.toBe('path/t2.spec.js'); | ||
}); | ||
it('Suite 3 and description 3 found in test file 3.1', function() { | ||
expect(pathFinder.testFile(parsedTestFiles, 's3', 'd3.1')) | ||
.toBe('path/t3.spec.js'); | ||
}); | ||
it('Suite 3 and description 3 found in test file 3.2', function() { | ||
expect(pathFinder.testFile(parsedTestFiles, 's3', 'd3.2')) | ||
.toBe('path/t3.spec.js'); | ||
}); | ||
it('Suite 4 and description 4 found in test file 4', function() { | ||
expect(pathFinder.testFile(parsedTestFiles, '\\\'s4\\\'', '\\\'d4\\\'')) | ||
.toBe('path/t4.spec.js'); | ||
}); | ||
it('Suite 5 and description 5 found in test file 4', function() { | ||
expect(pathFinder.testFile(parsedTestFiles, '\\\"s5\\\"', '\\\"d5\\\"')) | ||
.toBe('path/t5.spec.js'); | ||
}); | ||
}); | ||
it('3rd test file match suite s3 and description d3', function() { | ||
expect(pathFinder.testFilePath('**/*.spec.ts', 'utf-8', | ||
{ suite: ['s3'], description: 'd3'})).toBe('path/t3.spec.js'); | ||
}); | ||
it('Test file not found', function() { | ||
expect(function() { pathFinder.testFilePath('**/*.spec.ts', 'utf-8', | ||
{ suite: ['s4'], description: 'd4'})}).toThrow(new Error('Test file not found!')); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27295
632
6
14