Comparing version 5.0.1 to 5.1.0
@@ -253,4 +253,4 @@ | ||
if (confError) { | ||
if (confError.parent) { | ||
exit(`${confError.message}\n\n${chalk.gray((confError.parent && confError.parent.stack) || confError.parent)}`); | ||
if (confError.cause) { | ||
exit(`${confError.message}\n\n${chalk.gray(confError.cause?.stack ?? confError.cause)}`); | ||
} else { | ||
@@ -257,0 +257,0 @@ exit(confError.message); |
@@ -32,3 +32,3 @@ import fs from 'node:fs'; | ||
throw Object.assign(new Error(`Error loading ${fileForErrorMessage}: ${error.message}`), {parent: error}); | ||
throw Object.assign(new Error(`Error loading ${fileForErrorMessage}: ${error.message}`), {cause: error}); | ||
} | ||
@@ -40,6 +40,2 @@ }; | ||
configFile = path.resolve(configFile); // Relative to CWD | ||
if (!configFile.endsWith('.js') && !configFile.endsWith('.cjs') && !configFile.endsWith('.mjs')) { | ||
throw new Error('Config files must have .js, .cjs or .mjs extensions'); | ||
} | ||
} | ||
@@ -83,3 +79,3 @@ | ||
export async function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {}) { | ||
export async function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {}) { // eslint-disable-line complexity | ||
let packageConf = await packageConfig('ava', {cwd: resolveFrom}); | ||
@@ -100,3 +96,13 @@ const filepath = packageJsonPath(packageConf); | ||
if (configFile) { | ||
const loaded = await loadConfigFile({projectDir, configFile}); | ||
let loaded; | ||
try { | ||
loaded = await loadConfigFile({projectDir, configFile}); | ||
} catch (error) { | ||
if (!configFile.endsWith('.js') && !configFile.endsWith('.cjs') && !configFile.endsWith('.mjs')) { | ||
throw Object.assign(new Error('Could not load config file; it should have .js, .cjs or .mjs extension'), {cause: error}); | ||
} | ||
throw error; | ||
} | ||
if (loaded !== null) { | ||
@@ -103,0 +109,0 @@ ({config: fileConf, fileForErrorMessage} = loaded); |
@@ -373,4 +373,7 @@ import os from 'node:os'; | ||
this.lineWriter.writeLine(`${testsInFile.size} tests were pending in ${this.relativeFile(file)}\n`); | ||
const testTitleToLogs = evt.pendingTestsLogs.get(file); | ||
for (const title of testsInFile) { | ||
const logs = testTitleToLogs?.get(title); | ||
this.lineWriter.writeLine(`${figures.circleDotted} ${this.prefixTitle(file, title)}`); | ||
this.writeLogs({logs}); | ||
} | ||
@@ -377,0 +380,0 @@ |
@@ -12,2 +12,3 @@ import v8 from 'node:v8'; | ||
this.pendingTests = new Map(); | ||
this.pendingTestsLogs = new Map(); | ||
@@ -64,2 +65,3 @@ this.emptyParallelRun = parallelRuns | ||
this.pendingTests.set(testFile, new Set()); | ||
this.pendingTestsLogs.set(testFile, new Map()); | ||
worker.onStateChange(data => this.emitStateChange(data)); | ||
@@ -129,6 +131,11 @@ } | ||
break; | ||
case 'test-register-log-reference': | ||
this.addPendingTestLogs(event); | ||
break; | ||
case 'timeout': | ||
stats.timeouts++; | ||
event.pendingTests = this.pendingTests; | ||
event.pendingTestsLogs = this.pendingTestsLogs; | ||
this.pendingTests = new Map(); | ||
this.pendingTestsLogs = new Map(); | ||
for (const testsInFile of event.pendingTests.values()) { | ||
@@ -141,7 +148,11 @@ stats.timedOutTests += testsInFile.size; | ||
event.pendingTests = this.pendingTests; | ||
event.pendingTestsLogs = this.pendingTestsLogs; | ||
this.pendingTests = new Map(); | ||
this.pendingTestsLogs = new Map(); | ||
break; | ||
case 'process-exit': | ||
event.pendingTests = this.pendingTests; | ||
event.pendingTestsLogs = this.pendingTestsLogs; | ||
this.pendingTests = new Map(); | ||
this.pendingTestsLogs = new Map(); | ||
break; | ||
@@ -205,2 +216,6 @@ case 'uncaught-exception': | ||
addPendingTestLogs(event) { | ||
this.pendingTestsLogs.get(event.testFile)?.set(event.title, event.logs); | ||
} | ||
addPendingTest(event) { | ||
@@ -207,0 +222,0 @@ if (this.pendingTests.has(event.testFile)) { |
@@ -361,2 +361,8 @@ import process from 'node:process'; | ||
this.emit('stateChange', { | ||
type: 'test-register-log-reference', | ||
title: task.title, | ||
logs: test.logs, | ||
}); | ||
const result = await this.runSingle(test); | ||
@@ -363,0 +369,0 @@ testOk = result.passed; |
{ | ||
"name": "ava", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Node.js test runner that lets you develop with confidence.", | ||
@@ -84,5 +84,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"acorn": "^8.8.0", | ||
"acorn": "^8.8.1", | ||
"acorn-walk": "^8.2.0", | ||
"ansi-styles": "^6.1.1", | ||
"ansi-styles": "^6.2.1", | ||
"arrgv": "^1.0.2", | ||
@@ -92,6 +92,6 @@ "arrify": "^3.0.0", | ||
"cbor": "^8.1.0", | ||
"chalk": "^5.0.1", | ||
"chalk": "^5.1.2", | ||
"chokidar": "^3.5.3", | ||
"chunkd": "^2.0.1", | ||
"ci-info": "^3.4.0", | ||
"ci-info": "^3.6.1", | ||
"ci-parallel-vars": "^1.0.1", | ||
@@ -106,3 +106,3 @@ "clean-yaml-object": "^0.1.0", | ||
"del": "^7.0.0", | ||
"emittery": "^1.0.0", | ||
"emittery": "^1.0.1", | ||
"figures": "^5.0.0", | ||
@@ -126,8 +126,8 @@ "globby": "^13.1.2", | ||
"slash": "^3.0.0", | ||
"stack-utils": "^2.0.5", | ||
"stack-utils": "^2.0.6", | ||
"strip-ansi": "^7.0.1", | ||
"supertap": "^3.0.1", | ||
"temp-dir": "^2.0.0", | ||
"write-file-atomic": "^4.0.2", | ||
"yargs": "^17.5.1" | ||
"temp-dir": "^3.0.0", | ||
"write-file-atomic": "^5.0.0", | ||
"yargs": "^17.6.2" | ||
}, | ||
@@ -138,3 +138,3 @@ "devDependencies": { | ||
"@sindresorhus/tsconfig": "^3.0.1", | ||
"@sinonjs/fake-timers": "^9.1.2", | ||
"@sinonjs/fake-timers": "^10.0.0", | ||
"ansi-escapes": "^6.0.0", | ||
@@ -147,3 +147,3 @@ "c8": "^7.12.0", | ||
"replace-string": "^4.0.0", | ||
"sinon": "^14.0.0", | ||
"sinon": "^14.0.2", | ||
"tap": "^16.3.0", | ||
@@ -154,5 +154,5 @@ "temp-write": "^5.0.0", | ||
"tsd": "^0.24.1", | ||
"typescript": "^4.8.3", | ||
"xo": "^0.52.3", | ||
"zen-observable": "^0.8.15" | ||
"typescript": "^4.8.4", | ||
"xo": "^0.52.4", | ||
"zen-observable": "^0.9.0" | ||
}, | ||
@@ -159,0 +159,0 @@ "peerDependencies": { |
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
267219
7091
+ Addedtemp-dir@3.0.0(transitive)
+ Addedwrite-file-atomic@5.0.1(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedtemp-dir@2.0.0(transitive)
- Removedwrite-file-atomic@4.0.2(transitive)
Updatedacorn@^8.8.1
Updatedansi-styles@^6.2.1
Updatedchalk@^5.1.2
Updatedci-info@^3.6.1
Updatedemittery@^1.0.1
Updatedstack-utils@^2.0.6
Updatedtemp-dir@^3.0.0
Updatedwrite-file-atomic@^5.0.0
Updatedyargs@^17.6.2