diff --git a/test/ExternalPathsWatch.test.js b/test/ExternalPathsWatch.test.js deleted file mode 100644 index aebab79a35..0000000000 --- a/test/ExternalPathsWatch.test.js +++ /dev/null @@ -1,91 +0,0 @@ -'use strict'; - -/* eslint-disable - no-unused-vars -*/ -const path = require('path'); -const webpack = require('webpack'); -const Server = require('../lib/Server'); -const config = require('./fixtures/simple-config/webpack.config'); - -const contentBasePublic = path.join( - __dirname, - 'fixtures/contentbase-config/public' -); -const contentBaseOther = path.join( - __dirname, - 'fixtures/contentbase-config/other' -); -const compiler = webpack(config); - -describe('Watching external files', () => { - let server; - - describe('testing single & multiple external paths', () => { - it('Should throw exception (single line)', (done) => { - try { - // eslint-disable-next-line no-unused-vars - server = new Server(compiler, { - contentBase: 'https://example.com/', - watchContentBase: true, - }); - - expect(true).toBe(false); - } catch (e) { - expect(e.message).toBe('Watching remote files is not supported.'); - compiler.run(() => { - done(); - }); - } - }); - it('Should throw exception (array)', (done) => { - try { - // eslint-disable-next-line no-unused-vars - server = new Server(compiler, { - contentBase: [contentBasePublic, 'https://example.com/'], - watchContentBase: true, - }); - - expect(true).toBe(false); - } catch (e) { - expect(e.message).toBe('Watching remote files is not supported.'); - compiler.run(() => { - done(); - }); - } - }); - }); - - describe('testing single & multiple internal paths', () => { - it('Should not throw exception (single line)', (done) => { - try { - // eslint-disable-next-line no-unused-vars - server = new Server(compiler, { - contentBase: contentBasePublic, - watchContentBase: true, - }); - - compiler.run(() => { - done(); - }); - } catch (e) { - expect(true).toBe(false); - } - }); - it('Should not throw exception (array)', (done) => { - try { - // eslint-disable-next-line no-unused-vars - server = new Server(compiler, { - contentBase: [contentBasePublic, contentBaseOther], - watchContentBase: true, - }); - - compiler.run(() => { - done(); - }); - } catch (e) { - expect(true).toBe(false); - } - }); - }); -}); diff --git a/test/server/contentBase-option.test.js b/test/server/contentBase-option.test.js index baa4111124..3582251987 100644 --- a/test/server/contentBase-option.test.js +++ b/test/server/contentBase-option.test.js @@ -267,6 +267,44 @@ describe('contentBase option', () => { }); }); + describe('testing single & multiple external paths', () => { + afterAll((done) => { + testServer.close(() => { + done(); + }); + }); + it('Should throw exception (string)', (done) => { + try { + // eslint-disable-next-line no-unused-vars + server = testServer.start(config, { + port: 9004, + contentBase: 'https://example.com/', + watchContentBase: true, + }); + + expect(true).toBe(false); + } catch (e) { + expect(e.message).toBe('Watching remote files is not supported.'); + done(); + } + }); + it('Should throw exception (array)', (done) => { + try { + // eslint-disable-next-line no-unused-vars + server = testServer.start(config, { + port: 9003, + contentBase: [contentBasePublic, 'https://example.com/'], + watchContentBase: true, + }); + + expect(true).toBe(false); + } catch (e) { + expect(e.message).toBe('Watching remote files is not supported.'); + done(); + } + }); + }); + describe('default to PWD', () => { beforeAll((done) => { jest.spyOn(process, 'cwd').mockImplementation(() => contentBasePublic);