astro/test/helpers.js
duncanhealy 687ff5bacd
chore fix lint reduce errors generated (#83)
* add dep domhandler imported in in src/build/static

* lint and jsDoc error

* move domhandler to devDep

* chore: add package lock

* escape string jsDoc

* chore: add astro dep in until prism import is refactored

* chore: add snowpack example package lock
2021-04-12 16:20:58 +01:00

33 lines
810 B
JavaScript

import { createRuntime } from '../lib/runtime.js';
import { loadConfig } from '../lib/config.js';
import * as assert from 'uvu/assert';
/** setup fixtures for tests */
export function setup(Suite, fixturePath) {
let runtime, setupError;
Suite.before(async (context) => {
const astroConfig = await loadConfig(new URL(fixturePath, import.meta.url).pathname);
const logging = {
level: 'error',
dest: process.stderr,
};
try {
runtime = await createRuntime(astroConfig, { logging });
} catch (err) {
console.error(err);
setupError = err;
}
context.runtime = runtime;
});
Suite.after(async () => {
(await runtime) && runtime.shutdown();
});
Suite('No errors creating a runtime', () => {
assert.equal(setupError, undefined);
});
}