-
Notifications
You must be signed in to change notification settings - Fork 0
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
Wrap @web/test-runner binary #65
Conversation
const requestedBrowsers = ALLOWED_BROWSERS.filter(b => cliArgs?.[b]); | ||
this.#requestedBrowsers = requestedBrowsers.length && requestedBrowsers; | ||
} | ||
|
||
get #defaultConfig() { | ||
return { | ||
files: this.#getPattern('test'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this disables the default
group
bin/test.js
Outdated
@@ -126,44 +138,34 @@ export class WTRConfig { | |||
} | |||
|
|||
#getPattern(type) { | |||
const pattern = this.#cliArgs.files || this.pattern(type); | |||
const pattern = [].concat(this.#cliArgs.files || this.pattern(type)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows --files
option (which will be an array) to be filtered properly
bin/test.js
Outdated
return `+(${fileGlobs.join('|')})`; | ||
}); | ||
}); | ||
return `+(${fileGlobs.join('|') || fileGlob})`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handles bad POSIX CLI globs gracefully.
--files ./*.test.js
is converted by the OS to a list of all matching files (with no * characters) before being sent to the process.
--files './*.test.js'
is what should be used. We can add standard POSIX glob note to docs.
bin/test.js
Outdated
if (!group || group === 'default') { | ||
if (playwright) { | ||
console.warn('Warning: reducedMotion disabled. Use the unit group to enable reducedMotion.'); | ||
} else { | ||
console.warn('Warning: Running with puppeteer, reducedMotion disabled. Use the unit group to use playwright with reducedMotion enabled'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer necessary since we are disabling default
group and defaulting to unit
group (and forcing all browsers
options to playwright browsers).
bin/test.js
Outdated
}); | ||
|
||
if (vdiff) { | ||
if (group === 'vdiff') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more vdiff: true
. Just use the group to enable it.
@@ -112,7 +112,7 @@ export function visualDiffReporter({ reportResults = true } = {}) { | |||
cpSync(inputDir, tempDir, { force: true, recursive: true }); | |||
writeFileSync(join(tempDir, 'data.js'), `export default ${json};`); | |||
|
|||
execSync(`rollup -c ${join(__dirname, './rollup.config.js')}`); | |||
execSync(`npx rollup -c ${join(__dirname, './rollup.config.js')}`, { stdio: 'pipe' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npx
fixes command not found
error, which I believe is necessary now the way this runs.
stdio
fixes the double output, though I'm not sure why, since it's supposed to be the default. May need to make this ignore
if it spits out other bad things.
Tests in progress |
0829a96
to
b2d4060
Compare
test/server/cli/test.test.js
Outdated
|
||
it('should not forward disallowed or stolen options', async() => { | ||
const disallowed = ['--browsers', '--playwright', '--puppeteer', '--groups']; | ||
const stolen = ['--config']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆 stolen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah. I tried to avoid it at first but then when I got to borrowed
it seemed like the most accurate word.
src/server/cli/test.js
Outdated
order: 1 | ||
}, | ||
{ | ||
name: 'manual', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I raised this here or the other PR, this will still be removed in a future PR?
src/server/cli/test.js
Outdated
|
||
// d2l-test options | ||
{ | ||
name: 'chrome', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I was thinking about - does this affect the browser names the runner has? Will the goldens be stored in chrome
and safari
folders, or still chromium
and webkit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing else changes. I did start second-guessing this because literally everything else will not match these. Directories, test output, report tabs, (playwright/wtr options).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's convenient but makes me like it a bit less if everything else will still say the old name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be happy to switch what the report shows if that's what we're worried about. The output in the console though will still say "chromium" and "webkit". Surprised Firefox doesn't resort to "gecko".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the weirdest part for me would be the folders not matching, which I guess we could change by having a map in the plugin.
4fa0c84
to
a131243
Compare
🎉 This PR is included in version 0.18.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
US154135: Visual-diff: wrap web-test-runner binary
Use is largely the same. Notable changes:
wtr
/web-test-runner
->d2l-test
chromium
->chrome
,webkit
->safari
web-test-runner.config.js
->d2l-test.config.js
createConfig
orgetBrowsers
--files
is now an explicit option--group
is now the implicit option, withunit
being the default (i.e.d2l-test
andd2l-test unit
run theunit
group)--filter
no longer adds leading and trailing wildcards. So, in cored2l-test -f list
will only findlist.test.js
. Add your own wildcards to match more:-f list*
or-f *list*
Most wtr options will pass through, but some are explicitly disabled to avoid overwriting the
d2l-test
config.