From 4bfde10f69051f81b3ee89686c689b2cb4d41c1e Mon Sep 17 00:00:00 2001 From: Alexander Krasnoyarov Date: Mon, 12 Oct 2020 14:53:27 +0300 Subject: [PATCH] tests: relative configs (#1927) --- test/config-lookup/relative/a.js | 1 + .../relative/basic-config.test.js | 22 +++++++++++++++++++ test/config-lookup/relative/webpack.config.js | 9 ++++++++ 3 files changed, 32 insertions(+) create mode 100644 test/config-lookup/relative/a.js create mode 100644 test/config-lookup/relative/basic-config.test.js create mode 100644 test/config-lookup/relative/webpack.config.js diff --git a/test/config-lookup/relative/a.js b/test/config-lookup/relative/a.js new file mode 100644 index 00000000000..735d820f253 --- /dev/null +++ b/test/config-lookup/relative/a.js @@ -0,0 +1 @@ +module.exports = 'a.js'; diff --git a/test/config-lookup/relative/basic-config.test.js b/test/config-lookup/relative/basic-config.test.js new file mode 100644 index 00000000000..ad568ba330d --- /dev/null +++ b/test/config-lookup/relative/basic-config.test.js @@ -0,0 +1,22 @@ +'use strict'; +const { existsSync } = require('fs'); +const { resolve } = require('path'); +const { run } = require('../../utils/test-utils'); + +describe('relative path to config', () => { + it('should work', () => { + const { stdout, stderr, exitCode } = run(__dirname, ['-c', 'webpack.config.js', '--output-path', './binary/a'], false); + expect(stderr).toBeFalsy(); + expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); + expect(existsSync(resolve(__dirname, './binary/a/a.bundle.js'))).toBeTruthy(); + }); + + it('should work #2', () => { + const { stdout, stderr, exitCode } = run(__dirname, ['-c', './webpack.config.js', '--output-path', './binary/b'], false); + expect(stderr).toBeFalsy(); + expect(stdout).toBeTruthy(); + expect(exitCode).toBe(0); + expect(existsSync(resolve(__dirname, './binary/b/a.bundle.js'))).toBeTruthy(); + }); +}); diff --git a/test/config-lookup/relative/webpack.config.js b/test/config-lookup/relative/webpack.config.js new file mode 100644 index 00000000000..b58f8a91f0d --- /dev/null +++ b/test/config-lookup/relative/webpack.config.js @@ -0,0 +1,9 @@ +const { resolve } = require('path'); + +module.exports = { + entry: './a.js', + output: { + path: resolve(__dirname, 'binary'), + filename: 'a.bundle.js', + }, +};