Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Aug 4, 2021
1 parent da70bf0 commit 27f9972
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/adapter-static/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { run } from './utils.js';

run('prerendered', (test) => {
test('generates HTML files', ({ cwd }) => {
assert.ok(fs.existsSync(`${cwd}/build/index.html`));
assert.ok(fs.existsSync(`${cwd}/.svelte-kit/static/build/index.html`));
});

test('prerenders content', async ({ base, page }) => {
Expand All @@ -15,15 +15,15 @@ run('prerendered', (test) => {

run('spa', (test) => {
test('generates a fallback page', ({ cwd }) => {
assert.ok(fs.existsSync(`${cwd}/build/200.html`));
assert.ok(fs.existsSync(`${cwd}/.svelte-kit/static/build/200.html`));
});

test('does not prerender pages without prerender=true', ({ cwd }) => {
assert.ok(!fs.existsSync(`${cwd}/build/index.html`));
assert.ok(!fs.existsSync(`${cwd}/.svelte-kit/static/build/index.html`));
});

test('prerenders page with prerender=true', ({ cwd }) => {
assert.ok(fs.existsSync(`${cwd}/build/about/index.html`));
assert.ok(fs.existsSync(`${cwd}/.svelte-kit/static/build/about/index.html`));
});

test('renders content in fallback page when JS runs', async ({ base, page }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-static/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function run(app, callback) {
const cwd = fileURLToPath(new URL(`apps/${app}`, import.meta.url));
const cli_path = fileURLToPath(new URL('../../kit/src/cli.js', import.meta.url));

rimraf(`${cwd}/build`);
rimraf(`${cwd}/.svelte-kit/static/build`);

await spawn(`"${process.execPath}" ${cli_path} build`, {
cwd,
Expand All @@ -41,7 +41,7 @@ export function run(app, callback) {

context.cwd = cwd;
context.port = await ports.find(4000);
const handler = sirv(`${cwd}/build`, {
const handler = sirv(`${cwd}/.svelte-kit/static/build`, {
single: '200.html'
});
context.server = await create_server(context.port, handler);
Expand Down

0 comments on commit 27f9972

Please sign in to comment.