diff --git a/test/apps/with-sourcemaps-webpack/test.ts b/test/apps/with-sourcemaps-webpack/test.ts index cb0a3ca..802fa05 100644 --- a/test/apps/with-sourcemaps-webpack/test.ts +++ b/test/apps/with-sourcemaps-webpack/test.ts @@ -1,34 +1,20 @@ -import * as puppeteer from 'puppeteer'; import { build } from '../../../api'; import * as assert from "assert"; -import { AppRunner } from '../AppRunner'; -import * as fs from "fs"; +import * as fs from 'fs'; import * as path from "path"; -describe('with-sourcemaps-webpack', function() { +describe('with-sourcemaps', function() { this.timeout(10000); - let runner: AppRunner; - let page: puppeteer.Page; - let base: string; - - // helpers - let start: () => Promise; - let prefetchRoutes: () => Promise; - let prefetch: (href: string) => Promise; - let goto: (href: string) => Promise; - // hooks before(async () => { await build({ cwd: __dirname, bundler: 'webpack' }); - - runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); - ({ base, page, start, prefetchRoutes, prefetch, goto } = await runner.start()); }); it('does not put sourcemap files in service worker shell', async () => { - const serviceWorker = await import(`${__dirname}/__sapper__/service-worker.js`); - const shell: string[] = serviceWorker.shell; + 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]; + const shell = JSON.parse(shell_source); assert.equal(shell.filter(_ => _.endsWith('.map')).length, 0, 'sourcemap files are not cached in SW'); @@ -37,7 +23,4 @@ describe('with-sourcemaps-webpack', function() { const sourcemapFiles = fs.readdirSync(clientShellDir).filter(_ => _.endsWith('.map')); assert.ok(sourcemapFiles.length > 0, 'sourcemap files exist'); }); - - after(() => runner.end()); - }); \ No newline at end of file