jspm / generator

JSPM Import Map Generator
Apache License 2.0
160 stars 20 forks source link

esm.sh test case failing #310

Closed guybedford closed 10 months ago

guybedford commented 1 year ago

It seems an esm.sh upgrade has caused the test to fail.

Getting in CI:

▶ test/providers/esmsh.test.js
error: Uncaught TypeError: s.inherits is not a function
    at https://esm.sh/v127/assert@1.5.0/X-ZS8q/denonext/assert.js.js:9:45
    at https://esm.sh/v127/assert@1.5.0/X-ZS8q/denonext/assert.js.js:7:452
    at https://esm.sh/v127/assert@1.5.0/X-ZS8q/denonext/assert.js.js:9:3640
Error: Command failed: deno run --quiet --reload --unstable --no-check --allow-all --import-map=/tmp/map.json /tmp/app.js
    at checkExecSyncError (child_process.js:790:11)
    at execSync (child_process.js:863:15)
    at denoExec (file:///home/runner/work/generator/generator/test/deno.js:18:3)
    at file:///home/runner/work/generator/generator/test/deno/esmsh.test.js:13:7
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
ije commented 11 months ago

@guybedford oh, has this been fixed? or i will check what happened.

guybedford commented 11 months ago

@ije thanks for the follow-up here. I just posted a PR to fix some other flakes in https://github.com/jspm/generator/pull/312 and see that the esm.sh test is still failing there yes. It's specific to that test, I haven't had a chance to look into it more carefully yet myself. If you're able to take a look that would be amazing.

ije commented 11 months ago

thanks, i will look into it

guybedford commented 11 months ago

@ije was just wondering if you managed to take a look at this yet?

The source code is https://esm.sh/v130/assert@1.5.0/X-ZS8q/denonext/assert.js.js:9:45, where it seems to be that util.inherits is not a function in this transform for Deno.

I believe it's quite specific to this Deno case, so will just disable the test again for now so we can get our CI passing, but esm.sh is very close to first-class JSPM support afaict.

ije commented 11 months ago

@guybedford i'm looking into it, is this the failed code?

import { Generator } from "@jspm/generator";
import assert from "assert";

const generator = new Generator({
  mapUrl: import.meta.url,
  defaultProvider: "esm.sh",
  env: ["production", "browser"],
});

await generator.install("lit@2.0.0-rc.1");
const json = generator.getMap();

assert.strictEqual(json.imports.lit, "https://esm.sh/*lit@2.0.0-rc.1");

const scope = json.scopes["https://esm.sh/"];
assert.ok(scope["@lit/reactive-element"]);
assert.ok(scope["lit-element/lit-element.js"]);
assert.ok(scope["lit-html"]);
ije commented 11 months ago
Screenshot 2023-08-07 at 19 02 49
guybedford commented 11 months ago

Thanks so much @ije I can confirm it's working now! We've just got one last test failure in the suite remaining, but that's not esm.sh it's a JSPM.IO Babel bug.