pull/15538/head
Rich Harris 4 months ago
parent 4039f9ef24
commit 546fa28b59

@ -60,13 +60,6 @@ describe.concurrent(
{ timeout: 20000, retry: process.env.CI ? 1 : 0 } { timeout: 20000, retry: process.env.CI ? 1 : 0 }
); );
describe.concurrent(
'custom-elements',
() => run_ce_tests(__dirname, 'custom-elements-samples'),
// Browser tests are brittle and slow on CI
{ timeout: 20000, retry: process.env.CI ? 1 : 0 }
);
async function run_test( async function run_test(
test_dir: string, test_dir: string,
config: ReturnType<typeof import('./assert').test>, config: ReturnType<typeof import('./assert').test>,
@ -110,7 +103,10 @@ async function run_test(
if (compiled.css !== null) { if (compiled.css !== null) {
compiled.js.code += `document.head.innerHTML += \`<style>${compiled.css.code}</style>\``; compiled.js.code += `document.head.innerHTML += \`<style>${compiled.css.code}</style>\``;
write(`${test_dir}/_output/${path.basename(args.path)}.css`, compiled.css.code); write(
`${test_dir}/_output/client/${path.basename(args.path)}.css`,
compiled.css.code
);
} }
return { return {

@ -169,7 +169,7 @@ async function common_setup(cwd: string, runes: boolean | undefined, config: Run
// load_compiled can be used for debugging a test. It means the compiler will not run on the input // load_compiled can be used for debugging a test. It means the compiler will not run on the input
// so you can manipulate the output manually to see what fixes it, adding console.logs etc. // so you can manipulate the output manually to see what fixes it, adding console.logs etc.
if (!config.load_compiled) { if (!config.load_compiled) {
await compile_directory(cwd, 'client', compileOptions, undefined, undefined); await compile_directory(cwd, 'client', compileOptions);
await compile_directory(cwd, 'server', compileOptions); await compile_directory(cwd, 'server', compileOptions);
} }
@ -259,9 +259,7 @@ async function run_test_variant(
raf.reset(); raf.reset();
// Put things we need on window for testing // Put things we need on window for testing
const styles = globSync('**/*.css', { const styles = globSync('**/*.css', { cwd: `${cwd}/_output/client` })
cwd: `${cwd}/_output/client`
})
.map((file) => fs.readFileSync(`${cwd}/_output/client/${file}`, 'utf-8')) .map((file) => fs.readFileSync(`${cwd}/_output/client/${file}`, 'utf-8'))
.join('\n') .join('\n')
.replace(/\/\*<\/?style>\*\//g, ''); .replace(/\/\*<\/?style>\*\//g, '');

@ -54,7 +54,7 @@ export function suite_with_variants<Test extends BaseTest, Variants extends stri
const solo = config.solo; const solo = config.solo;
let it_fn = skip ? it.skip : solo ? it.only : it; let it_fn = skip ? it.skip : solo ? it.only : it;
it_fn(dir, async () => { it_fn(`${dir} (${variant})`, async () => {
if (!called_common) { if (!called_common) {
called_common = true; called_common = true;
common = await common_setup(config, `${cwd}/${samples_dir}/${dir}`); common = await common_setup(config, `${cwd}/${samples_dir}/${dir}`);

Loading…
Cancel
Save