summaryrefslogtreecommitdiff
path: root/packages/astro/test/benchmark/dev.bench.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro/test/benchmark/dev.bench.js')
-rw-r--r--packages/astro/test/benchmark/dev.bench.js82
1 files changed, 41 insertions, 41 deletions
diff --git a/packages/astro/test/benchmark/dev.bench.js b/packages/astro/test/benchmark/dev.bench.js
index 1ade92c9a..97710d713 100644
--- a/packages/astro/test/benchmark/dev.bench.js
+++ b/packages/astro/test/benchmark/dev.bench.js
@@ -6,56 +6,56 @@ import del from 'del';
const docsExampleRoot = new URL('../../../../docs/', import.meta.url);
async function runToStarted(root) {
- const args = [];
- const process = runDevServer(root, args);
+ const args = [];
+ const process = runDevServer(root, args);
- let started = null;
- process.stdout.setEncoding('utf8');
- for await (const chunk of process.stdout) {
- if (/Server started/.test(chunk)) {
- started = performance.now();
- break;
- }
- }
+ let started = null;
+ process.stdout.setEncoding('utf8');
+ for await (const chunk of process.stdout) {
+ if (/Server started/.test(chunk)) {
+ started = performance.now();
+ break;
+ }
+ }
- process.kill();
- return started;
+ process.kill();
+ return started;
}
const benchmarks = [
- new Benchmark({
- name: 'Docs Site Example Dev Server Uncached',
- root: docsExampleRoot,
- file: new URL('./dev-server-uncached.json', import.meta.url),
- async setup() {
- const spcache = new URL('../../node_modules/.cache/', import.meta.url);
- await del(spcache.pathname);
- },
- run({ root }) {
- return runToStarted(root);
- },
- }),
- new Benchmark({
- name: 'Docs Site Example Dev Server Cached',
- root: docsExampleRoot,
- file: new URL('./dev-server-cached.json', import.meta.url),
- async setup() {
- // Execute once to make sure Docs Site is cached.
- await this.execute();
- },
- run({ root }) {
- return runToStarted(root);
- },
- }),
+ new Benchmark({
+ name: 'Docs Site Example Dev Server Uncached',
+ root: docsExampleRoot,
+ file: new URL('./dev-server-uncached.json', import.meta.url),
+ async setup() {
+ const spcache = new URL('../../node_modules/.cache/', import.meta.url);
+ await del(spcache.pathname);
+ },
+ run({ root }) {
+ return runToStarted(root);
+ },
+ }),
+ new Benchmark({
+ name: 'Docs Site Example Dev Server Cached',
+ root: docsExampleRoot,
+ file: new URL('./dev-server-cached.json', import.meta.url),
+ async setup() {
+ // Execute once to make sure Docs Site is cached.
+ await this.execute();
+ },
+ run({ root }) {
+ return runToStarted(root);
+ },
+ }),
];
async function run() {
- for (const b of benchmarks) {
- await b.test();
- }
+ for (const b of benchmarks) {
+ await b.test();
+ }
}
run().catch((err) => {
- console.error(err);
- process.exit(1);
+ console.error(err);
+ process.exit(1);
});