Skip to content

Commit

Permalink
fix(esbuild): tentative fix for output_css test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dae committed Mar 28, 2021
1 parent 41708b5 commit 9921aec
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/esbuild/test/css/bundle_test.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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", () => {
Expand Down

0 comments on commit 9921aec

Please sign in to comment.