summaryrefslogtreecommitdiff
path: root/test/snowpack-integration.test.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-03-23 13:47:54 -0400
committerGravatar GitHub <noreply@github.com> 2021-03-23 13:47:54 -0400
commit854d0feb34f605c0fe3f5627a261e327164c449e (patch)
treec7d88676affbd271fd6304a73d98c149e265f042 /test/snowpack-integration.test.js
parent3f16550765cccee0de8f2f6e5451bf41aec13601 (diff)
downloadastro-854d0feb34f605c0fe3f5627a261e327164c449e.tar.gz
astro-854d0feb34f605c0fe3f5627a261e327164c449e.tar.zst
astro-854d0feb34f605c0fe3f5627a261e327164c449e.zip
Add support for React components. (#18)
* Add support for React components. This adds support for react components via a new `extensions` config in astro.config.mjs. In the future we can extend this to do things like look at the import statements, as Snowpack does. * Fix the tests
Diffstat (limited to 'test/snowpack-integration.test.js')
-rw-r--r--test/snowpack-integration.test.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/test/snowpack-integration.test.js b/test/snowpack-integration.test.js
index c851e8bdb..8547ee7cd 100644
--- a/test/snowpack-integration.test.js
+++ b/test/snowpack-integration.test.js
@@ -1,35 +1,39 @@
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { createRuntime } from '../lib/runtime.js';
+import { loadConfig } from '../lib/config.js';
import { promises as fsPromises } from 'fs';
import { relative as pathRelative } from 'path';
import { doc } from './test-utils.js';
const { readdir, stat } = fsPromises;
-// Bug: Snowpack config is still loaded relative to the current working directory.
-process.chdir(new URL('../examples/snowpack/', import.meta.url).pathname);
-
const SnowpackDev = suite('snowpack.dev');
-let runtime;
+let runtime, cwd;
SnowpackDev.before(async () => {
- const astroConfig = {
- projectRoot: new URL('../examples/snowpack/', import.meta.url),
- hmxRoot: new URL('../examples/snowpack/astro/', import.meta.url),
- dist: './_site',
- };
+// Bug: Snowpack config is still loaded relative to the current working directory.
+ cwd = process.cwd();
+ process.chdir(new URL('../examples/snowpack/', import.meta.url).pathname);
+
+ const astroConfig = await loadConfig(new URL('../examples/snowpack', import.meta.url).pathname);
const logging = {
level: 'error',
dest: process.stderr,
};
- runtime = await createRuntime(astroConfig, logging);
+ try {
+ runtime = await createRuntime(astroConfig, logging);
+ } catch(err) {
+ console.error(err);
+ throw err;
+ }
});
SnowpackDev.after(async () => {
+ process.chdir(cwd);
await runtime && runtime.shutdown();
});