ava 4.0.0 → 4.0.1

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/runner.js CHANGED
@@ -224,8 +224,8 @@ export default class Runner extends Emittery {
224
224
  return this.snapshots.skipSnapshot(options);
225
225
  }
226
226
 
227
- saveSnapshotState() {
228
- return {touchedFiles: this.snapshots.save()};
227
+ async saveSnapshotState() {
228
+ return {touchedFiles: await this.snapshots.save()};
229
229
  }
230
230
 
231
231
  onRun(runnable) {
@@ -182,8 +182,8 @@ function sortBlocks(blocksByTitle, blockIndices) {
182
182
  );
183
183
  }
184
184
 
185
- function encodeSnapshots(snapshotData) {
186
- const encoded = cbor.encodeOne(snapshotData, {
185
+ async function encodeSnapshots(snapshotData) {
186
+ const encoded = await cbor.encodeAsync(snapshotData, {
187
187
  omitUndefinedProperties: true,
188
188
  canonical: true,
189
189
  });
@@ -351,7 +351,7 @@ class Manager {
351
351
  this.recordSerialized({belongsTo, index, ...snapshot});
352
352
  }
353
353
 
354
- save() {
354
+ async save() {
355
355
  const {dir, relFile, snapFile, snapPath, reportPath} = this;
356
356
 
357
357
  if (this.updating && this.newBlocksByTitle.size === 0) {
@@ -371,15 +371,17 @@ class Manager {
371
371
  ),
372
372
  };
373
373
 
374
- const buffer = encodeSnapshots(snapshots);
374
+ const buffer = await encodeSnapshots(snapshots);
375
375
  const reportBuffer = generateReport(relFile, snapFile, snapshots);
376
376
 
377
- fs.mkdirSync(dir, {recursive: true});
377
+ await fs.promises.mkdir(dir, {recursive: true});
378
378
 
379
379
  const temporaryFiles = [];
380
380
  const tmpfileCreated = file => temporaryFiles.push(file);
381
- writeFileAtomic.sync(snapPath, buffer, {tmpfileCreated});
382
- writeFileAtomic.sync(reportPath, reportBuffer, {tmpfileCreated});
381
+ await Promise.all([
382
+ writeFileAtomic(snapPath, buffer, {tmpfileCreated}),
383
+ writeFileAtomic(reportPath, reportBuffer, {tmpfileCreated}),
384
+ ]);
383
385
  return {
384
386
  changedFiles: [snapPath, reportPath],
385
387
  temporaryFiles,
@@ -81,7 +81,7 @@ const run = async options => {
81
81
 
82
82
  runner.on('finish', async () => {
83
83
  try {
84
- const {touchedFiles} = runner.saveSnapshotState();
84
+ const {touchedFiles} = await runner.saveSnapshotState();
85
85
  if (touchedFiles) {
86
86
  channel.send({type: 'touched-files', files: touchedFiles});
87
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ava",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Node.js test runner that lets you develop with confidence.",
5
5
  "license": "MIT",
6
6
  "repository": "avajs/ava",