mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 11:15:14 +00:00
Harden tests (...a bit)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -7,10 +7,9 @@ describe('with-sourcemaps', function() {
|
||||
this.timeout(10000);
|
||||
|
||||
// hooks
|
||||
before(async () => {
|
||||
await build({ cwd: __dirname });
|
||||
});
|
||||
before('build app', () => build({ cwd: __dirname }));
|
||||
|
||||
// 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', function() {
|
||||
const sourcemapFiles = fs.readdirSync(clientShellDir).filter(_ => _.endsWith('.map'));
|
||||
assert.ok(sourcemapFiles.length > 0, 'sourcemap files exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user