diff --git a/packages/cli/tests/config.test.js b/packages/cli/tests/config.test.js deleted file mode 100644 index 89d16ca9c..000000000 --- a/packages/cli/tests/config.test.js +++ /dev/null @@ -1,73 +0,0 @@ -const { build } = require('./lib/cli'); -const { subject } = require('./lib/output'); - -const formats = ['cjs', 'esm']; - -const prerenderUrlFiles = [ - 'array.js', - 'stringified-array.js', - 'function-returning-array.js', - 'function-returning-stringified-array.js', -]; - -const preactConfigFiles = ['function.js', 'object.js']; - -describe('config files', () => { - describe('prerender-urls', () => { - it(`should load the 'prerender-urls.json' file`, async () => { - let dir = await subject('multiple-config-files'); - - const logSpy = jest.spyOn(process.stdout, 'write'); - - await build(dir); - - expect(logSpy).not.toHaveBeenCalledWith( - expect.stringContaining( - 'Failed to load prerenderUrls file, using default!' - ) - ); - }); - - formats.forEach(moduleFormat => { - prerenderUrlFiles.forEach(dataFormat => { - it(`should load the '${dataFormat}' file in ${moduleFormat}`, async () => { - let dir = await subject('multiple-config-files'); - - const logSpy = jest.spyOn(process.stdout, 'write'); - - await build(dir, { - prerenderUrls: `prerenderUrls/${moduleFormat}/${dataFormat}`, - }); - - expect(logSpy).not.toHaveBeenCalledWith( - expect.stringContaining( - 'Failed to load prerenderUrls file, using default!' - ) - ); - }); - }); - }); - }); - - describe('preact.config', () => { - formats.forEach(moduleFormat => { - preactConfigFiles.forEach(dataFormat => { - it(`should load the '${dataFormat}' file in ${moduleFormat}`, async () => { - let dir = await subject('multiple-config-files'); - - const logSpy = jest.spyOn(process.stdout, 'write'); - - await build(dir, { - config: `preactConfig/${moduleFormat}/${dataFormat}`, - }); - - expect(logSpy).not.toHaveBeenCalledWith( - expect.stringContaining( - 'Failed to load preact-cli config file, using default!' - ) - ); - }); - }); - }); - }); -}); diff --git a/packages/cli/tests/subjects/multiple-config-files/index.js b/packages/cli/tests/subjects/multiple-config-files/index.js deleted file mode 100644 index 60c988215..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import { h, Component } from 'preact'; -import { Router } from 'preact-router'; -import Home from './routes/home'; - -export default class App extends Component { - handleRoute = e => { - this.currentUrl = e.url; - }; - - render(props) { - return ( -
- - - -
- ); - } -} diff --git a/packages/cli/tests/subjects/multiple-config-files/package.json b/packages/cli/tests/subjects/multiple-config-files/package.json deleted file mode 100644 index 8ad97483e..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "private": true, - "name": "preact-config" -} diff --git a/packages/cli/tests/subjects/multiple-config-files/preactConfig/cjs/function.js b/packages/cli/tests/subjects/multiple-config-files/preactConfig/cjs/function.js deleted file mode 100644 index ea41b01de..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/preactConfig/cjs/function.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = function () {}; diff --git a/packages/cli/tests/subjects/multiple-config-files/preactConfig/cjs/object.js b/packages/cli/tests/subjects/multiple-config-files/preactConfig/cjs/object.js deleted file mode 100644 index 631340227..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/preactConfig/cjs/object.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - webpack() {}, -}; diff --git a/packages/cli/tests/subjects/multiple-config-files/preactConfig/esm/function.js b/packages/cli/tests/subjects/multiple-config-files/preactConfig/esm/function.js deleted file mode 100644 index ea9b101e1..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/preactConfig/esm/function.js +++ /dev/null @@ -1 +0,0 @@ -export default function () {} diff --git a/packages/cli/tests/subjects/multiple-config-files/preactConfig/esm/object.js b/packages/cli/tests/subjects/multiple-config-files/preactConfig/esm/object.js deleted file mode 100644 index 1a50d5c1e..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/preactConfig/esm/object.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - webpack() {}, -}; diff --git a/packages/cli/tests/subjects/multiple-config-files/prerender-urls.json b/packages/cli/tests/subjects/multiple-config-files/prerender-urls.json deleted file mode 100644 index ac0b36d55..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerender-urls.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "url": "/" - }, - { - "url": "/custom" - } -] diff --git a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/array.js b/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/array.js deleted file mode 100644 index 1184799d9..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/array.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = [ - { - url: '/', - }, - { - url: '/custom', - }, -]; diff --git a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/function-returning-array.js b/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/function-returning-array.js deleted file mode 100644 index 447581cd3..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/function-returning-array.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = () => [ - { - url: '/', - }, - { - url: '/custom', - }, -]; diff --git a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/function-returning-stringified-array.js b/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/function-returning-stringified-array.js deleted file mode 100644 index 04c5273c2..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/function-returning-stringified-array.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = () => `[ - { - "url": "/" - }, - { - "url": "/custom" - } -]`; diff --git a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/stringified-array.js b/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/stringified-array.js deleted file mode 100644 index 734c9b2d0..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/cjs/stringified-array.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = `[ - { - "url": "/" - }, - { - "url": "/custom" - } -]`; diff --git a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/array.js b/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/array.js deleted file mode 100644 index cbde561f9..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/array.js +++ /dev/null @@ -1,8 +0,0 @@ -export default [ - { - url: '/', - }, - { - url: '/custom', - }, -]; diff --git a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/function-returning-array.js b/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/function-returning-array.js deleted file mode 100644 index e9ea08217..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/function-returning-array.js +++ /dev/null @@ -1,8 +0,0 @@ -export default () => [ - { - url: '/', - }, - { - url: '/custom', - }, -]; diff --git a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/function-returning-stringified-array.js b/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/function-returning-stringified-array.js deleted file mode 100644 index d2c0a3ad9..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/function-returning-stringified-array.js +++ /dev/null @@ -1,8 +0,0 @@ -export default () => `[ - { - "url": "/" - }, - { - "url": "/custom" - } -]`; diff --git a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/stringified-array.js b/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/stringified-array.js deleted file mode 100644 index 8cca562b0..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/prerenderUrls/esm/stringified-array.js +++ /dev/null @@ -1,8 +0,0 @@ -export default `[ - { - "url": "/" - }, - { - "url": "/custom" - } -]`; diff --git a/packages/cli/tests/subjects/multiple-config-files/routes/home.css b/packages/cli/tests/subjects/multiple-config-files/routes/home.css deleted file mode 100644 index 9e3a76d5d..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/routes/home.css +++ /dev/null @@ -1,3 +0,0 @@ -.home { - background: red; -} diff --git a/packages/cli/tests/subjects/multiple-config-files/routes/home.js b/packages/cli/tests/subjects/multiple-config-files/routes/home.js deleted file mode 100644 index f38ef07ae..000000000 --- a/packages/cli/tests/subjects/multiple-config-files/routes/home.js +++ /dev/null @@ -1,3 +0,0 @@ -import './home.css'; - -export default () =>
Home
;