text: import path from "path";
  import * as babel from "..";
  
  describe("asynchronicity", () => {
    const base = path.join(__dirname, "fixtures", "async");
    let cwd;
  
    beforeEach(function () {
      cwd = process.cwd();
      process.chdir(base);
    });
  
    afterEach(function () {
      process.chdir(cwd);
    });
  
    describe("config file", () => {
      describe("async function", () => {
        it("called synchronously", () => {
          process.chdir("config-file-async-function");
  
          expect(() =>
            babel.transformSync(""),
          ).toThrowErrorMatchingInlineSnapshot(
            `"You appear to be using an async configuration, which your current version of Babel does` +
              ` not support. We may add support for this in the future, but if you're on the most recent` +
              ` version of @babel/core and still seeing this error, then you'll need to synchronously` +
              ` return your config."`,
          );
        });
  
        it("called asynchronously", async () => {
          process.chdir("config-file-async-function");
  
          await expect(
            babel.transformAsync(""),
          ).rejects.toThrowErrorMatchingInlineSnapshot(
            `"You appear to be using an async configuration, which your current version of Babel does` +
              ` not support. We may add support for this in the future, but if you're on the most recent` +
              ` version of @babel/core and still seeing this error, then you'll need to synchronously` +
              ` return your config."`,
          );
        });
      });
  
      describe("promise", () => {
        it("called synchronously", () => {
          process.chdir("config-file-promise");
  
          expect(() =>
            babel.transformSync(""),
          ).toThrowErrorMatchingInlineSnapshot(
            `"You appear to be using an async configuration, which your current version of Babel does` +
              ` not support. We may add support for this in the future, but if you're on the most recent` +
              ` version of @babel/core and still seeing this error, then you'll need to synchronously` +
              ` return your config."`,
          );
        });
  
        it("called asynchronously", async () => {
          process.chdir("config-file-promise");
  
          await expect(
            babel.transformAsync(""),
          ).rejects.toThrowErrorMatchingInlineSnapshot(
            `"You appear to be using an async configuration, which your current version of Babel does` +
              ` not support. We may add support for this in the future, but if you're on the most recent` +
              ` version of @babel/core and still seeing this error, then you'll need to synchronously` +
              ` return your config."`,
          );
        });
      });
  
      describe("cache.using", () => {
        it("called synchronously", () => {
          process.chdir("config-cache");
  
          expect(() =>
            babel.transformSync(""),
          ).toThrowErrorMatchingInlineSnapshot(
            `"You appear to be using an async cache handler, which your current version of Babel does` +
              ` not support. We may add support for this in the future, but if you're on the most recent` +
              ` version of @babel/core and still seeing this error, then you'll need to synchronously` +
              ` handle your caching logic."`,
          );
        });
  
        it("called asynchronously", async () => {
          process.chdir("config-cache");
  
          await expect(
            babel.transformAsync(""),
          ).rejects.toThrowErrorMatchingInlineSnapshot(
            `"You appear to be using an async cache handler, which your current version of Babel does` +
              ` not support. We may add support for this in the future, but if you're on the most recent` +
              ` version of @babel/core and still seeing this error, then you'll need to synchronously` +
              ` handle your caching logic."`,
          );
        });
      });
    });
  
    describe("plugin", () => {
      describe("factory function", () => {
        it("called synchronously", () => {
          process.chdir("plugin");
  
          expect(() =>
            babel.transformSync(""),
          ).toThrowErrorMatchingInlineSnapshot(
            `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` +
              ` does not support. If you're using a published plugin, you may need to upgrade your` +
              ` @babel/core version."`,
          );
        });
  
        it("called asynchronously", async () => {
          process.chdir("plugin");
  
          await expect(
            babel.transformAsync(""),
          ).rejects.toThrowErrorMatchingInlineSnapshot(
            `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` +
              ` does not support. If you're using a published plugin, you may need to upgrade your` +
              ` @babel/core version."`,
          );
        });
      });
  
      describe(".pre", () => {
        it("called synchronously", () => {
          process.chdir("plugin-pre");
  
          expect(() =>
            babel.transformSync(""),
          ).toThrowErrorMatchingInlineSnapshot(
            `"unknown: You appear to be using an plugin with an async .pre, which your current version` +
              ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` +
              ` @babel/core version."`,
          );
        });
  
        it("called asynchronously", async () => {
          process.chdir("plugin-pre");
  
          await expect(
            babel.transformAsync(""),
          ).rejects.toThrowErrorMatchingInlineSnapshot(
            `"unknown: You appear to be using an plugin with an async .pre, which your current version` +
              ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` +
              ` @babel/core version."`,
          );
        });
      });
  
      describe(".post", () => {
        it("called synchronously", () => {
          process.chdir("plugin-post");
  
          expect(() =>
            babel.transformSync(""),
          ).toThrowErrorMatchingInlineSnapshot(
            `"unknown: You appear to be using an plugin with an async .post, which your current version` +
              ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` +
              ` @babel/core version."`,
          );
        });
  
        it("called asynchronously", async () => {
          process.chdir("plugin-post");
  
          await expect(
            babel.transformAsync(""),
          ).rejects.toThrowErrorMatchingInlineSnapshot(
            `"unknown: You appear to be using an plugin with an async .post, which your current version` +
              ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` +
              ` @babel/core version."`,
          );
        });
      });
  
      describe("inherits", () => {
        it("called synchronously", () => {
          process.chdir("plugin-inherits");
  
          expect(() =>
            babel.transformSync(""),
          ).toThrowErrorMatchingInlineSnapshot(
            `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` +
              ` does not support. If you're using a published plugin, you may need to upgrade your` +
              ` @babel/core version."`,
          );
        });
  
        it("called asynchronously", async () => {
          process.chdir("plugin-inherits");
  
          await expect(
            babel.transformAsync(""),
          ).rejects.toThrowErrorMatchingInlineSnapshot(
            `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` +
              ` does not support. If you're using a published plugin, you may need to upgrade your` +
              ` @babel/core version."`,
          );
        });
      });
    });
  });
  