Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: windows reporter reference #104

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

dancastillo
Copy link
Contributor

@dancastillo dancastillo commented Oct 9, 2024

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'
}

Copy link
Contributor

@jsumners jsumners left a comment

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
7 checks passed
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