diff --git a/packages/esbuild/test/css/bundle_test.js b/packages/esbuild/test/css/bundle_test.js index ea677eeea5..31f3f41466 100644 --- a/packages/esbuild/test/css/bundle_test.js +++ b/packages/esbuild/test/css/bundle_test.js @@ -1,4 +1,4 @@ -const { readFileSync } = require("fs"); +const { stat, readFileSync } = require("fs"); const path = require("path"); const helper = require(process.env.BAZEL_NODE_RUNFILES_HELPER); @@ -8,9 +8,19 @@ const cssExpected = helper.resolve(path.join(locationBase, "with_css.css")); describe("esbuild css", () => { it("no css by default", () => { - expect(() => - helper.resolve(path.join(locationBase, "default.css")) - ).toThrow(); + let default_css_path = null; + try { + default_css_path = helper.resolve(path.join(locationBase, "default.css")); + } catch { + // the runfiles helper will throw an exception on a missing file on Mac/Linux + expect(default_css_path).toBeNull(); + return; + } + + // attempting to stat the file on Windows should fail + stat(default_css_path, (err) => { + expect(err).toBeTruthy(); + }); }); it("css if requested", () => {