text: // aie aie aie
  // - https://github.com/rollup/rollup/issues/3356
  // - https://github.com/rollup/rollup/issues/3239
  
  import { assert } from "@jsenv/assert"
  import { resolveUrl, urlToRelativeUrl, urlToBasename } from "@jsenv/filesystem"
  
  import { buildProject } from "@jsenv/core"
  import { jsenvCoreDirectoryUrl } from "@jsenv/core/src/jsenv_file_urls.js"
  import { GENERATE_ESMODULE_BUILD_TEST_PARAMS } from "@jsenv/core/test/TEST_PARAMS_BUILD_ESMODULE.js"
  import { executeInBrowser } from "@jsenv/core/test/execute_in_browser.js"
  
  const testDirectoryUrl = resolveUrl("./", import.meta.url)
  const testDirectoryRelativeUrl = urlToRelativeUrl(
    testDirectoryUrl,
    jsenvCoreDirectoryUrl,
  )
  const testDirectoryname = urlToBasename(testDirectoryRelativeUrl)
  const jsenvDirectoryRelativeUrl = `${testDirectoryRelativeUrl}.jsenv/`
  const buildDirectoryRelativeUrl = `${testDirectoryRelativeUrl}dist/esmodule/`
  const entryPoints = {
    [`./${testDirectoryRelativeUrl}${testDirectoryname}.html`]: "./main.html",
  }
  
  const { buildMappings } = await buildProject({
    ...GENERATE_ESMODULE_BUILD_TEST_PARAMS,
    jsenvDirectoryRelativeUrl,
    buildDirectoryRelativeUrl,
    entryPoints,
    // logLevel: "debug",
    // preserveEntrySignatures: false,
  })
  
  {
    const jsBuildRelativeUrl = buildMappings[`${testDirectoryRelativeUrl}main.js`]
    const { returnValue } = await executeInBrowser({
      directoryUrl: new URL("./", import.meta.url),
      htmlFileRelativeUrl: "./dist/esmodule/main.html",
      /* eslint-disable no-undef */
      pageFunction: async (jsBuildRelativeUrl) => {
        const namespace = await import(jsBuildRelativeUrl)
        return namespace
      },
      /* eslint-enable no-undef */
      pageArguments: [`./${jsBuildRelativeUrl}`],
    })
    const actual = returnValue
    const expected = { result: 42 }
    assert({ actual, expected })
  }
  