Skip to content

Commit

Permalink
Decoupling semantic_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Dec 24, 2024
1 parent 850142c commit 30957fb
Show file tree
Hide file tree
Showing 14 changed files with 590 additions and 388 deletions.
85 changes: 78 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`Multiple occurrences of the same syntax results in multiple calculation
"web-features:snapshot:ecmascript-2020",
],
},
"filePath": "",
"filePath": "test.ts",
"name": "operators.nullish_coalescing",
},
]
Expand Down Expand Up @@ -82,7 +82,7 @@ exports[`Multiple occurrences of the same syntax results in multiple calculation
"web-features:snapshot:ecmascript-2020",
],
},
"filePath": "",
"filePath": "test.ts",
"name": "operators.nullish_coalescing",
},
{
Expand Down Expand Up @@ -121,7 +121,7 @@ exports[`Multiple occurrences of the same syntax results in multiple calculation
"web-features:snapshot:ecmascript-2020",
],
},
"filePath": "",
"filePath": "test.ts",
"name": "operators.nullish_coalescing",
},
]
Expand Down
18 changes: 11 additions & 7 deletions __test__/check_browser_supported/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,32 @@ import { checkBrowserSupportedWithSourceCode, checkBrowserSupported } from "../.

const __dirname = dirname(fileURLToPath(import.meta.url));

test("There are 4 syntaxes under normal that are incompatible under chrome 40", () => {
test("There are 4 syntaxes under normal that are incompatible under chrome 40", async () => {
const cwd = path.resolve(__dirname, "features", "normal");

const response = checkBrowserSupported({ chrome: "40" }, { cwd });
const response = await checkBrowserSupported({ chrome: "40" }, { cwd });

expect(response.length).toBe(4);
});

test("There are 3 syntaxes under normal that are incompatible under chrome 45", () => {
test("There are 3 syntaxes under normal that are incompatible under chrome 45", async () => {
const cwd = path.resolve(__dirname, "features", "normal");

const response = checkBrowserSupported({ chrome: "45" }, { cwd });
const response = await checkBrowserSupported({ chrome: "45" }, { cwd });

expect(response.length).toBe(3);
});

test("Multiple occurrences of the same syntax results in multiple calculations.", () => {
const response1 = checkBrowserSupportedWithSourceCode({ chrome: "70" }, "const b = cc ?? 3;");
test("Multiple occurrences of the same syntax results in multiple calculations.", async () => {
const response1 = await checkBrowserSupportedWithSourceCode({ chrome: "70" }, "const b = cc ?? 3;", "test.ts");
expect(response1.length).toBe(1);
expect(response1).toMatchSnapshot();

const response2 = checkBrowserSupportedWithSourceCode({ chrome: "70" }, "const b = cc ?? 3; const c = cc ?? 3;");
const response2 = await checkBrowserSupportedWithSourceCode(
{ chrome: "70" },
"const b = cc ?? 3; const c = cc ?? 3;",
"test.ts",
);
expect(response2.length).toBe(2);
expect(response2).toMatchSnapshot();
});
Loading

0 comments on commit 30957fb

Please sign in to comment.