Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 773702a

Browse files
test(url): Simplify URL test by using file URL (#26)
1 parent ba7a0a3 commit 773702a

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed
File renamed without changes.

test/url/url.test.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
const { promisify } = require('es6-promisify');
22
const rimrafAsync = promisify(require('rimraf'));
33
const path = require('path');
4-
const getPort = require('get-port');
5-
const serve = require('serve');
64
const { exec } = require('child-process-promise');
75
const dirContentsToObject = require('../_utils/dirContentsToObject');
86

97
const distPath = path.join(__dirname, 'dist');
10-
const servePath = path.join(__dirname, 'serve-me');
118

129
beforeEach(() => rimrafAsync(distPath));
1310

1411
test('url', async () => {
15-
const port = await getPort();
16-
const server = serve(servePath, { port, silent: true })
12+
const url = `file://${path.join(__dirname, 'index.html')}`;
1713

18-
await exec(`node ../../bin/cli --puppeteer-args="--no-sandbox --disable-setuid-sandbox" --out-dir dist --url http://localhost:${port}`, { cwd: __dirname });
19-
20-
server.stop();
14+
await exec(`node ../../bin/cli --puppeteer-args="--no-sandbox --disable-setuid-sandbox" --out-dir dist --url ${url}`, { cwd: __dirname });
2115

2216
const output = await dirContentsToObject(distPath);
2317
expect(output).toMatchSnapshot();

0 commit comments

Comments
 (0)