@web/test-runner-core
Advanced tools
Comparing version 0.10.22 to 0.10.23
@@ -8,15 +8,8 @@ "use strict"; | ||
const globby_1 = __importDefault(require("globby")); | ||
const path_1 = __importDefault(require("path")); | ||
const path_1 = require("path"); | ||
function collectTestFiles(patterns, baseDir = process.cwd()) { | ||
const testFiles = new Set(); | ||
for (const pattern of Array.isArray(patterns) ? patterns : [patterns]) { | ||
const normalizedPattern = pattern.split(path_1.default.sep).join('/'); | ||
const foundFiles = globby_1.default.sync(normalizedPattern, { cwd: baseDir, absolute: true }); | ||
for (const file of foundFiles) { | ||
testFiles.add(file); | ||
} | ||
} | ||
return Array.from(testFiles); | ||
const normalizedPatterns = [patterns].flat().map(p => p.split(path_1.sep).join('/')); | ||
return globby_1.default.sync(normalizedPatterns, { cwd: baseDir, absolute: true }); | ||
} | ||
exports.collectTestFiles = collectTestFiles; | ||
//# sourceMappingURL=collectTestFiles.js.map |
@@ -46,3 +46,21 @@ "use strict"; | ||
let finished = false; | ||
runner.on('finished', () => { | ||
runner.on('test-run-finished', ({ testRun, testCoverage }) => { | ||
var _a; | ||
for (const reporter of finalConfig.reporters) { | ||
(_a = reporter.onTestRunFinished) === null || _a === void 0 ? void 0 : _a.call(reporter, { | ||
testRun, | ||
sessions: Array.from(runner.sessions.all()), | ||
testCoverage, | ||
focusedTestFile: runner.focusedTestFile, | ||
}); | ||
} | ||
}); | ||
runner.on('finished', async () => { | ||
var _a; | ||
for (const reporter of finalConfig.reporters) { | ||
await ((_a = reporter.stop) === null || _a === void 0 ? void 0 : _a.call(reporter, { | ||
sessions: Array.from(runner.sessions.all()), | ||
focusedTestFile: runner.focusedTestFile, | ||
})); | ||
} | ||
finished = true; | ||
@@ -49,0 +67,0 @@ runner.stop(); |
{ | ||
"name": "@web/test-runner-core", | ||
"version": "0.10.22", | ||
"version": "0.10.23", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
import globby from 'globby'; | ||
import path from 'path'; | ||
import { sep } from 'path'; | ||
export function collectTestFiles(patterns: string | string[], baseDir = process.cwd()) { | ||
const testFiles = new Set<string>(); | ||
for (const pattern of Array.isArray(patterns) ? patterns : [patterns]) { | ||
const normalizedPattern = pattern.split(path.sep).join('/'); | ||
const foundFiles = globby.sync(normalizedPattern, { cwd: baseDir, absolute: true }); | ||
for (const file of foundFiles) { | ||
testFiles.add(file); | ||
} | ||
} | ||
return Array.from(testFiles); | ||
const normalizedPatterns = [patterns].flat().map(p => p.split(sep).join('/')); | ||
return globby.sync(normalizedPatterns, { cwd: baseDir, absolute: true }); | ||
} |
@@ -68,3 +68,21 @@ /* eslint-disable no-async-promise-executor, no-inner-declarations */ | ||
let finished = false; | ||
runner.on('finished', () => { | ||
runner.on('test-run-finished', ({ testRun, testCoverage }) => { | ||
for (const reporter of finalConfig.reporters) { | ||
reporter.onTestRunFinished?.({ | ||
testRun, | ||
sessions: Array.from(runner.sessions.all()), | ||
testCoverage, | ||
focusedTestFile: runner.focusedTestFile, | ||
}); | ||
} | ||
}); | ||
runner.on('finished', async () => { | ||
for (const reporter of finalConfig.reporters) { | ||
await reporter.stop?.({ | ||
sessions: Array.from(runner.sessions.all()), | ||
focusedTestFile: runner.focusedTestFile, | ||
}); | ||
} | ||
finished = true; | ||
@@ -71,0 +89,0 @@ runner.stop(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
7081
403720
253