Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/svelte2tsx/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export class Sample {

constructor(
dir: string,
readonly name: string
readonly name: string,
public emitOnTemplateError = false
) {
this.directory = path.resolve(dir, 'samples', name);
this.folder = fs.readdirSync(this.directory);
Expand Down Expand Up @@ -110,7 +111,7 @@ export class Sample {

const sample = this;

_it(this.name, function () {
_it(this.name + (this.emitOnTemplateError ? ' (loose parser mode)' : ''), function () {
try {
fn();
if (sample.skipped) this.skip();
Expand Down Expand Up @@ -237,7 +238,7 @@ export function test_samples(dir: string, transform: TransformSampleFn, js: 'js'
const config = {
filename: svelteFile,
sampleName: sample.name,
emitOnTemplateError: false,
emitOnTemplateError: sample.emitOnTemplateError,
preserveAttributeCase: sample.name.endsWith('-foreign-ns')
};

Expand Down Expand Up @@ -382,6 +383,9 @@ export function get_svelte2tsx_config(base: BaseConfig, sampleName: string): Sve
export function* each_sample(dir: string) {
for (const name of fs.readdirSync(`${dir}/samples`)) {
yield new Sample(dir, name);
if (isSvelte5Plus && !fs.existsSync(`${dir}/samples/${name}/expected.error.json`)) {
yield new Sample(dir, `${name}`, true);
}
}
}

Expand Down
Loading