Skip to content

Commit

Permalink
Fix Promise assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Apr 1, 2022
1 parent 9a5aa84 commit 894928f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/config/format-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { __dirname } = createEsmUtils(import.meta);

let prettier;

const { FULL_TEST } = process.env;
const { FULL_TEST, TEST_STANDALONE } = process.env;
const BOM = "\uFEFF";

const CURSOR_PLACEHOLDER = "<|>";
Expand Down Expand Up @@ -120,7 +120,12 @@ const isTestDirectory = (dirname, name) =>
);

const ensurePromise = (value) => {
if (!(value instanceof Promise)) {
const isPromise = TEST_STANDALONE
? // In standalone test, promise is from another context
Object.prototype.toString.call(value) === "[object Promise]"
: value instanceof Promise;

if (!isPromise) {
throw new TypeError("Expected value to be a 'Promise'.");
}

Expand Down

0 comments on commit 894928f

Please sign in to comment.