Fix expect.resolves assert (#5176)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
This commit is contained in:
1 parent
2ff388f19a
commit
0faeee73db
1 file changed
+28
-6
@@ -302,7 +302,7 @@ describe("API getFileInfo resolveConfig when no config is present", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("API getFileInfo with ignorePath", () => {
|
||||
test("API getFileInfo with ignorePath", async () => {
|
||||
const file = path.resolve(
|
||||
path.join(__dirname, "../cli/ignore-path/regular-module.js")
|
||||
);
|
||||
@@ -310,15 +310,37 @@ test("API getFileInfo with ignorePath", () => {
|
||||
path.join(__dirname, "../cli/ignore-path/.prettierignore")
|
||||
);
|
||||
|
||||
expect(prettier.getFileInfo(file)).resolves.toMatchObject({
|
||||
await expect(prettier.getFileInfo(file)).resolves.toMatchObject({
|
||||
ignored: false,
|
||||
inferredParser: "babel",
|
||||
});
|
||||
|
||||
expect(
|
||||
prettier.getFileInfo(file, {
|
||||
ignorePath,
|
||||
})
|
||||
await expect(
|
||||
prettier.getFileInfo(file, { ignorePath })
|
||||
).resolves.toMatchObject({
|
||||
ignored: true,
|
||||
inferredParser: null,
|
||||
});
|
||||
});
|
||||
|
||||
test("API getFileInfo with ignorePath containing relative paths", async () => {
|
||||
const file = path.resolve(
|
||||
path.join(
|
||||
__dirname,
|
||||
"../cli/ignore-relative-path/level1-glob/level2-glob/level3-glob/shouldNotBeFormat.js"
|
||||
)
|
||||
);
|
||||
const ignorePath = path.resolve(
|
||||
path.join(__dirname, "../cli/ignore-relative-path/.prettierignore")
|
||||
);
|
||||
|
||||
await expect(prettier.getFileInfo(file)).resolves.toMatchObject({
|
||||
ignored: false,
|
||||
inferredParser: "babel",
|
||||
});
|
||||
|
||||
await expect(
|
||||
prettier.getFileInfo(file, { ignorePath })
|
||||
).resolves.toMatchObject({
|
||||
ignored: true,
|
||||
inferredParser: null,
|
||||
|
||||
Reference in new issue
Block a user