webcomponents / webcomponents.org

Home of the web components community
https://www.webcomponents.org
Apache License 2.0
359 stars 95 forks source link

Add get-custom-elements_test and fix resolveReference #1345

Closed justinfagnani closed 1 year ago

justinfagnani commented 1 year ago

Fixes an issue with the Shoelace manifest where local references (to inside the same module) included a module field so we treated them as external references and failed to resolve non-exported declarations. Now we check if the module we're importing from and the reference's module are the same, and if so treat it as a local reference.

justinfagnani commented 1 year ago

I can't figure out why the shoelace manifest is not being found on CI 🤔

justinfagnani commented 1 year ago

@aomarks do you have any ideas what could be going on here?

The fs functions aren't finding the test/test-data/shoelace-2.0.0-beta.83.json file that is included in the commits. The test-data directory just appears empty, but listing it does not raise an error, so it exists. I'm very confused.

justinfagnani commented 1 year ago

I tried the test locally on a fresh checkout, and it fails there too. The wild part is that the test somehow deletes the file. I though it might be a wireit config, but if I skip the test the file isn't deleted, so I think that rules out wireit which has no knowledge of the implementation inside the test module.

Continuing with the weirdness, the file is gone by the time the debug code I added that lists the test-data directory runs. Nothing by then even mentioned that file by name. The only things are fileURLToPath(import.meta.url), process.cwd(), path.resolve() and fs.readdir() on the test-data directory. How that could be clearing the directory I don't know. 🤷‍♂️

justinfagnani commented 1 year ago

argh. I added:

  const p = execSync('ls -al test/test-data');
  console.log(p.toString());

to the test and it started passing. I then commented those lines out and it stayed passing. I don't get it. I'll push with those lines and see.

justinfagnani commented 1 year ago

@aomarks that last change made the tests pass. Why was the data file being deleted before?