Skip to content

Commit 3df9d84

Browse files
authored
chore: speed up test execution (#8598)
- shard runtime tests for better use of Vite's test parallelization - merge custom element and other browser tests to run in one test suite and use esbuild in it - on some setups only generate code output when test fails
1 parent 7e9af10 commit 3df9d84

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+568
-645
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ node_modules
1717
/animate
1818
/scratch/
1919
/test/*/samples/_
20+
/test/runtime/shards
2021
/yarn-error.log
2122
_actual*.*
2223
_output

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ src/compiler/compile/internal_exports.js
1212
/test/**/expected*
1313
/test/**/_output
1414
/types
15+
!vitest.config.js

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"axobject-query": "^3.1.1",
133133
"code-red": "^1.0.0",
134134
"css-tree": "^2.3.1",
135+
"esbuild": "^0.17.19",
135136
"eslint": "^8.40.0",
136137
"eslint-config-prettier": "^8.8.0",
137138
"eslint-plugin-import": "^2.27.5",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/css/css.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import * as fs from 'node:fs';
44
import { assert, describe, it } from 'vitest';
5-
import * as svelte from '../../src/compiler/index.js';
5+
import * as svelte from 'svelte/compiler';
66
import { create_loader, should_update_expected, try_load_config } from '../helpers.js';
77
import { assert_html_equal } from '../html_equal.js';
88

@@ -116,7 +116,7 @@ describe('css', () => {
116116
});
117117

118118
function replace_css_hash(str) {
119-
return str.replace(/svelte(-ref)?-[a-z0-9]+/g, (m, $1) => ($1 ? m : 'svelte-xyz'));
119+
return str.replace(/svelte-[a-z0-9]+/g, 'svelte-xyz');
120120
}
121121

122122
function read(file) {

test/custom-elements/assert.js

Lines changed: 0 additions & 50 deletions
This file was deleted.

test/custom-elements/custom-elements.test.js

Lines changed: 0 additions & 118 deletions
This file was deleted.

test/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from 'node:path';
33
import glob from 'tiny-glob/sync';
44
import colors from 'kleur';
55
import { assert } from 'vitest';
6-
import { compile } from '../src/compiler/index.js';
6+
import { compile } from 'svelte/compiler';
77
import { fileURLToPath } from 'node:url';
88

99
export function try_load_json(file) {

test/js/js-output.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as fs from 'node:fs';
22
import * as path from 'node:path';
33
import { describe, it, assert } from 'vitest';
44
import { try_load_config, should_update_expected } from '../helpers.js';
5-
import * as svelte from '../../src/compiler/index.js';
5+
import * as svelte from 'svelte/compiler';
66

77
describe('js-output', () => {
88
fs.readdirSync(`${__dirname}/samples`).forEach((dir) => {

test/parser/parser.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from 'node:fs';
22
import { assert, describe, it } from 'vitest';
3-
import * as svelte from '../../src/compiler/index.js';
3+
import * as svelte from 'svelte/compiler';
44
import { try_load_json } from '../helpers.js';
55

66
describe('parse', () => {

0 commit comments

Comments
 (0)