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.js63
1 files changed, 0 insertions, 63 deletions
diff --git a/packages/astro/test/benchmark/dev.bench.js b/packages/astro/test/benchmark/dev.bench.js
deleted file mode 100644
index 134992634..000000000
--- a/packages/astro/test/benchmark/dev.bench.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/** @todo migrate these to use the independent docs repository at https://github.com/withastro/docs */
-
-import { performance } from 'perf_hooks';
-import { Benchmark } from './benchmark.js';
-import { runDevServer } from '../helpers.js';
-import { deleteAsync } from 'del';
-
-const docsExampleRoot = new URL('../../../../docs/', import.meta.url);
-
-async function runToStarted(root) {
- 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;
- }
- }
-
- 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 deleteAsync(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();
- }
-}
-
-run().catch((err) => {
- console.error(err);
- process.exit(1);
-});