@rstest/core
Advanced tools
+10
-4
@@ -347,4 +347,8 @@ import "node:module"; | ||
| ])); | ||
| const neededFiles = await getAssetFiles(assetNames); | ||
| const neededSourceMaps = await getSourceMaps(assetNames); | ||
| const neededFilesPromise = getAssetFiles(assetNames); | ||
| const neededSourceMapsPromise = getSourceMaps(assetNames); | ||
| const [neededFiles, neededSourceMaps] = await Promise.all([ | ||
| neededFilesPromise, | ||
| neededSourceMapsPromise | ||
| ]); | ||
| return { | ||
@@ -1077,4 +1081,6 @@ assetFiles: neededFiles, | ||
| if (coverage?.enabled && 'list' !== command) { | ||
| const { loadCoverageProvider } = await import("./7704.js"); | ||
| const { pluginCoverageCore } = await import("./0~plugin.js"); | ||
| const [{ loadCoverageProvider }, { pluginCoverageCore }] = await Promise.all([ | ||
| import("./7704.js"), | ||
| import("./0~plugin.js") | ||
| ]); | ||
| const { pluginCoverage } = await loadCoverageProvider(coverage, context.rootPath); | ||
@@ -1081,0 +1087,0 @@ coverage.exclude.push(...Object.values(setupFiles).flatMap((files)=>Object.values(files)), ...Object.values(globalSetupFiles || {}).flatMap((files)=>Object.values(files))); |
@@ -375,3 +375,3 @@ import "node:module"; | ||
| const preview = computeFilePreview(cwd, projectInfo); | ||
| const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.3"); | ||
| const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.4"); | ||
| const depsList = Object.entries(deps).map(([name, version])=>`${name}@${version}`).join(', '); | ||
@@ -454,3 +454,3 @@ const previewLines = [ | ||
| }); | ||
| const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.3"); | ||
| const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.4"); | ||
| updatePackageJsonDevDeps(cwd, deps); | ||
@@ -457,0 +457,0 @@ return createdFiles; |
@@ -7,3 +7,3 @@ import "node:module"; | ||
| async function loadBrowserModule(options = {}) { | ||
| const coreVersion = "0.9.3"; | ||
| const coreVersion = "0.9.4"; | ||
| const { projectRoots = [] } = options; | ||
@@ -10,0 +10,0 @@ let browserModule; |
+11
-7
@@ -52,4 +52,8 @@ import "node:module"; | ||
| const files = globalSetupEntries.flatMap((e)=>e.files); | ||
| const assetFiles = await getAssetFiles(files); | ||
| const sourceMaps = await getSourceMaps(files); | ||
| const assetFilesPromise = getAssetFiles(files); | ||
| const sourceMapsPromise = getSourceMaps(files); | ||
| const [assetFiles, sourceMaps] = await Promise.all([ | ||
| assetFilesPromise, | ||
| sourceMapsPromise | ||
| ]); | ||
| const { success, errors } = await runGlobalSetup({ | ||
@@ -115,11 +119,11 @@ globalSetupEntries, | ||
| const collectTestFiles = async ({ context, globTestSourceEntries })=>{ | ||
| const list = []; | ||
| for (const project of context.projects){ | ||
| const projectLists = await Promise.all(context.projects.map(async (project)=>{ | ||
| const files = await globTestSourceEntries(project.environmentName); | ||
| list.push(...Object.values(files).map((testPath)=>({ | ||
| return Object.values(files).map((testPath)=>({ | ||
| testPath, | ||
| project: project.name, | ||
| tests: [] | ||
| }))); | ||
| } | ||
| })); | ||
| })); | ||
| const list = projectLists.flat(); | ||
| return { | ||
@@ -126,0 +130,0 @@ close: async ()=>void 0, |
| import "node:module"; | ||
| import { builtinModules } from "node:module"; | ||
| import { isAbsolute } from "node:path"; | ||
@@ -15,2 +16,3 @@ import { fileURLToPath, pathToFileURL } from "node:url"; | ||
| const isRelativePath = (p)=>/^\.\.?\//.test(p); | ||
| const isBuiltinSpecifier = (specifier)=>specifier.startsWith('node:') || builtinModules.includes(specifier); | ||
| const defineRstestDynamicImport = ({ distPath, testPath, assetFiles, interopDefault, returnModule, esmMode })=>async (specifier, importAttributes)=>{ | ||
@@ -41,3 +43,3 @@ const currentDirectory = posix.dirname(distPath); | ||
| } | ||
| const resolvedPath = isAbsolute(specifier) ? pathToFileURL(specifier) : import.meta.resolve(specifier, pathToFileURL(testPath)); | ||
| const resolvedPath = isAbsolute(specifier) ? pathToFileURL(specifier) : isBuiltinSpecifier(specifier) ? specifier : import.meta.resolve(specifier, pathToFileURL(testPath)); | ||
| const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname; | ||
@@ -44,0 +46,0 @@ if (importAttributes?.with?.rstest) delete importAttributes.with.rstest; |
@@ -295,4 +295,8 @@ import "node:module"; | ||
| const files = globalSetupEntries.flatMap((e)=>e.files); | ||
| const assetFiles = await getAssetFiles(files); | ||
| const sourceMaps = await getSourceMaps(files); | ||
| const assetFilesPromise = getAssetFiles(files); | ||
| const sourceMapsPromise = getSourceMaps(files); | ||
| const [assetFiles, sourceMaps] = await Promise.all([ | ||
| assetFilesPromise, | ||
| sourceMapsPromise | ||
| ]); | ||
| const { success, errors } = await runGlobalSetup({ | ||
@@ -299,0 +303,0 @@ globalSetupEntries, |
+1
-2
@@ -39,3 +39,2 @@ import "node:module"; | ||
| } | ||
| var coverage_CoverageProviderMap = void 0; | ||
| export { coverage_CoverageProviderMap as CoverageProviderMap, createCoverageProvider, loadCoverageProvider }; | ||
| export { CoverageProviderMap, createCoverageProvider, loadCoverageProvider }; |
+21
-2
@@ -104,2 +104,21 @@ import "node:module"; | ||
| let isTeardown = false; | ||
| const setErrorName = (error, type)=>{ | ||
| try { | ||
| error.name = type; | ||
| return error; | ||
| } catch { | ||
| try { | ||
| Object.defineProperty(error, 'name', { | ||
| value: type, | ||
| configurable: true | ||
| }); | ||
| return error; | ||
| } catch { | ||
| const fallbackError = new Error(error.message); | ||
| fallbackError.name = type; | ||
| fallbackError.stack = error.stack; | ||
| return fallbackError; | ||
| } | ||
| } | ||
| }; | ||
| const setupEnv = (env)=>{ | ||
@@ -156,4 +175,4 @@ if (env) Object.entries(env).forEach(([key, value])=>{ | ||
| const handleError = (e, type)=>{ | ||
| const error = 'string' == typeof e ? new Error(e) : e; | ||
| error.name = type; | ||
| const rawError = 'string' == typeof e ? new Error(e) : e; | ||
| const error = rawError.name && 'Error' !== rawError.name ? rawError : setErrorName(rawError, type); | ||
| if (isTeardown) { | ||
@@ -160,0 +179,0 @@ error.stack = `${logger_color.yellow('Caught error after test environment was torn down:')}\n\n${error.stack}`; |
+1
-1
| { | ||
| "name": "@rstest/core", | ||
| "version": "0.9.3", | ||
| "version": "0.9.4", | ||
| "description": "The Rsbuild-based test tool.", | ||
@@ -5,0 +5,0 @@ "bugs": { |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 15 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 15 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
3450793
0.05%79316
0.07%