Skip to content

fix: windows reporter reference#104

Merged
mcollina merged 1 commit into
mcollina:mainfrom
dancastillo:fix-windows-reporter-referenece
Oct 11, 2024
Merged

fix: windows reporter reference#104
mcollina merged 1 commit into
mcollina:mainfrom
dancastillo:fix-windows-reporter-referenece

Conversation

@dancastillo

@dancastillo dancastillo commented Oct 9, 2024

Copy link
Copy Markdown
Contributor

This should fix windows test running reference to relative reporters in fastify ref, for larger PR chore: setup borp reporter for switch to node test

Was getting this error when trying to load file ref here

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:249:11)
    at defaultLoad (node:internal/modules/esm/load:130:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:555:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:56)
    at new ModuleJob (node:internal/modules/esm/module_job:71:27)
    at #createModuleJob (node:internal/modules/esm/loader:447:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:259:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:17)
    at async ModuleLoader.import (node:internal/modules/esm/loader:472:[23](https://github.com/dancastillo/fastify/actions/runs/11262596416/job/31318631268?pr=4#step:5:24)) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

@jsumners jsumners left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Please add a unit test. The relative reporter test is defined at:

borp/test/cli.test.js

Lines 77 to 88 in 339c691

test('reporter from relative path', async () => {
const cwd = join(import.meta.url, '..', 'fixtures', 'relative-reporter')
const { stdout } = await execa('node', [
borp,
'--reporter=./fixtures/relative-reporter/reporter.js'
], {
cwd
})
strictEqual(/passed:.+add\.test\.js/.test(stdout), true)
strictEqual(/passed:.+add2\.test\.js/.test(stdout), true)
})

I'd write it similar to:

test('test name', { skip: platform !== 'win32' }, async () => {
	/* whatever */
})

@mcollina mcollina merged commit f763f88 into mcollina:main Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants