@rstest/browser 0.7.9 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-container/container-static/css/container.425b2695.css +1 -0
- package/dist/browser-container/container-static/js/837.e631233e.js +22311 -0
- package/dist/browser-container/container-static/js/837.e631233e.js.LICENSE.txt +1 -0
- package/dist/browser-container/container-static/js/{container.5ddd46c3.js → container.93bdade7.js} +665 -532
- package/dist/browser-container/container-static/js/{lib-react.a9c9a89b.js → lib-react.48335539.js} +4 -4
- package/dist/browser-container/container-static/js/lib-react.48335539.js.LICENSE.txt +1 -0
- package/dist/browser-container/container.html +6 -1
- package/dist/hostController.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +136 -62
- package/package.json +13 -13
- package/src/hostController.ts +252 -100
- package/src/index.ts +15 -4
- package/dist/browser-container/container-static/css/container.dc438e35.css +0 -1
- package/dist/browser-container/container-static/js/916.5aee8d2f.js +0 -23549
- package/dist/browser-container/container-static/js/916.5aee8d2f.js.LICENSE.txt +0 -1
- package/dist/browser-container/container-static/js/lib-react.a9c9a89b.js.LICENSE.txt +0 -1
package/dist/browser-container/container-static/js/{lib-react.a9c9a89b.js → lib-react.48335539.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! For license information please see lib-react.
|
|
2
|
-
/*! For license information please see lib-react.
|
|
1
|
+
/*! For license information please see lib-react.48335539.js.LICENSE.txt */
|
|
2
|
+
/*! For license information please see lib-react.48335539.js.LICENSE.txt */ "use strict";
|
|
3
3
|
(self.webpackChunk_rstest_browser_ui = self.webpackChunk_rstest_browser_ui || []).push([
|
|
4
4
|
[
|
|
5
5
|
"783"
|
|
@@ -8258,7 +8258,7 @@
|
|
|
8258
8258
|
8525 (e, t, n) {
|
|
8259
8259
|
e.exports = n(1357);
|
|
8260
8260
|
},
|
|
8261
|
-
|
|
8261
|
+
7146 (e, t) {
|
|
8262
8262
|
function n(e, t) {
|
|
8263
8263
|
var n = e.length;
|
|
8264
8264
|
for(e.push(t); 0 < n;){
|
|
@@ -8458,7 +8458,7 @@
|
|
|
8458
8458
|
};
|
|
8459
8459
|
},
|
|
8460
8460
|
1099 (e, t, n) {
|
|
8461
|
-
e.exports = n(
|
|
8461
|
+
e.exports = n(7146);
|
|
8462
8462
|
}
|
|
8463
8463
|
}
|
|
8464
8464
|
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! For license information please see lib-react.48335539.js.LICENSE.txt */
|
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link
|
|
7
|
+
rel="icon"
|
|
8
|
+
type="image/svg+xml"
|
|
9
|
+
href="https://assets.rspack.rs/rstest/rstest-logo.svg"
|
|
10
|
+
/>
|
|
6
11
|
<title>Rstest Browser Test Runner</title>
|
|
7
12
|
<script>
|
|
8
13
|
window.__RSTEST_BROWSER_OPTIONS__ = __RSTEST_OPTIONS_PLACEHOLDER__;
|
|
9
14
|
</script>
|
|
10
|
-
<script defer src="/container-static/js/lib-react.
|
|
15
|
+
<script defer src="/container-static/js/lib-react.48335539.js"></script><script defer src="/container-static/js/837.e631233e.js"></script><script defer src="/container-static/js/container.93bdade7.js"></script><link href="/container-static/css/container.425b2695.css" rel="stylesheet"></head>
|
|
11
16
|
<body>
|
|
12
17
|
<div id="root"></div>
|
|
13
18
|
</body>
|
package/dist/hostController.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ListCommandResult, type Rstest } from '@rstest/core/browser';
|
|
2
|
-
export declare const runBrowserController: (context: Rstest) => Promise<void>;
|
|
1
|
+
import { type BrowserTestRunOptions, type BrowserTestRunResult, type ListCommandResult, type Rstest } from '@rstest/core/browser';
|
|
2
|
+
export declare const runBrowserController: (context: Rstest, options?: BrowserTestRunOptions) => Promise<BrowserTestRunResult | void>;
|
|
3
3
|
/**
|
|
4
4
|
* Result from collecting browser tests.
|
|
5
5
|
* This is the return type for listBrowserTests, designed for future extraction
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Rstest } from '@rstest/core/browser';
|
|
1
|
+
import type { BrowserTestRunOptions, BrowserTestRunResult, Rstest } from '@rstest/core/browser';
|
|
2
2
|
import { type ListBrowserTestsResult } from './hostController';
|
|
3
|
-
export declare function runBrowserTests(context: Rstest): Promise<void>;
|
|
3
|
+
export declare function runBrowserTests(context: Rstest, options?: BrowserTestRunOptions): Promise<BrowserTestRunResult | void>;
|
|
4
4
|
export declare function listBrowserTests(context: Rstest): Promise<ListBrowserTestsResult>;
|
|
5
|
-
export type { ListBrowserTestsResult };
|
|
5
|
+
export type { BrowserTestRunOptions, BrowserTestRunResult, ListBrowserTestsResult, };
|
package/dist/index.js
CHANGED
|
@@ -1639,8 +1639,8 @@ class ContainerRpcManager {
|
|
|
1639
1639
|
}
|
|
1640
1640
|
setupConnectionHandler() {
|
|
1641
1641
|
this.wss.on('connection', (ws)=>{
|
|
1642
|
-
logger.
|
|
1643
|
-
logger.
|
|
1642
|
+
logger.debug('[Browser UI] Container WebSocket connected');
|
|
1643
|
+
logger.debug(`[Browser UI] Current ws: ${this.ws ? 'exists' : 'null'}, new ws: ${ws ? 'exists' : 'null'}`);
|
|
1644
1644
|
this.attachWebSocket(ws);
|
|
1645
1645
|
});
|
|
1646
1646
|
}
|
|
@@ -1679,9 +1679,9 @@ class ContainerRpcManager {
|
|
|
1679
1679
|
await this.rpc?.onTestFileUpdate(files);
|
|
1680
1680
|
}
|
|
1681
1681
|
async reloadTestFile(testFile, testNamePattern) {
|
|
1682
|
-
logger.
|
|
1683
|
-
if (!this.rpc) return void logger.
|
|
1684
|
-
logger.
|
|
1682
|
+
logger.debug(`[Browser UI] reloadTestFile called, rpc: ${this.rpc ? 'exists' : 'null'}, ws: ${this.ws ? 'exists' : 'null'}`);
|
|
1683
|
+
if (!this.rpc) return void logger.debug('[Browser UI] RPC not available, skipping reloadTestFile');
|
|
1684
|
+
logger.debug(`[Browser UI] Calling reloadTestFile: ${testFile}`);
|
|
1685
1685
|
await this.rpc.reloadTestFile(testFile, testNamePattern);
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
@@ -1689,7 +1689,9 @@ const watchContext = {
|
|
|
1689
1689
|
runtime: null,
|
|
1690
1690
|
lastTestFiles: [],
|
|
1691
1691
|
hooksEnabled: false,
|
|
1692
|
-
cleanupRegistered: false
|
|
1692
|
+
cleanupRegistered: false,
|
|
1693
|
+
chunkHashes: new Map(),
|
|
1694
|
+
affectedTestFiles: []
|
|
1693
1695
|
};
|
|
1694
1696
|
const ensureProcessExitCode = (code)=>{
|
|
1695
1697
|
if (void 0 === process.exitCode || 0 === process.exitCode) process.exitCode = code;
|
|
@@ -1733,6 +1735,46 @@ const excludePatternsToRegExp = (patterns)=>{
|
|
|
1733
1735
|
if (0 === keywords.length) return null;
|
|
1734
1736
|
return new RegExp(`[\\\\/](${keywords.join('|')})[\\\\/]`);
|
|
1735
1737
|
};
|
|
1738
|
+
const findTestFileInModules = (modules, entryTestFiles)=>{
|
|
1739
|
+
if (!modules) return null;
|
|
1740
|
+
for (const m of modules){
|
|
1741
|
+
if (m.nameForCondition) {
|
|
1742
|
+
const normalizedPath = normalize(m.nameForCondition);
|
|
1743
|
+
if (entryTestFiles.has(normalizedPath)) return normalizedPath;
|
|
1744
|
+
}
|
|
1745
|
+
if (m.children) {
|
|
1746
|
+
const found = findTestFileInModules(m.children, entryTestFiles);
|
|
1747
|
+
if (found) return found;
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
return null;
|
|
1751
|
+
};
|
|
1752
|
+
const getChunkKey = (chunk)=>{
|
|
1753
|
+
if (null != chunk.id) return String(chunk.id);
|
|
1754
|
+
if (chunk.names && chunk.names.length > 0) return chunk.names[0];
|
|
1755
|
+
if (chunk.files && chunk.files.length > 0) return chunk.files[0];
|
|
1756
|
+
return null;
|
|
1757
|
+
};
|
|
1758
|
+
const getAffectedTestFiles = (chunks, entryTestFiles)=>{
|
|
1759
|
+
if (!chunks) return [];
|
|
1760
|
+
const affectedFiles = new Set();
|
|
1761
|
+
const currentHashes = new Map();
|
|
1762
|
+
for (const chunk of chunks){
|
|
1763
|
+
if (!chunk.hash) continue;
|
|
1764
|
+
const testFile = findTestFileInModules(chunk.modules, entryTestFiles);
|
|
1765
|
+
if (!testFile) continue;
|
|
1766
|
+
const chunkKey = getChunkKey(chunk);
|
|
1767
|
+
if (!chunkKey) continue;
|
|
1768
|
+
const prevHash = watchContext.chunkHashes.get(chunkKey);
|
|
1769
|
+
currentHashes.set(chunkKey, chunk.hash);
|
|
1770
|
+
if (void 0 !== prevHash && prevHash !== chunk.hash) {
|
|
1771
|
+
affectedFiles.add(testFile);
|
|
1772
|
+
logger.debug(`[Watch] Chunk hash changed for ${chunkKey}: ${prevHash} -> ${chunk.hash} (test: ${testFile})`);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
watchContext.chunkHashes = currentHashes;
|
|
1776
|
+
return Array.from(affectedFiles);
|
|
1777
|
+
};
|
|
1736
1778
|
const getRuntimeConfigFromProject = (project)=>{
|
|
1737
1779
|
const { testNamePattern, testTimeout, passWithNoTests, retry, globals, clearMocks, resetMocks, restoreMocks, unstubEnvs, unstubGlobals, maxConcurrency, printConsoleTrace, disableConsoleIntercept, testEnvironment, hookTimeout, isolate, coverage, snapshotFormat, env, bail, logHeapUsage, chaiConfig, includeTaskLocation } = project.normalizedConfig;
|
|
1738
1780
|
return {
|
|
@@ -1939,8 +1981,8 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
1939
1981
|
plugins: userPlugins,
|
|
1940
1982
|
server: {
|
|
1941
1983
|
printUrls: false,
|
|
1942
|
-
port: context.normalizedConfig.browser.port,
|
|
1943
|
-
strictPort:
|
|
1984
|
+
port: context.normalizedConfig.browser.port ?? 4000,
|
|
1985
|
+
strictPort: context.normalizedConfig.browser.strictPort
|
|
1944
1986
|
},
|
|
1945
1987
|
dev: {
|
|
1946
1988
|
client: {
|
|
@@ -1956,44 +1998,46 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
1956
1998
|
{
|
|
1957
1999
|
name: 'rstest:browser-user-config',
|
|
1958
2000
|
setup (api) {
|
|
1959
|
-
api.modifyEnvironmentConfig(
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
extractSourceMap: true
|
|
1991
|
-
});
|
|
1992
|
-
if (isDebug()) logger.log(`[rstest:browser] extractSourceMap rule added for: ${browserRuntimeDir}`);
|
|
2001
|
+
api.modifyEnvironmentConfig({
|
|
2002
|
+
handler: (config, { mergeEnvironmentConfig })=>{
|
|
2003
|
+
const merged = mergeEnvironmentConfig(config, userRsbuildConfig, {
|
|
2004
|
+
resolve: {
|
|
2005
|
+
alias: rstestInternalAliases
|
|
2006
|
+
},
|
|
2007
|
+
output: {
|
|
2008
|
+
target: 'web',
|
|
2009
|
+
sourceMap: {
|
|
2010
|
+
js: 'source-map'
|
|
2011
|
+
}
|
|
2012
|
+
},
|
|
2013
|
+
tools: {
|
|
2014
|
+
rspack: (rspackConfig)=>{
|
|
2015
|
+
rspackConfig.mode = 'development';
|
|
2016
|
+
rspackConfig.lazyCompilation = {
|
|
2017
|
+
imports: true,
|
|
2018
|
+
entries: false
|
|
2019
|
+
};
|
|
2020
|
+
rspackConfig.plugins = rspackConfig.plugins || [];
|
|
2021
|
+
rspackConfig.plugins.push(virtualManifestPlugin);
|
|
2022
|
+
const browserRuntimeDir = dirname(browserRuntimePath);
|
|
2023
|
+
rspackConfig.module = rspackConfig.module || {};
|
|
2024
|
+
rspackConfig.module.rules = rspackConfig.module.rules || [];
|
|
2025
|
+
rspackConfig.module.rules.unshift({
|
|
2026
|
+
test: /\.js$/,
|
|
2027
|
+
include: browserRuntimeDir,
|
|
2028
|
+
extractSourceMap: true
|
|
2029
|
+
});
|
|
2030
|
+
if (isDebug()) logger.log(`[rstest:browser] extractSourceMap rule added for: ${browserRuntimeDir}`);
|
|
2031
|
+
}
|
|
1993
2032
|
}
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
|
|
2033
|
+
});
|
|
2034
|
+
merged.source = merged.source || {};
|
|
2035
|
+
merged.source.entry = {
|
|
2036
|
+
runner: resolveBrowserFile('client/entry.ts')
|
|
2037
|
+
};
|
|
2038
|
+
return merged;
|
|
2039
|
+
},
|
|
2040
|
+
order: 'post'
|
|
1997
2041
|
});
|
|
1998
2042
|
}
|
|
1999
2043
|
}
|
|
@@ -2006,7 +2050,17 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
2006
2050
|
if (!watchContext.hooksEnabled) return;
|
|
2007
2051
|
logger.log(color.cyan('\nFile changed, re-running tests...\n'));
|
|
2008
2052
|
});
|
|
2009
|
-
api.onAfterDevCompile(async ()=>{
|
|
2053
|
+
api.onAfterDevCompile(async ({ stats })=>{
|
|
2054
|
+
if (stats) {
|
|
2055
|
+
const projectEntries = await collectProjectEntries(context);
|
|
2056
|
+
const entryTestFiles = new Set(projectEntries.flatMap((entry)=>entry.testFiles.map((f)=>normalize(f))));
|
|
2057
|
+
const statsJson = stats.toJson({
|
|
2058
|
+
all: true
|
|
2059
|
+
});
|
|
2060
|
+
const affected = getAffectedTestFiles(statsJson.chunks, entryTestFiles);
|
|
2061
|
+
watchContext.affectedTestFiles = affected;
|
|
2062
|
+
if (affected.length > 0) logger.debug(`[Watch] Affected test files: ${affected.join(', ')}`);
|
|
2063
|
+
}
|
|
2010
2064
|
if (!watchContext.hooksEnabled) return;
|
|
2011
2065
|
await onTriggerRerun();
|
|
2012
2066
|
});
|
|
@@ -2038,7 +2092,7 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
2038
2092
|
res.end(html);
|
|
2039
2093
|
return true;
|
|
2040
2094
|
} catch (error) {
|
|
2041
|
-
logger.
|
|
2095
|
+
logger.debug(`[Browser UI] Failed to fetch container HTML from dev server: ${String(error)}`);
|
|
2042
2096
|
return false;
|
|
2043
2097
|
}
|
|
2044
2098
|
};
|
|
@@ -2057,7 +2111,7 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
2057
2111
|
res.end(buffer);
|
|
2058
2112
|
return true;
|
|
2059
2113
|
} catch (error) {
|
|
2060
|
-
logger.
|
|
2114
|
+
logger.debug(`[Browser UI] Failed to proxy asset from dev server: ${String(error)}`);
|
|
2061
2115
|
return false;
|
|
2062
2116
|
}
|
|
2063
2117
|
};
|
|
@@ -2080,13 +2134,13 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
2080
2134
|
res.statusCode = 204;
|
|
2081
2135
|
res.end();
|
|
2082
2136
|
} catch (error) {
|
|
2083
|
-
logger.
|
|
2137
|
+
logger.debug(`[Browser UI] Failed to open editor: ${String(error)}`);
|
|
2084
2138
|
res.statusCode = 500;
|
|
2085
2139
|
res.end('Failed to open editor');
|
|
2086
2140
|
}
|
|
2087
2141
|
return;
|
|
2088
2142
|
}
|
|
2089
|
-
if ('/' === url.pathname
|
|
2143
|
+
if ('/' === url.pathname) {
|
|
2090
2144
|
if (await respondWithDevServerHtml(url, res)) return;
|
|
2091
2145
|
const html = injectedContainerHtml || containerHtmlTemplate?.replace(optionsPlaceholder, 'null');
|
|
2092
2146
|
if (html) {
|
|
@@ -2113,11 +2167,15 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
2113
2167
|
next();
|
|
2114
2168
|
});
|
|
2115
2169
|
const { port } = await devServer.listen();
|
|
2116
|
-
const wsPort = port + 1;
|
|
2117
2170
|
const wss = new WebSocketServer({
|
|
2118
|
-
port:
|
|
2171
|
+
port: 0
|
|
2172
|
+
});
|
|
2173
|
+
await new Promise((resolve, reject)=>{
|
|
2174
|
+
wss.once('listening', resolve);
|
|
2175
|
+
wss.once('error', reject);
|
|
2119
2176
|
});
|
|
2120
|
-
|
|
2177
|
+
const wsPort = wss.address().port;
|
|
2178
|
+
logger.debug(`[Browser UI] WebSocket server started on port ${wsPort}`);
|
|
2121
2179
|
let browserLauncher;
|
|
2122
2180
|
const browserName = context.normalizedConfig.browser.browser;
|
|
2123
2181
|
try {
|
|
@@ -2156,14 +2214,15 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
2156
2214
|
wss
|
|
2157
2215
|
};
|
|
2158
2216
|
};
|
|
2159
|
-
const runBrowserController = async (context)=>{
|
|
2217
|
+
const runBrowserController = async (context, options)=>{
|
|
2218
|
+
const { skipOnTestRunEnd = false } = options ?? {};
|
|
2160
2219
|
const buildStart = Date.now();
|
|
2161
2220
|
const containerDevServerEnv = process.env.RSTEST_CONTAINER_DEV_SERVER;
|
|
2162
2221
|
let containerDevServer;
|
|
2163
2222
|
let containerDistPath;
|
|
2164
2223
|
if (containerDevServerEnv) try {
|
|
2165
2224
|
containerDevServer = new URL(containerDevServerEnv).toString();
|
|
2166
|
-
logger.
|
|
2225
|
+
logger.debug(`[Browser UI] Using dev server for container: ${containerDevServer}`);
|
|
2167
2226
|
} catch (error) {
|
|
2168
2227
|
logger.error(color.red(`Invalid RSTEST_CONTAINER_DEV_SERVER value: ${String(error)}`));
|
|
2169
2228
|
ensureProcessExitCode(1);
|
|
@@ -2289,7 +2348,10 @@ const runBrowserController = async (context)=>{
|
|
|
2289
2348
|
}
|
|
2290
2349
|
const createRpcMethods = ()=>({
|
|
2291
2350
|
async rerunTest (testFile, testNamePattern) {
|
|
2292
|
-
|
|
2351
|
+
const projectName = context.normalizedConfig.name || 'project';
|
|
2352
|
+
const relativePath = relative(context.rootPath, testFile);
|
|
2353
|
+
const displayPath = `<${projectName}>/${relativePath}`;
|
|
2354
|
+
logger.log(color.cyan(`\nRe-running test: ${displayPath}${testNamePattern ? ` (pattern: ${testNamePattern})` : ''}\n`));
|
|
2293
2355
|
await rpcManager.reloadTestFile(testFile, testNamePattern);
|
|
2294
2356
|
},
|
|
2295
2357
|
async getTestFiles () {
|
|
@@ -2364,10 +2426,10 @@ const runBrowserController = async (context)=>{
|
|
|
2364
2426
|
if (isWatchMode) runtime.rpcManager = rpcManager;
|
|
2365
2427
|
}
|
|
2366
2428
|
if (isNewPage) {
|
|
2367
|
-
await containerPage.goto(`http://localhost:${port}
|
|
2429
|
+
await containerPage.goto(`http://localhost:${port}/`, {
|
|
2368
2430
|
waitUntil: 'load'
|
|
2369
2431
|
});
|
|
2370
|
-
logger.log(color.cyan(`\
|
|
2432
|
+
logger.log(color.cyan(`\nBrowser mode opened at http://localhost:${port}/\n`));
|
|
2371
2433
|
}
|
|
2372
2434
|
const maxTestTimeout = Math.max(...browserProjectsForRuntime.map((p)=>p.normalizedConfig.testTimeout ?? 5000));
|
|
2373
2435
|
const totalTimeoutMs = maxTestTimeout * allTestFiles.length + 30000;
|
|
@@ -2397,7 +2459,12 @@ const runBrowserController = async (context)=>{
|
|
|
2397
2459
|
watchContext.lastTestFiles = currentTestFiles;
|
|
2398
2460
|
await rpcManager.notifyTestFileUpdate(currentTestFiles);
|
|
2399
2461
|
}
|
|
2400
|
-
|
|
2462
|
+
const affectedFiles = watchContext.affectedTestFiles;
|
|
2463
|
+
watchContext.affectedTestFiles = [];
|
|
2464
|
+
if (affectedFiles.length > 0) {
|
|
2465
|
+
logger.log(color.cyan(`Re-running ${affectedFiles.length} affected test file(s)...\n`));
|
|
2466
|
+
for (const testFile of affectedFiles)await rpcManager.reloadTestFile(testFile);
|
|
2467
|
+
} else if (!filesChanged) logger.log(color.cyan('Tests will be re-executed automatically\n'));
|
|
2401
2468
|
};
|
|
2402
2469
|
if (!isWatchMode) await destroyBrowserRuntime(runtime);
|
|
2403
2470
|
if (fatalError) {
|
|
@@ -2413,7 +2480,13 @@ const runBrowserController = async (context)=>{
|
|
|
2413
2480
|
context.updateReporterResultState(reporterResults, caseResults);
|
|
2414
2481
|
const isFailure = reporterResults.some((result)=>'fail' === result.status);
|
|
2415
2482
|
if (isFailure) ensureProcessExitCode(1);
|
|
2416
|
-
|
|
2483
|
+
const result = {
|
|
2484
|
+
results: reporterResults,
|
|
2485
|
+
testResults: caseResults,
|
|
2486
|
+
duration,
|
|
2487
|
+
hasFailure: isFailure
|
|
2488
|
+
};
|
|
2489
|
+
if (!skipOnTestRunEnd) for (const reporter of context.reporters)await reporter.onTestRunEnd?.({
|
|
2417
2490
|
results: context.reporterResults.results,
|
|
2418
2491
|
testResults: context.reporterResults.testResults,
|
|
2419
2492
|
duration,
|
|
@@ -2424,6 +2497,7 @@ const runBrowserController = async (context)=>{
|
|
|
2424
2497
|
watchContext.hooksEnabled = true;
|
|
2425
2498
|
logger.log(color.cyan('\nWatch mode enabled - will re-run tests on file changes\n'));
|
|
2426
2499
|
}
|
|
2500
|
+
return result;
|
|
2427
2501
|
};
|
|
2428
2502
|
const listBrowserTests = async (context)=>{
|
|
2429
2503
|
const projectEntries = await collectProjectEntries(context);
|
|
@@ -2567,8 +2641,8 @@ const listBrowserTests = async (context)=>{
|
|
|
2567
2641
|
close: cleanup
|
|
2568
2642
|
};
|
|
2569
2643
|
};
|
|
2570
|
-
async function runBrowserTests(context) {
|
|
2571
|
-
|
|
2644
|
+
async function runBrowserTests(context, options) {
|
|
2645
|
+
return runBrowserController(context, options);
|
|
2572
2646
|
}
|
|
2573
2647
|
async function src_listBrowserTests(context) {
|
|
2574
2648
|
return listBrowserTests(context);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Browser mode support for Rstest testing framework.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -34,11 +34,6 @@
|
|
|
34
34
|
"dist",
|
|
35
35
|
"src"
|
|
36
36
|
],
|
|
37
|
-
"scripts": {
|
|
38
|
-
"build": "rslib build",
|
|
39
|
-
"typecheck": "tsc --noEmit",
|
|
40
|
-
"dev": "rslib build --watch"
|
|
41
|
-
},
|
|
42
37
|
"dependencies": {
|
|
43
38
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
44
39
|
"convert-source-map": "^2.0.0",
|
|
@@ -49,9 +44,6 @@
|
|
|
49
44
|
},
|
|
50
45
|
"devDependencies": {
|
|
51
46
|
"@rslib/core": "^0.19.0",
|
|
52
|
-
"@rstest/browser-ui": "workspace:*",
|
|
53
|
-
"@rstest/core": "workspace:*",
|
|
54
|
-
"@rstest/tsconfig": "workspace:*",
|
|
55
47
|
"@types/convert-source-map": "^2.0.3",
|
|
56
48
|
"@types/picomatch": "^4.0.2",
|
|
57
49
|
"@types/ws": "^8.18.1",
|
|
@@ -59,11 +51,14 @@
|
|
|
59
51
|
"birpc": "2.9.0",
|
|
60
52
|
"picocolors": "^1.1.1",
|
|
61
53
|
"picomatch": "^4.0.3",
|
|
62
|
-
"playwright": "^1.49.1"
|
|
54
|
+
"playwright": "^1.49.1",
|
|
55
|
+
"@rstest/browser-ui": "0.0.0",
|
|
56
|
+
"@rstest/core": "0.8.0",
|
|
57
|
+
"@rstest/tsconfig": "0.0.1"
|
|
63
58
|
},
|
|
64
59
|
"peerDependencies": {
|
|
65
|
-
"
|
|
66
|
-
"
|
|
60
|
+
"playwright": "^1.49.1",
|
|
61
|
+
"@rstest/core": "^0.8.0"
|
|
67
62
|
},
|
|
68
63
|
"peerDependenciesMeta": {
|
|
69
64
|
"playwright": {
|
|
@@ -76,5 +71,10 @@
|
|
|
76
71
|
"publishConfig": {
|
|
77
72
|
"access": "public",
|
|
78
73
|
"registry": "https://registry.npmjs.org/"
|
|
74
|
+
},
|
|
75
|
+
"scripts": {
|
|
76
|
+
"build": "rslib build",
|
|
77
|
+
"typecheck": "tsc --noEmit",
|
|
78
|
+
"dev": "rslib build --watch"
|
|
79
79
|
}
|
|
80
|
-
}
|
|
80
|
+
}
|