Skip to content

Commit

Permalink
update to @jspm/[email protected] (#2536)
Browse files Browse the repository at this point in the history
* update to @jspm/[email protected]

* windows support for tests, new generator behaviour
  • Loading branch information
guybedford authored May 29, 2023
1 parent 44ea474 commit 9faad6c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions chompfile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ dep = 'test:'
name = 'test:##'
dep = 'test/##.test.ts'
run = 'tsx $DEP'
serial = true
8 changes: 4 additions & 4 deletions 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 @@ -12,7 +12,7 @@
"jspm.js"
],
"dependencies": {
"@jspm/generator": "^1.1.7",
"@jspm/generator": "^1.1.9",
"cac": "^6.7.14",
"ora": "^6.3.0",
"picocolors": "^1.0.0"
Expand Down
7 changes: 3 additions & 4 deletions test/ownname.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +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 remaining the same, since it's a
// transitive dependency of "./app.js", even though it violates the lock:
// TODO: is this the behaviour we want?
// es-module-lexer in the import map being upgraded to 1.2.2, 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@0.10.5")
map?.imports?.["es-module-lexer"]?.includes("es-module-lexer@1.2.1")
);
},
},
Expand Down
15 changes: 12 additions & 3 deletions test/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export async function runScenario(scenario: Scenario) {
cause: err,
});
} finally {
await deleteTmpPkg(dir);
process.chdir(cwd);
await deleteTmpPkg(dir);
}
}

Expand All @@ -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), subData);
files.set(path.join(file, subFile).replace(/\\/g, '/'), subData);
}
}
}
Expand Down Expand Up @@ -99,7 +99,16 @@ async function createTmpPkg(scenario: Scenario): Promise<string> {
async function deleteTmpPkg(dir: string) {
if (dir.startsWith(os.tmpdir())) {
// ensure it's a tmp dir
return fs.rm(dir, { recursive: true });
while (true) {
try {
await fs.rm(dir, { recursive: true });
return;
}
catch (err) {
if (err.code === 'EBUSY')
await new Promise(resolve => setTimeout(resolve, 10));
}
}
} else {
throw new Error(`Cannot delete ${dir} as it is not a temporary directory.`);
}
Expand Down

0 comments on commit 9faad6c

Please sign in to comment.