Skip to content

Commit

Permalink
fix tests for patched version of @jspm/generator
Browse files Browse the repository at this point in the history
  • Loading branch information
JayaKrishnaNamburu committed Jul 10, 2024
1 parent fbee777 commit 4e3a1ac
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
8 changes: 4 additions & 4 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If no modules are given, all "imports" in the initial map are relinked.
* `--cache` _<mode>_ Cache mode for fetches (online, offline, no-cache) (default: online)
* `--root` _<url>_ URL to treat as server root, i.e. rebase import maps against
* `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic)
* `--integrity` Add module preloads with integrity attributes to HTML output (default: false)
* `--integrity` Add module integrity attributes to the import map (default: false)
* `--compact` Output a compact import map (default: false)
* `--stdout` Output the import map to stdout (default: false)
* `--silent` Silence all output (default: false)
Expand Down Expand Up @@ -87,7 +87,7 @@ If no packages are provided, all "imports" in the initial map are reinstalled.
* `--cache` _<mode>_ Cache mode for fetches (online, offline, no-cache) (default: online)
* `--root` _<url>_ URL to treat as server root, i.e. rebase import maps against
* `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic)
* `--integrity` Add module preloads with integrity attributes to HTML output (default: false)
* `--integrity` Add module integrity attributes to the import map (default: false)
* `--compact` Output a compact import map (default: false)
* `--stdout` Output the import map to stdout (default: false)
* `--silent` Silence all output (default: false)
Expand Down Expand Up @@ -137,7 +137,7 @@ Uninstalls packages from an import map. The given packages must be valid package
* `--cache` _<mode>_ Cache mode for fetches (online, offline, no-cache) (default: online)
* `--root` _<url>_ URL to treat as server root, i.e. rebase import maps against
* `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic)
* `--integrity` Add module preloads with integrity attributes to HTML output (default: false)
* `--integrity` Add module integrity attributes to the import map (default: false)
* `--compact` Output a compact import map (default: false)
* `--stdout` Output the import map to stdout (default: false)
* `--silent` Silence all output (default: false)
Expand Down Expand Up @@ -169,7 +169,7 @@ Updates packages in an import map to the latest versions that are compatible wit
* `--cache` _<mode>_ Cache mode for fetches (online, offline, no-cache) (default: online)
* `--root` _<url>_ URL to treat as server root, i.e. rebase import maps against
* `--preload` _[mode]_ Add module preloads to HTML output (default: static, dynamic)
* `--integrity` Add module preloads with integrity attributes to HTML output (default: false)
* `--integrity` Add module integrity attributes to the import map (default: false)
* `--compact` Output a compact import map (default: false)
* `--stdout` Output the import map to stdout (default: false)
* `--silent` Silence all output (default: false)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"@antfu/eslint-config": "^0.34.2",
"@babel/core": "^7.21.4",
"@babel/core": "^7.24.7",
"@types/node": "^18.15.11",
"esbuild": "^0.16.17",
"eslint": "^8.38.0",
Expand Down
2 changes: 1 addition & 1 deletion src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async function handleLocalFile(
generator: Generator
) {
const source = await fs.readFile(resolvedModule.target, { encoding: "utf8" });
const { default: babel } = await import("@babel/core");
const babel = await import("@babel/core");

try {
babel.parse(source);
Expand Down
4 changes: 2 additions & 2 deletions test/ownname.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ const scenarios: Scenario[] = [
commands: ["jspm install app"],
validationFn: async (files: Map<string, string>) => {
// Installing the own-name package "app" should result in the version of
// es-module-lexer in the import map being upgraded to 1.4.1, since it's a
// es-module-lexer in the import map being upgraded to 1.5.4, since it's a
// transitive dependency of "./app.js".
const map = JSON.parse(files.get("importmap.json"));
assert(
map?.imports?.["es-module-lexer"]?.includes("es-module-lexer@1.4.1")
map?.imports?.["es-module-lexer"]?.includes("es-module-lexer@1.5.4")
);
},
},
Expand Down
6 changes: 4 additions & 2 deletions test/providers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ for (const provider of availableProviders) {
let spec = "lit";
let name = "lit";
if (provider.includes("deno")) {
spec = "denoland:oak/body.ts"; // deno doesn't support npm packages
name = "oak/body.ts";
// spec = "denoland:oak/body.ts"; // deno doesn't support npm packages
// name = "oak/body.ts";
spec = "denoland:zod";
name = "zod";
}
if (provider === "node") {
spec = "@jspm/core/nodelibs/fs"; // node provider is only for polyfills
Expand Down
9 changes: 4 additions & 5 deletions test/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function mapDirectory(dir: string): Promise<Files> {
} else {
const subFiles = await mapDirectory(filePath);
for (const [subFile, subData] of subFiles) {
files.set(path.join(file, subFile).replace(/\\/g, '/'), subData);
files.set(path.join(file, subFile).replace(/\\/g, "/"), subData);
}
}
}
Expand Down Expand Up @@ -103,10 +103,9 @@ async function deleteTmpPkg(dir: string) {
try {
await fs.rm(dir, { recursive: true });
return;
}
catch (err) {
if (err.code === 'EBUSY')
await new Promise(resolve => setTimeout(resolve, 10));
} catch (err) {
if (err.code === "EBUSY")
await new Promise((resolve) => setTimeout(resolve, 10));
}
}
} else {
Expand Down

0 comments on commit 4e3a1ac

Please sign in to comment.