ava 6.1.1 → 6.1.2
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/lib/assert.js +3 -1
- package/lib/cli.js +3 -1
- package/lib/create-chain.js +4 -4
- package/lib/eslint-plugin-helper-worker.js +3 -1
- package/lib/load-config.js +4 -2
- package/lib/plugin-support/shared-worker-loader.js +1 -1
- package/lib/snapshot-manager.js +8 -12
- package/lib/test.js +6 -2
- package/lib/watcher.js +9 -3
- package/package.json +2 -2
package/lib/assert.js
CHANGED
|
@@ -417,6 +417,7 @@ export class Assertions {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
let retval;
|
|
420
|
+
let threw = false;
|
|
420
421
|
let actual = null;
|
|
421
422
|
try {
|
|
422
423
|
retval = fn();
|
|
@@ -429,10 +430,11 @@ export class Assertions {
|
|
|
429
430
|
}));
|
|
430
431
|
}
|
|
431
432
|
} catch (error) {
|
|
433
|
+
threw = true;
|
|
432
434
|
actual = error;
|
|
433
435
|
}
|
|
434
436
|
|
|
435
|
-
if (!
|
|
437
|
+
if (!threw) {
|
|
436
438
|
throw fail(new AssertionError(message, {
|
|
437
439
|
assertion: 't.throws()',
|
|
438
440
|
formattedDetails: [formatWithLabel('Function returned:', retval)],
|
package/lib/cli.js
CHANGED
|
@@ -381,7 +381,9 @@ export default async function loadCli() { // eslint-disable-line complexity
|
|
|
381
381
|
|
|
382
382
|
let globs;
|
|
383
383
|
try {
|
|
384
|
-
globs = normalizeGlobs({
|
|
384
|
+
globs = normalizeGlobs({
|
|
385
|
+
files: conf.files, ignoredByWatcher: conf.watchMode?.ignoreChanges, extensions, providers,
|
|
386
|
+
});
|
|
385
387
|
} catch (error) {
|
|
386
388
|
exit(error.message);
|
|
387
389
|
}
|
package/lib/create-chain.js
CHANGED
|
@@ -11,9 +11,7 @@ function startChain(name, call, defaults) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function extendChain(previous, name, flag) {
|
|
14
|
-
|
|
15
|
-
flag = name;
|
|
16
|
-
}
|
|
14
|
+
flag ||= name;
|
|
17
15
|
|
|
18
16
|
const fn = (...args) => {
|
|
19
17
|
callWithFlag(previous, flag, args);
|
|
@@ -89,7 +87,9 @@ export default function createChain(fn, defaults, meta) {
|
|
|
89
87
|
// "todo" tests cannot be chained. Allow todo tests to be flagged as needing
|
|
90
88
|
// to be serial.
|
|
91
89
|
root.todo = startChain('test.todo', fn, {...defaults, type: 'test', todo: true});
|
|
92
|
-
root.serial.todo = startChain('test.serial.todo', fn, {
|
|
90
|
+
root.serial.todo = startChain('test.serial.todo', fn, {
|
|
91
|
+
...defaults, serial: true, type: 'test', todo: true,
|
|
92
|
+
});
|
|
93
93
|
|
|
94
94
|
root.macro = options => {
|
|
95
95
|
if (typeof options === 'function') {
|
|
@@ -48,7 +48,9 @@ const resolveGlobs = async (projectDir, overrideExtensions, overrideFiles) => {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const {conf, providers} = await configCache.get(projectDir);
|
|
51
|
-
return buildGlobs({
|
|
51
|
+
return buildGlobs({
|
|
52
|
+
conf, providers, projectDir, overrideExtensions, overrideFiles,
|
|
53
|
+
});
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
const data = new Uint8Array(workerData.dataBuffer);
|
package/lib/load-config.js
CHANGED
|
@@ -35,7 +35,7 @@ const loadConfigFile = async ({projectDir, configFile}) => {
|
|
|
35
35
|
|
|
36
36
|
function resolveConfigFile(configFile) {
|
|
37
37
|
if (configFile) {
|
|
38
|
-
|
|
38
|
+
return path.resolve(configFile); // Relative to CWD
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
return configFile;
|
|
@@ -153,7 +153,9 @@ export async function loadConfig({configFile, resolveFrom = process.cwd(), defau
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
const config = {
|
|
156
|
+
const config = {
|
|
157
|
+
...defaults, nonSemVerExperiments: {}, ...fileConf, ...packageConf, projectDir, configFile,
|
|
158
|
+
};
|
|
157
159
|
|
|
158
160
|
const {nonSemVerExperiments: experiments} = config;
|
|
159
161
|
if (!isPlainObject(experiments)) {
|
package/lib/snapshot-manager.js
CHANGED
|
@@ -220,7 +220,9 @@ export function extractCompressedSnapshot(buffer, snapPath) {
|
|
|
220
220
|
const compressedOffset = sha256sumOffset + SHA_256_HASH_LENGTH;
|
|
221
221
|
const compressed = buffer.slice(compressedOffset);
|
|
222
222
|
|
|
223
|
-
return {
|
|
223
|
+
return {
|
|
224
|
+
version, compressed, sha256sumOffset, compressedOffset,
|
|
225
|
+
};
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
function decodeSnapshots(buffer, snapPath) {
|
|
@@ -290,11 +292,7 @@ class Manager {
|
|
|
290
292
|
}
|
|
291
293
|
|
|
292
294
|
recordSerialized({data, label, belongsTo, index}) {
|
|
293
|
-
|
|
294
|
-
if (!block) {
|
|
295
|
-
block = {snapshots: []};
|
|
296
|
-
}
|
|
297
|
-
|
|
295
|
+
const block = this.newBlocksByTitle.get(belongsTo) ?? {snapshots: []};
|
|
298
296
|
const {snapshots} = block;
|
|
299
297
|
|
|
300
298
|
if (index > snapshots.length) {
|
|
@@ -319,7 +317,9 @@ class Manager {
|
|
|
319
317
|
|
|
320
318
|
return () => { // Must be called in order!
|
|
321
319
|
this.hasChanges = true;
|
|
322
|
-
this.recordSerialized({
|
|
320
|
+
this.recordSerialized({
|
|
321
|
+
data, label, belongsTo, index,
|
|
322
|
+
});
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
325
|
|
|
@@ -338,11 +338,7 @@ class Manager {
|
|
|
338
338
|
|
|
339
339
|
skipSnapshot({belongsTo, index, deferRecording}) {
|
|
340
340
|
const oldBlock = this.oldBlocksByTitle.get(belongsTo);
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if (!snapshot) {
|
|
344
|
-
snapshot = {};
|
|
345
|
-
}
|
|
341
|
+
const snapshot = oldBlock?.snapshots[index] ?? {};
|
|
346
342
|
|
|
347
343
|
// Retain the label from the old snapshot, so as not to assume that the
|
|
348
344
|
// snapshot.skip() arguments are well-formed.
|
package/lib/test.js
CHANGED
|
@@ -2,7 +2,9 @@ import concordance from 'concordance';
|
|
|
2
2
|
import isPromise from 'is-promise';
|
|
3
3
|
import plur from 'plur';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
AssertionError, Assertions, checkAssertionMessage, getAssertionStack,
|
|
7
|
+
} from './assert.js';
|
|
6
8
|
import concordanceOptions from './concordance-options.js';
|
|
7
9
|
import nowAndTimers from './now-and-timers.cjs';
|
|
8
10
|
import parseTestArgs from './parse-test-args.js';
|
|
@@ -277,7 +279,9 @@ export default class Test {
|
|
|
277
279
|
|
|
278
280
|
const {deferredSnapshotRecordings, error, logs, passed, assertCount, snapshotCount} = await attempt.run();
|
|
279
281
|
const errors = error ? [error] : [];
|
|
280
|
-
return {
|
|
282
|
+
return {
|
|
283
|
+
assertCount, deferredSnapshotRecordings, errors, logs, passed, snapshotCount, startingSnapshotCount,
|
|
284
|
+
};
|
|
281
285
|
};
|
|
282
286
|
|
|
283
287
|
this.assertCount = 0;
|
package/lib/watcher.js
CHANGED
|
@@ -7,7 +7,9 @@ import {nodeFileTrace} from '@vercel/nft';
|
|
|
7
7
|
import createDebug from 'debug';
|
|
8
8
|
|
|
9
9
|
import {chalk} from './chalk.js';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
applyTestFileFilter, classify, buildIgnoreMatcher, findTests,
|
|
12
|
+
} from './globs.js';
|
|
11
13
|
import {levels as providerLevels} from './provider-manager.js';
|
|
12
14
|
|
|
13
15
|
const debug = createDebug('ava:watcher');
|
|
@@ -34,7 +36,9 @@ export function available(projectDir) {
|
|
|
34
36
|
|
|
35
37
|
export async function start({api, filter, globs, projectDir, providers, reporter, stdin, signal}) {
|
|
36
38
|
providers = providers.filter(({level}) => level >= providerLevels.ava6);
|
|
37
|
-
for await (const {files, ...runtimeOptions} of plan({
|
|
39
|
+
for await (const {files, ...runtimeOptions} of plan({
|
|
40
|
+
api, filter, globs, projectDir, providers, stdin, abortSignal: signal,
|
|
41
|
+
})) {
|
|
38
42
|
await api.run({files, filter, runtimeOptions});
|
|
39
43
|
reporter.endRun();
|
|
40
44
|
reporter.lineWriter.writeLine(END_MESSAGE);
|
|
@@ -62,7 +66,9 @@ async function * plan({api, filter, globs, projectDir, providers, stdin, abortSi
|
|
|
62
66
|
const changeFromPath = path => {
|
|
63
67
|
const {isTest} = classify(path, cwdAndGlobs);
|
|
64
68
|
const stats = fileStats(path);
|
|
65
|
-
return {
|
|
69
|
+
return {
|
|
70
|
+
path, isTest, exists: stats !== undefined, isFile: stats?.isFile() ?? false,
|
|
71
|
+
};
|
|
66
72
|
};
|
|
67
73
|
|
|
68
74
|
// Begin a file trace in the background.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ava",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.2",
|
|
4
4
|
"description": "Node.js test runner that lets you develop with confidence.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "avajs/ava",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"tempy": "^3.1.0",
|
|
139
139
|
"tsd": "^0.30.4",
|
|
140
140
|
"typescript": "~5.3.3",
|
|
141
|
-
"xo": "^0.
|
|
141
|
+
"xo": "^0.57.0",
|
|
142
142
|
"zen-observable": "^0.10.0"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|