Harden tests (...a bit)

This commit is contained in:
mrkishi
2019-05-08 00:57:59 -03:00
parent 8bdd363a19
commit e6c1a54164
35 changed files with 726 additions and 685 deletions

View File

@@ -2,14 +2,12 @@ import sirv from 'sirv';
import polka from 'polka';
import * as sapper from '@sapper/server';
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';
import { start, dev } from '../../common.js';
polka()
const app = polka()
.use(
sirv('static', { dev }),
sapper.middleware()
)
.listen(PORT, err => {
if (err) console.log('error', err);
});
);
start(app);

View File

@@ -6,14 +6,12 @@ describe('export-webpack', function() {
this.timeout(10000);
// hooks
before(async () => {
await api.build({ cwd: __dirname, bundler: 'webpack' });
await api.export({ cwd: __dirname, bundler: 'webpack' });
});
before('build app', () => api.build({ cwd: __dirname, bundler: 'webpack' }));
before('export app', () => api.export({ cwd: __dirname }));
// tests
it('injects <link rel=preload> tags', () => {
const index = fs.readFileSync(`${__dirname}/__sapper__/export/index.html`, 'utf8');
assert.ok(/rel=preload/.test(index));
});
});