Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: config tests #2939

Merged
merged 24 commits into from Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2ed5a3b
fix: absent config test
rishabh3112 Sep 8, 2021
a3189d3
chore: basic config description
rishabh3112 Sep 8, 2021
3c8f86d
chore: update default js config test
rishabh3112 Sep 9, 2021
17e74a9
chore: update dot webpack config test
rishabh3112 Sep 9, 2021
e7cb555
chore: update dot webpack webpackfile test
rishabh3112 Sep 13, 2021
83dc51e
chore: fix description of cjs config
rishabh3112 Sep 13, 2021
8491c7c
chore: rebase
rishabh3112 Sep 13, 2021
e9b603d
chore: update mjs config
rishabh3112 Sep 14, 2021
c1d4b2d
chore: default config with mode
rishabh3112 Sep 14, 2021
9a100e3
chore: fix empty test
rishabh3112 Sep 16, 2021
06f0cf9
chore: update empty array
rishabh3112 Sep 16, 2021
8b0d0f4
chore: update empty function descriptions
rishabh3112 Sep 16, 2021
8b94970
chore: update empty promise
rishabh3112 Sep 16, 2021
222f218
chore: update config array error
rishabh3112 Sep 16, 2021
82483ae
chore: update no config
rishabh3112 Sep 16, 2021
4396bd8
chore: update invalid path file
rishabh3112 Sep 18, 2021
ba0bc3d
chore: update config error test
rishabh3112 Sep 18, 2021
c8e63fc
chore: fix funtional config test
rishabh3112 Sep 18, 2021
e44fa0e
chore: invalid export
rishabh3112 Sep 18, 2021
135df61
chore: update multiple config test
rishabh3112 Sep 21, 2021
4fde8e5
chore: update config test
rishabh3112 Sep 21, 2021
a51361c
chore: update no code test
rishabh3112 Sep 21, 2021
21d60be
chore: update no config array test
rishabh3112 Sep 21, 2021
c3d0744
chore: update no config object test
rishabh3112 Sep 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/build/config/absent/config-absent.test.js
Expand Up @@ -3,8 +3,8 @@
const path = require("path");
const { run } = require("../../../utils/test-utils");

describe("Config:", () => {
it("supplied config file is absent", async () => {
describe("config flag with non existent file", () => {
it("should throw error with non-existent configuration file", async () => {
const { exitCode, stderr, stdout } = await run(__dirname, [
"-c",
path.resolve(__dirname, "webpack.config.js"),
Expand Down
9 changes: 0 additions & 9 deletions test/build/config/absent/webpack.config-absent.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/build/config/basic/basic-config.test.js
Expand Up @@ -4,7 +4,7 @@ const { resolve } = require("path");
const { run } = require("../../../utils/test-utils");

describe("basic config file", () => {
it("is able to understand and parse a very basic configuration file", async () => {
it("should build and not throw error with a basic configuration file", async () => {
const { exitCode, stderr, stdout } = await run(__dirname, [
"-c",
resolve(__dirname, "webpack.config.js"),
Expand Down
Expand Up @@ -2,8 +2,8 @@ const fs = require("fs");
const path = require("path");
const { run, isWebpack5 } = require("../../../../utils/test-utils");

describe("Zero Config", () => {
it("runs when config is present but not supplied via flag", async () => {
describe("default config", () => {
it("should build and not throw error when config is present but not supplied via flag", async () => {
const { exitCode, stderr, stdout } = await run(__dirname, []);

expect(exitCode).toEqual(0);
Expand Down
Expand Up @@ -2,8 +2,8 @@ const fs = require("fs");
const path = require("path");
const { run, isWebpack5 } = require("../../../../utils/test-utils");

describe("Default Config:", () => {
it("Should be able to pick cjs config by default", async () => {
describe("default config with cjs extention", () => {
it("should build and not throw error with cjs config by default", async () => {
const { exitCode, stderr, stdout } = await run(__dirname, []);

expect(exitCode).toEqual(0);
Expand Down
Expand Up @@ -3,8 +3,8 @@ const { existsSync } = require("fs");
const { resolve } = require("path");
const { run } = require("../../../../utils/test-utils");

describe("multiple dev config files with webpack.config.js", () => {
it("Uses webpack.config.development.js", async () => {
describe(".webpack webpackfile", () => {
it("should build and not throw with .webpack webpackfile", async () => {
const { stdout, stderr, exitCode } = await run(__dirname, []);
expect(exitCode).toEqual(0);
expect(stderr).toBeFalsy();
Expand Down
Expand Up @@ -3,8 +3,8 @@ const { existsSync } = require("fs");
const { resolve } = require("path");
const { run } = require("../../../../utils/test-utils");

describe("multiple config files", () => {
it("Uses dev config when both dev and none are present", async () => {
describe(".webpack configuration file", () => {
it("should build and not throw error when config is present in .webpack", async () => {
const { stdout, stderr, exitCode } = await run(__dirname, []);
expect(exitCode).toEqual(0);
expect(stderr).toBeFalsy();
Expand Down
Expand Up @@ -2,8 +2,8 @@ const fs = require("fs");
const path = require("path");
const { run, isWebpack5 } = require("../../../../utils/test-utils");

describe("Default Config:", () => {
it("Should be able to pick mjs config by default", async () => {
describe("default config with mjs extention", () => {
it("should build and not throw error with mjs config by default", async () => {
const { exitCode, stderr, stdout } = await run(__dirname, [], {
env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true },
});
Expand Down
Expand Up @@ -3,8 +3,8 @@ const { existsSync } = require("fs");
const { resolve } = require("path");
const { run } = require("../../../../utils/test-utils");

describe("multiple config files", () => {
it("Uses dev config when development mode is supplied", async () => {
describe("default config with mode from cli", () => {
it("should build and not throw error with development mode supplied", async () => {
const { stdout, stderr, exitCode } = await run(__dirname, ["--mode", "development"]);
expect(exitCode).toEqual(0);
expect(stderr).toBeFalsy();
Expand Down