'use strict';

var _6NIOUVPA_cjs = require('../6NIOUVPA.cjs');
var VPKYL66J_cjs = require('../VPKYL66J.cjs');
var U7VZULNU_cjs = require('../U7VZULNU.cjs');
var promises = require('fs/promises');
var path = require('path');

// src/core/lock.test.ts
U7VZULNU_cjs.init_cjs_shims();
VPKYL66J_cjs.it("runs a callback", async () => {
  await _6NIOUVPA_cjs.lock("once", async () => null);
});
VPKYL66J_cjs.it("runs a callback twice", async () => {
  await _6NIOUVPA_cjs.lock("twice", async () => null);
  await _6NIOUVPA_cjs.lock("twice", async () => null);
});
VPKYL66J_cjs.it("throws an error on timeout", async () => {
  const key = "timeout";
  const path$1 = _6NIOUVPA_cjs.buildLockFilePath(key);
  await promises.mkdir(path.dirname(path$1), {
    recursive: true
  });
  await promises.writeFile(path$1, "");
  await VPKYL66J_cjs.globalExpect(_6NIOUVPA_cjs.lock(key, async () => null, {
    timeout: 0
  })).rejects.toThrowError(/timeout/i);
  await VPKYL66J_cjs.globalExpect(promises.stat(path$1)).rejects.toThrowError(/ENOENT/);
});
//# sourceMappingURL=lock.test.cjs.map
//# sourceMappingURL=lock.test.cjs.map