@web/test-runner-core
Advanced tools
Comparing version 0.11.0 to 0.11.1
@@ -18,7 +18,7 @@ "use strict"; | ||
' ', | ||
`Local address: ${nanocolors_1.cyan(localAddress)}`, | ||
`Network address: ${nanocolors_1.cyan(networkAddress)}`, | ||
`Local address: ${(0, nanocolors_1.cyan)(localAddress)}`, | ||
`Network address: ${(0, nanocolors_1.cyan)(networkAddress)}`, | ||
' ', | ||
`${nanocolors_1.gray('Press')} D ${nanocolors_1.gray('to open the browser.')}`, | ||
`${nanocolors_1.gray('Press')} ${config.manual ? 'Q' : 'ESC'} ${nanocolors_1.gray('to exit manual debug.')}`, | ||
`${(0, nanocolors_1.gray)('Press')} D ${(0, nanocolors_1.gray)('to open the browser.')}`, | ||
`${(0, nanocolors_1.gray)('Press')} ${config.manual ? 'Q' : 'ESC'} ${(0, nanocolors_1.gray)('to exit manual debug.')}`, | ||
].filter(_ => !!_); | ||
@@ -25,0 +25,0 @@ } |
@@ -10,4 +10,4 @@ "use strict"; | ||
function formatTestFile(file, i, offset, failed) { | ||
const relativePath = path_1.relative(process.cwd(), file); | ||
return `[${i + offset}]${' '.repeat(Math.max(0, minWidth - (i + offset).toString().length))}${failed ? nanocolors_1.red(relativePath) : nanocolors_1.cyan(relativePath)}`; | ||
const relativePath = (0, path_1.relative)(process.cwd(), file); | ||
return `[${i + offset}]${' '.repeat(Math.max(0, minWidth - (i + offset).toString().length))}${failed ? (0, nanocolors_1.red)(relativePath) : (0, nanocolors_1.cyan)(relativePath)}`; | ||
} | ||
@@ -14,0 +14,0 @@ const entries = [ |
@@ -8,17 +8,17 @@ "use strict"; | ||
return [ | ||
`${nanocolors_1.gray('Press')} F ${nanocolors_1.gray('to focus another test file.')}`, | ||
`${nanocolors_1.gray('Press')} D ${nanocolors_1.gray('to debug in the browser.')}`, | ||
coverage ? `${nanocolors_1.gray('Press')} C ${nanocolors_1.gray('to view coverage details.')}` : '', | ||
`${nanocolors_1.gray('Press')} Q ${nanocolors_1.gray('to exit watch mode.')}`, | ||
`${nanocolors_1.gray('Press')} Enter ${nanocolors_1.gray('to re-run this test file.')}`, | ||
`${nanocolors_1.gray('Press')} ESC ${nanocolors_1.gray('to exit focus mode')}`, | ||
`${(0, nanocolors_1.gray)('Press')} F ${(0, nanocolors_1.gray)('to focus another test file.')}`, | ||
`${(0, nanocolors_1.gray)('Press')} D ${(0, nanocolors_1.gray)('to debug in the browser.')}`, | ||
coverage ? `${(0, nanocolors_1.gray)('Press')} C ${(0, nanocolors_1.gray)('to view coverage details.')}` : '', | ||
`${(0, nanocolors_1.gray)('Press')} Q ${(0, nanocolors_1.gray)('to exit watch mode.')}`, | ||
`${(0, nanocolors_1.gray)('Press')} Enter ${(0, nanocolors_1.gray)('to re-run this test file.')}`, | ||
`${(0, nanocolors_1.gray)('Press')} ESC ${(0, nanocolors_1.gray)('to exit focus mode')}`, | ||
].filter(_ => !!_); | ||
} | ||
return [ | ||
testFiles.length > 1 ? `${nanocolors_1.gray('Press')} F ${nanocolors_1.gray('to focus on a test file.')}` : '', | ||
`${nanocolors_1.gray('Press')} D ${nanocolors_1.gray('to debug in the browser.')}`, | ||
`${nanocolors_1.gray('Press')} M ${nanocolors_1.gray('to debug manually in a custom browser.')}`, | ||
coverage ? `${nanocolors_1.gray('Press')} C ${nanocolors_1.gray('to view coverage details.')}` : '', | ||
`${nanocolors_1.gray('Press')} Q ${nanocolors_1.gray('to quit watch mode.')}`, | ||
`${nanocolors_1.gray('Press')} Enter ${nanocolors_1.gray('to re-run all tests.')}`, | ||
testFiles.length > 1 ? `${(0, nanocolors_1.gray)('Press')} F ${(0, nanocolors_1.gray)('to focus on a test file.')}` : '', | ||
`${(0, nanocolors_1.gray)('Press')} D ${(0, nanocolors_1.gray)('to debug in the browser.')}`, | ||
`${(0, nanocolors_1.gray)('Press')} M ${(0, nanocolors_1.gray)('to debug manually in a custom browser.')}`, | ||
coverage ? `${(0, nanocolors_1.gray)('Press')} C ${(0, nanocolors_1.gray)('to view coverage details.')}` : '', | ||
`${(0, nanocolors_1.gray)('Press')} Q ${(0, nanocolors_1.gray)('to quit watch mode.')}`, | ||
`${(0, nanocolors_1.gray)('Press')} Enter ${(0, nanocolors_1.gray)('to re-run all tests.')}`, | ||
].filter(_ => !!_); | ||
@@ -25,0 +25,0 @@ } |
@@ -58,2 +58,3 @@ "use strict"; | ||
for (const [key, fn] of Object.entries(this.originalFunctions)) { | ||
// @ts-ignore | ||
console[key] = fn; | ||
@@ -85,3 +86,3 @@ } | ||
this.previousDynamic = entries; | ||
log_update_1.default(entries.join('\n')); | ||
(0, log_update_1.default)(entries.join('\n')); | ||
} | ||
@@ -88,0 +89,0 @@ /** |
import { TestRunnerCoreConfig } from '../config/TestRunnerCoreConfig'; | ||
import { TestRunner } from '../runner/TestRunner'; | ||
export declare type MenuType = 'none' | 'overview' | 'focus' | 'debug' | 'manual-debug'; | ||
export type MenuType = 'none' | 'overview' | 'focus' | 'debug' | 'manual-debug'; | ||
export declare const MENUS: { | ||
@@ -5,0 +5,0 @@ NONE: MenuType; |
@@ -69,6 +69,6 @@ "use strict"; | ||
if (this.config.staticLogging || !this.terminal.isInteractive) { | ||
this.logger.log(nanocolors_1.bold(`Running ${this.runner.testFiles.length} test files...\n`)); | ||
this.logger.log((0, nanocolors_1.bold)(`Running ${this.runner.testFiles.length} test files...\n`)); | ||
} | ||
if (this.config.open) { | ||
open_1.default(this.localAddress); | ||
(0, open_1.default)(this.localAddress); | ||
} | ||
@@ -108,3 +108,3 @@ } | ||
else if (this.activeMenu === exports.MENUS.MANUAL_DEBUG) { | ||
open_1.default(this.localAddress); | ||
(0, open_1.default)(this.localAddress); | ||
} | ||
@@ -119,3 +119,3 @@ return; | ||
if (this.activeMenu === exports.MENUS.OVERVIEW && this.config.coverage) { | ||
open_1.default(`file://${path_1.default.resolve((_a = this.config.coverageConfig.reportDir) !== null && _a !== void 0 ? _a : '', 'lcov-report', 'index.html')}`); | ||
(0, open_1.default)(`file://${path_1.default.resolve((_a = this.config.coverageConfig.reportDir) !== null && _a !== void 0 ? _a : '', 'lcov-report', 'index.html')}`); | ||
} | ||
@@ -278,5 +278,5 @@ return; | ||
if (this.runner.focusedTestFile) { | ||
reports.push(`Focused on test file: ${nanocolors_1.cyan(path_1.default.relative(process.cwd(), this.runner.focusedTestFile))}\n`); | ||
reports.push(`Focused on test file: ${(0, nanocolors_1.cyan)(path_1.default.relative(process.cwd(), this.runner.focusedTestFile))}\n`); | ||
} | ||
reports.push(...getWatchCommands_1.getWatchCommands(!!this.config.coverage, this.runner.testFiles, !!this.runner.focusedTestFile), ''); | ||
reports.push(...(0, getWatchCommands_1.getWatchCommands)(!!this.config.coverage, this.runner.testFiles, !!this.runner.focusedTestFile), ''); | ||
} | ||
@@ -304,5 +304,5 @@ if (logStatic) { | ||
const { message, code, line, column } = error; | ||
const result = code_frame_1.codeFrameColumns(code, { start: { line, column } }, { highlightCode: true }); | ||
const result = (0, code_frame_1.codeFrameColumns)(code, { start: { line, column } }, { highlightCode: true }); | ||
const relativePath = path_1.default.relative(process.cwd(), filePath); | ||
report.push(nanocolors_1.red(`Error while transforming ${nanocolors_1.cyan(relativePath)}: ${message}`)); | ||
report.push((0, nanocolors_1.red)(`Error while transforming ${(0, nanocolors_1.cyan)(relativePath)}: ${message}`)); | ||
report.push(result); | ||
@@ -315,3 +315,3 @@ report.push(''); | ||
writeCoverageReport(testCoverage) { | ||
writeCoverageReport_1.writeCoverageReport(testCoverage, this.config.coverageConfig); | ||
(0, writeCoverageReport_1.writeCoverageReport)(testCoverage, this.config.coverageConfig); | ||
} | ||
@@ -357,3 +357,3 @@ switchMenu(menu) { | ||
} | ||
const selectFilesEntries = getSelectFilesMenu_1.getSelectFilesMenu(this.menuSucceededAndPendingFiles, this.menuFailedFiles); | ||
const selectFilesEntries = (0, getSelectFilesMenu_1.getSelectFilesMenu)(this.menuSucceededAndPendingFiles, this.menuFailedFiles); | ||
this.terminal.logDynamic([]); | ||
@@ -365,3 +365,3 @@ this.terminal.logStatic(selectFilesEntries); | ||
logManualDebugMenu() { | ||
this.terminal.logDynamic(getManualDebugMenu_1.getManualDebugMenu(this.config)); | ||
this.terminal.logDynamic((0, getManualDebugMenu_1.getManualDebugMenu)(this.config)); | ||
} | ||
@@ -368,0 +368,0 @@ async reportEnd() { |
@@ -111,3 +111,3 @@ "use strict"; | ||
function getTestCoverage(sessions, config) { | ||
const coverageMap = istanbul_lib_coverage_1.createCoverageMap(); | ||
const coverageMap = (0, istanbul_lib_coverage_1.createCoverageMap)(); | ||
let coverages = Array.from(sessions) | ||
@@ -114,0 +114,0 @@ .map(s => s.testCoverage) |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -8,3 +8,3 @@ "use strict"; | ||
for (const session of sessions) { | ||
const debugSession = Object.assign(Object.assign({}, session), { id: nanoid_1.nanoid(), debug: true }); | ||
const debugSession = Object.assign(Object.assign({}, session), { id: (0, nanoid_1.nanoid)(), debug: true }); | ||
debugSessions.push(debugSession); | ||
@@ -11,0 +11,0 @@ } |
@@ -50,3 +50,3 @@ "use strict"; | ||
const baseDir = group.configFilePath ? path_1.default.dirname(group.configFilePath) : process.cwd(); | ||
const testFilesForGroup = collectTestFiles_1.collectTestFiles(group.files, baseDir) | ||
const testFilesForGroup = (0, collectTestFiles_1.collectTestFiles)(group.files, baseDir) | ||
// Normalize file path because glob returns windows paths with forward slashes: | ||
@@ -74,3 +74,3 @@ // C:/foo/bar -> C:\foo\bar | ||
const session = { | ||
id: nanoid_1.nanoid(), | ||
id: (0, nanoid_1.nanoid)(), | ||
group: sessionGroup, | ||
@@ -77,0 +77,0 @@ debug: false, |
@@ -32,3 +32,3 @@ "use strict"; | ||
} | ||
const { sessionGroups, testFiles, testSessions, browsers } = createSessionGroups_1.createTestSessions(config, groupConfigs); | ||
const { sessionGroups, testFiles, testSessions, browsers } = (0, createSessionGroups_1.createTestSessions)(config, groupConfigs); | ||
this.config = config; | ||
@@ -134,7 +134,7 @@ this.testFiles = testFiles; | ||
const sessions = this.sessions.forTestFile(testFile); | ||
const debugSessions = createDebugSessions_1.createDebugSessions(Array.from(sessions)); | ||
const debugSessions = (0, createDebugSessions_1.createDebugSessions)(Array.from(sessions)); | ||
this.sessions.addDebug(...debugSessions); | ||
for (const session of debugSessions) { | ||
session.browser | ||
.startDebugSession(session.id, createSessionUrl_1.createSessionUrl(this.config, session)) | ||
.startDebugSession(session.id, (0, createSessionUrl_1.createSessionUrl)(this.config, session)) | ||
.catch(error => { | ||
@@ -152,3 +152,3 @@ console.error(error); | ||
if (this.config.coverage) { | ||
testCoverage = getTestCoverage_1.getTestCoverage(this.sessions.all(), this.config.coverageConfig); | ||
testCoverage = (0, getTestCoverage_1.getTestCoverage)(this.sessions.all(), this.config.coverageConfig); | ||
passedCoverage = testCoverage.passed; | ||
@@ -155,0 +155,0 @@ } |
@@ -103,7 +103,8 @@ "use strict"; | ||
try { | ||
await async_1.withTimeout(updatedSession.browser.startSession(updatedSession.id, createSessionUrl_1.createSessionUrl(this.config, updatedSession)), this.browserStartTimeoutMsg, this.config.browserStartTimeout); | ||
await (0, async_1.withTimeout)(updatedSession.browser.startSession(updatedSession.id, (0, createSessionUrl_1.createSessionUrl)(this.config, updatedSession)), this.browserStartTimeoutMsg, this.config.browserStartTimeout); | ||
// when the browser started, wait for session to ping back on time | ||
this.timeoutHandler.waitForTestsStarted(updatedSession.testRun, updatedSession.id); | ||
} | ||
catch (error) { | ||
catch (e) { | ||
const error = e; | ||
if (this.timeoutHandler.isStale(updatedSession)) { | ||
@@ -136,3 +137,3 @@ // something else has changed the test session, such as a the browser timeout | ||
if (session.browser.isActive(session.id)) { | ||
const { testCoverage, errors } = await async_1.withTimeout(session.browser.stopSession(session.id), 'Timed out stopping the browser page', this.config.testsFinishTimeout); | ||
const { testCoverage, errors } = await (0, async_1.withTimeout)(session.browser.stopSession(session.id), 'Timed out stopping the browser page', this.config.testsFinishTimeout); | ||
updatedSession.errors = [...((_a = updatedSession.errors) !== null && _a !== void 0 ? _a : []), ...(errors !== null && errors !== void 0 ? errors : [])]; | ||
@@ -139,0 +140,0 @@ updatedSession.testCoverage = testCoverage; |
@@ -5,3 +5,3 @@ import { Middleware } from '@web/dev-server-core'; | ||
import { TestSession } from '../../test-session/TestSession'; | ||
export declare type RunSessions = (sessions: Iterable<TestSession>) => void; | ||
export type RunSessions = (sessions: Iterable<TestSession>) => void; | ||
export interface DependencyGraphMiddlewareArgs { | ||
@@ -8,0 +8,0 @@ sessions: TestSessionManager; |
@@ -97,3 +97,3 @@ "use strict"; | ||
} | ||
const rerunSessions = debounce_1.default(syncRerunSessions, 300); | ||
const rerunSessions = (0, debounce_1.default)(syncRerunSessions, 300); | ||
function onFileChanged(filePath) { | ||
@@ -100,0 +100,0 @@ pendingChangedFiles.add(filePath); |
import { StackLocation } from '@web/browser-logs'; | ||
export declare type SourceMapFunction = (loc: StackLocation, userAgent: string) => Promise<StackLocation | null>; | ||
export type SourceMapFunction = (loc: StackLocation, userAgent: string) => Promise<StackLocation | null>; | ||
/** | ||
@@ -4,0 +4,0 @@ * Creates a function that can map file path, line an column based on source maps. It maintains a cache of source maps, |
@@ -58,3 +58,3 @@ "use strict"; | ||
try { | ||
const result = await fetchSourceMap_1.fetchSourceMap({ | ||
const result = await (0, fetchSourceMap_1.fetchSourceMap)({ | ||
protocol, | ||
@@ -61,0 +61,0 @@ host, |
@@ -8,3 +8,3 @@ "use strict"; | ||
try { | ||
error.stack = await browser_logs_1.parseStackTrace(error.message, error.stack, { | ||
error.stack = await (0, browser_logs_1.parseStackTrace)(error.message, error.stack, { | ||
mapBrowserUrl, | ||
@@ -25,3 +25,3 @@ mapStackLocation, | ||
} | ||
await async_1.forEachAsync(result.errors, err => { | ||
await (0, async_1.forEachAsync)(result.errors, err => { | ||
if (err.stack) { | ||
@@ -38,3 +38,3 @@ return replaceErrorStack(err, mapBrowserUrl, mapStackLocation, config.rootDir); | ||
async function iterateTests(tests) { | ||
await async_1.forEachAsync(tests, async (test) => { | ||
await (0, async_1.forEachAsync)(tests, async (test) => { | ||
var _a; | ||
@@ -50,3 +50,3 @@ if ((_a = test.error) === null || _a === void 0 ? void 0 : _a.stack) { | ||
async function iterateSuites(suites) { | ||
await async_1.forEachAsync(suites, s => iterateSuite(s)); | ||
await (0, async_1.forEachAsync)(suites, s => iterateSuite(s)); | ||
} | ||
@@ -53,0 +53,0 @@ await iterateSuite(result.testResults); |
@@ -8,3 +8,3 @@ "use strict"; | ||
const browserRootDir = config.rootDir; | ||
const args = await async_1.mapAsync(browserLog.args, arg => browser_logs_1.deserialize(arg, { browserRootDir, mapBrowserUrl, mapStackLocation })); | ||
const args = await (0, async_1.mapAsync)(browserLog.args, arg => (0, browser_logs_1.deserialize)(arg, { browserRootDir, mapBrowserUrl, mapStackLocation })); | ||
return { type: browserLog.type, args }; | ||
@@ -17,3 +17,3 @@ } | ||
const browserLogs = result.logs; | ||
const logsWithType = await async_1.mapAsync(browserLogs, b => parseBrowserLog(b, mapBrowserUrl, mapStackLocation, config)); | ||
const logsWithType = await (0, async_1.mapAsync)(browserLogs, b => parseBrowserLog(b, mapBrowserUrl, mapStackLocation, config)); | ||
const logs = []; | ||
@@ -20,0 +20,0 @@ for (const log of logsWithType) { |
@@ -15,9 +15,9 @@ "use strict"; | ||
await Promise.all([ | ||
parseBrowserLogs_1.parseBrowserLogs(config, mapBrowserUrl, mapStackLocation, result).catch(error => { | ||
(0, parseBrowserLogs_1.parseBrowserLogs)(config, mapBrowserUrl, mapStackLocation, result).catch(error => { | ||
console.error(error); | ||
}), | ||
parseBrowserErrors_1.parseSessionErrors(config, mapBrowserUrl, mapStackLocation, result).catch(error => { | ||
(0, parseBrowserErrors_1.parseSessionErrors)(config, mapBrowserUrl, mapStackLocation, result).catch(error => { | ||
console.error(error); | ||
}), | ||
parseBrowserErrors_1.parseTestResults(config, mapBrowserUrl, mapStackLocation, result).catch(error => { | ||
(0, parseBrowserErrors_1.parseTestResults)(config, mapBrowserUrl, mapStackLocation, result).catch(error => { | ||
console.error(error); | ||
@@ -24,0 +24,0 @@ }), |
@@ -18,3 +18,3 @@ "use strict"; | ||
} | ||
return dev_server_core_1.getRequestFilePath(url.href, rootDir); | ||
return (0, dev_server_core_1.getRequestFilePath)(url.href, rootDir); | ||
}; | ||
@@ -33,7 +33,7 @@ } | ||
this.mapBrowserUrl = createMapBrowserUrl(config.rootDir); | ||
this.sourceMapFunction = createSourceMapFunction_1.createSourceMapFunction(this.config.protocol, this.config.hostname, this.config.port); | ||
this.sourceMapFunction = (0, createSourceMapFunction_1.createSourceMapFunction)(this.config.protocol, this.config.hostname, this.config.port); | ||
this.testRunner.on('test-run-started', ({ testRun }) => { | ||
if (testRun !== 0) { | ||
// create a new source map function to clear the cached source maps | ||
this.sourceMapFunction = createSourceMapFunction_1.createSourceMapFunction(this.config.protocol, this.config.hostname, this.config.port); | ||
this.sourceMapFunction = (0, createSourceMapFunction_1.createSourceMapFunction)(this.config.protocol, this.config.hostname, this.config.port); | ||
} | ||
@@ -135,3 +135,3 @@ }); | ||
} | ||
const result = await parseBrowserResult_1.parseBrowserResult(this.config, this.mapBrowserUrl, this.sourceMapFunction, rawData.userAgent, message.result); | ||
const result = await (0, parseBrowserResult_1.parseBrowserResult)(this.config, this.mapBrowserUrl, this.sourceMapFunction, rawData.userAgent, message.result); | ||
this.sessions.updateStatus(Object.assign(Object.assign({}, session), result), TestSessionStatus_1.SESSION_STATUS.TEST_FINISHED); | ||
@@ -138,0 +138,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
} | ||
return await util_1.promisify(fs_1.default.readFile)(codePath, 'utf-8'); | ||
return await (0, util_1.promisify)(fs_1.default.readFile)(codePath, 'utf-8'); | ||
} | ||
@@ -19,0 +19,0 @@ /** |
@@ -27,3 +27,3 @@ "use strict"; | ||
async function getManualListItem(config, context, testFile) { | ||
const testImportPath = await utils_1.createTestFileImportPath(config, context, testFile); | ||
const testImportPath = await (0, utils_1.createTestFileImportPath)(config, context, testFile); | ||
const displayedPath = testImportPath.split('?')[0].substring(1); | ||
@@ -137,3 +137,3 @@ const pagename = displayedPath.endsWith('.html') ? displayedPath : '/'; | ||
if (!isTestRunnerHtml && | ||
!testFiles.includes(dev_server_core_1.getRequestFilePath(context.url, config.rootDir))) { | ||
!testFiles.includes((0, dev_server_core_1.getRequestFilePath)(context.url, config.rootDir))) { | ||
return; | ||
@@ -148,3 +148,3 @@ } | ||
} | ||
const testFile = await utils_1.createTestFileImportPath(config, context, session.testFile, sessionId); | ||
const testFile = await (0, utils_1.createTestFileImportPath)(config, context, session.testFile, sessionId); | ||
const runtimeConfig = { | ||
@@ -151,0 +151,0 @@ testFile, |
import { Plugin } from '@web/dev-server-core'; | ||
import { BasicTestSession } from '../test-session/BasicTestSession'; | ||
export declare type ExecuteCommandResult = void | unknown | Promise<void> | Promise<unknown>; | ||
export type ExecuteCommandResult = void | unknown | Promise<void> | Promise<unknown>; | ||
export interface ExecuteCommandArgs<TPayload> { | ||
@@ -5,0 +5,0 @@ command: string; |
@@ -26,3 +26,3 @@ "use strict"; | ||
const { testFrameworkImport, testFrameworkPlugin } = testFramework | ||
? serveTestFrameworkPlugin_1.serveTestFrameworkPlugin(testFramework) | ||
? (0, serveTestFrameworkPlugin_1.serveTestFrameworkPlugin)(testFramework) | ||
: {}; | ||
@@ -40,9 +40,9 @@ const serverConfig = { | ||
middleware: [ | ||
watchFilesMiddleware_1.watchFilesMiddleware({ runSessions, sessions, rootDir, fileWatcher: this.fileWatcher }), | ||
cacheMiddleware_1.cacheMiddleware(CACHED_PATTERNS, config.watch), | ||
(0, watchFilesMiddleware_1.watchFilesMiddleware)({ runSessions, sessions, rootDir, fileWatcher: this.fileWatcher }), | ||
(0, cacheMiddleware_1.cacheMiddleware)(CACHED_PATTERNS, config.watch), | ||
...(config.middleware || []), | ||
], | ||
plugins: [ | ||
testRunnerApiPlugin_1.testRunnerApiPlugin(config, testRunner, sessions, plugins), | ||
serveTestRunnerHtmlPlugin_1.serveTestRunnerHtmlPlugin(config, testFiles, sessions, testFrameworkImport), | ||
(0, testRunnerApiPlugin_1.testRunnerApiPlugin)(config, testRunner, sessions, plugins), | ||
(0, serveTestRunnerHtmlPlugin_1.serveTestRunnerHtmlPlugin)(config, testFiles, sessions, testFrameworkImport), | ||
testFrameworkPlugin, | ||
@@ -49,0 +49,0 @@ ...(config.plugins || []), |
@@ -39,3 +39,3 @@ "use strict"; | ||
return new Promise(async (resolve, reject) => { | ||
const port = await portfinder_1.getPortPromise({ port: 9000 + Math.floor(Math.random() * 1000) }); | ||
const port = await (0, portfinder_1.getPortPromise)({ port: 9000 + Math.floor(Math.random() * 1000) }); | ||
const finalConfig = Object.assign(Object.assign(Object.assign({ port }, defaultBaseConfig), config), { testFramework: Object.assign(Object.assign({}, defaultBaseConfig.testFramework), config.testFramework) }); | ||
@@ -42,0 +42,0 @@ const runner = new index_1.TestRunner(finalConfig, groupConfigs); |
@@ -1,2 +0,2 @@ | ||
export declare type TestSessionStatus = 'SCHEDULED' | 'INITIALIZING' | 'STARTED' | 'FINISHED'; | ||
export type TestSessionStatus = 'SCHEDULED' | 'INITIALIZING' | 'STARTED' | 'FINISHED'; | ||
export declare const SESSION_STATUS: { | ||
@@ -3,0 +3,0 @@ SCHEDULED: TestSessionStatus; |
@@ -1,4 +0,4 @@ | ||
declare type EventMap = Record<string, any>; | ||
declare type EventKey<T extends EventMap> = string & keyof T; | ||
declare type EventReceiver<T> = (params: T) => void; | ||
type EventMap = Record<string, any>; | ||
type EventKey<T extends EventMap> = string & keyof T; | ||
type EventReceiver<T> = (params: T) => void; | ||
interface Emitter<T extends EventMap> { | ||
@@ -5,0 +5,0 @@ on<K extends EventKey<T>>(eventName: K, fn: EventReceiver<T[K]>): void; |
@@ -24,3 +24,3 @@ "use strict"; | ||
// this is a data url | ||
return (_a = convert_source_map_1.fromSource(code)) !== null && _a !== void 0 ? _a : undefined; | ||
return (_a = (0, convert_source_map_1.fromSource)(code)) !== null && _a !== void 0 ? _a : undefined; | ||
} | ||
@@ -30,7 +30,7 @@ // this is a source map pointing to another file, fetch it | ||
const sourcMapPath = path_1.default.join(dir, sourceMapUrl); | ||
const { response: sourceMapResponse, body: sourceMap } = await request_1.request(Object.assign(Object.assign({}, reqOpts), { path: encodeURI(sourcMapPath) })); | ||
const { response: sourceMapResponse, body: sourceMap } = await (0, request_1.request)(Object.assign(Object.assign({}, reqOpts), { path: encodeURI(sourcMapPath) })); | ||
if (!is2xxResponse(sourceMapResponse.statusCode) || !sourceMap) { | ||
return; | ||
} | ||
return convert_source_map_1.fromJSON(sourceMap); | ||
return (0, convert_source_map_1.fromJSON)(sourceMap); | ||
} | ||
@@ -58,3 +58,3 @@ catch (error) { | ||
// account for accurate transformation | ||
const { response, body: source } = await request_1.request(Object.assign(Object.assign({}, reqOpts), { path: encodeURI(args.browserUrl) })); | ||
const { response, body: source } = await (0, request_1.request)(Object.assign(Object.assign({}, reqOpts), { path: encodeURI(args.browserUrl) })); | ||
// we couldn't retreive this file, this could be because it is a generated file | ||
@@ -61,0 +61,0 @@ // from a server plugin which no longer exists |
{ | ||
"name": "@web/test-runner-core", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"publishConfig": { | ||
@@ -60,4 +60,4 @@ "access": "public" | ||
"@types/istanbul-reports": "^3.0.0", | ||
"@web/browser-logs": "^0.3.0", | ||
"@web/dev-server-core": "^0.5.0", | ||
"@web/browser-logs": "^0.3.1", | ||
"@web/dev-server-core": "^0.5.1", | ||
"chokidar": "^3.4.3", | ||
@@ -64,0 +64,0 @@ "cli-cursor": "^3.1.0", |
@@ -14,3 +14,3 @@ import logUpdate from 'log-update'; | ||
export class DynamicTerminal extends EventEmitter<EventMap> { | ||
private originalFunctions: Partial<Record<keyof Console, (...args: any[]) => any>> = {}; | ||
private originalFunctions: Partial<Console> = {}; | ||
private previousDynamic: string[] = []; | ||
@@ -66,3 +66,4 @@ private started = false; | ||
for (const [key, fn] of Object.entries(this.originalFunctions)) { | ||
console[key as keyof Console] = fn; | ||
// @ts-ignore | ||
console[key] = fn; | ||
} | ||
@@ -114,7 +115,7 @@ this.started = false; | ||
if (typeof console[key] === 'function') { | ||
this.originalFunctions[key] = console[key]; | ||
this.originalFunctions[key] = console[key] as any; | ||
console[key] = new Proxy(console[key], { | ||
apply: (target, thisArg, argArray) => { | ||
this.bufferedConsole.console[key](...argArray); | ||
(this.bufferedConsole.console[key] as any)(...argArray); | ||
if (this.pendingConsoleFlush) { | ||
@@ -129,3 +130,3 @@ return; | ||
}, | ||
}); | ||
}) as any; | ||
} | ||
@@ -132,0 +133,0 @@ } |
@@ -145,3 +145,4 @@ import { createSessionUrl } from './createSessionUrl'; | ||
this.timeoutHandler.waitForTestsStarted(updatedSession.testRun, updatedSession.id); | ||
} catch (error) { | ||
} catch (e) { | ||
const error = e as Error; | ||
if (this.timeoutHandler.isStale(updatedSession)) { | ||
@@ -183,3 +184,3 @@ // something else has changed the test session, such as a the browser timeout | ||
} catch (error) { | ||
sessionErrors.push(error); | ||
sessionErrors.push(error as Error); | ||
} finally { | ||
@@ -186,0 +187,0 @@ if (sessionErrors.length > 0) { |
@@ -220,3 +220,5 @@ import { Context, getRequestFilePath, ServerStartParams, WebSocket } from '@web/dev-server-core'; | ||
this.config.logger.error(error); | ||
webSocket.send(JSON.stringify({ type: 'message-response', id, error: error.message })); | ||
webSocket.send( | ||
JSON.stringify({ type: 'message-response', id, error: (error as Error).message }), | ||
); | ||
return; | ||
@@ -223,0 +225,0 @@ } |
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
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
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
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
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
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
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
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
406762
7125
Updated@web/browser-logs@^0.3.1
Updated@web/dev-server-core@^0.5.1