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

@@ -1,8 +1,9 @@
import polka from 'polka';
import * as sapper from '@sapper/server';
const { PORT } = process.env;
import { start } from '../../common.js';
polka()
.use(sapper.middleware())
.listen(PORT);
const app = polka()
.use(sapper.middleware());
start(app);

View File

@@ -7,10 +7,9 @@ describe('with-sourcemaps-webpack', function() {
this.timeout(10000);
// hooks
before(async () => {
await build({ cwd: __dirname, bundler: 'webpack' });
});
before('build app', () => build({ cwd: __dirname, bundler: 'webpack' }));
// tests
it('does not put sourcemap files in service worker shell', async () => {
const service_worker_source = fs.readFileSync(`${__dirname}/src/node_modules/@sapper/service-worker.js`, 'utf-8');
const shell_source = /shell = (\[[\s\S]+?\])/.exec(service_worker_source)[1];
@@ -23,4 +22,4 @@ describe('with-sourcemaps-webpack', function() {
const sourcemapFiles = fs.readdirSync(clientShellDir).filter(_ => _.endsWith('.map'));
assert.ok(sourcemapFiles.length > 0, 'sourcemap files exist');
});
});
});