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

[NEXT] fix: changed the islocalPath conditions to more effective #999

Closed
wants to merge 2 commits into from
Closed

[NEXT] fix: changed the islocalPath conditions to more effective #999

wants to merge 2 commits into from

Conversation

anikethsaha
Copy link
Member

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?
Yes #984

If relevant, did you update the documentation?
NA

Summary
The current conditions in the islocalPath method are not so effective because of two reason

  • the regex /^\./.test(str) is checking for the string format whether its starting with . or. It will produce the wrong output if any wrong path is passed with correct path format eg - ../not-A-Valid-Path will be true so the method will return true -- need to remove it (removing seems fair than adding more regex char)
  • same for isAbsolute it wont check for a valid path but for a format of the string. it can be added with existsSync using and condition

Does this PR introduce a breaking change?
May be not sure

Other information
tests in #984 will pass if with respect to this changes

@webpack-bot
Copy link

@anikethsaha Please review the following output log for errors:

Worker information [...]
Build system information [...]
docker stop/waiting [...]
resolvconf stop/waiting [...]


Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions

Setting environment variables from repository settings
$ export nproc=4

Setting environment variables from .travis.yml
$ export JOB_PART=integration


Setting up build cache [...]
 [...]
$ node --version
v8.16.0
$ npm --version
6.4.1
$ nvm --version
0.34.0

$ npm run travis:lint

> [email protected] travis:lint /home/travis/build/webpack/webpack-cli
> npm run build && npm run lint


> [email protected] build /home/travis/build/webpack/webpack-cli
> tsc

error TS5055: Cannot write file '/home/travis/build/webpack/webpack-cli/packages/generators/utils/optionsSchema.json' because it would overwrite input file.



The command "npm run travis:lint" exited with 1.

$ npm run test:ci

> [email protected] test:ci /home/travis/build/webpack/webpack-cli
> nyc jest --maxWorkers=$(nproc) --reporters=default --reporters=jest-junit

 PASS  test/test-utils.test.js
 FAIL  test/binCases/help/help-output/help-output.test.js
  ● help-output

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

       6 | 	const { code, stdout, stderr } = run(__dirname, ["--help"]);
       7 | 
    >  8 | 	expect(code).toBe(0);
         | 	             ^
       9 | 
      10 | 	const summary = extractSummary(stdout);
      11 | 

      at Object.<anonymous>.test (test/binCases/help/help-output/help-output.test.js:8:15)

 FAIL  test/binCases/output/output-library-many/output-library-many.test.js
  ● output-library-many

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      21 | 	const summary = extractSummary(stdout);
      22 | 
    > 23 | 	expect(code).toBe(0);
         | 	             ^
      24 | 	expect(summary).toEqual(expect.anything());
      25 | 	expect(summary).toContain("index.js");
      26 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/output/output-library-many/output-library-many.test.js:23:15)

 FAIL  test/binCases/env/complex/comple.test.js
  ● complex

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      22 | 	const summary = extractSummary(stdout);
      23 | 
    > 24 | 	expect(code).toBe(0);
         | 	             ^
      25 | 	expect(summary).toEqual(expect.anything());
      26 | 	expect(summary).toContain("Environment (--env):");
      27 | 	expect(summary).toContain("baz");

      at Object.<anonymous>.test (test/binCases/env/complex/comple.test.js:24:15)

 FAIL  test/binCases/entry/named-entry/named-entry.test.js
  ● named-entry

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      23 | 	const summary = extractSummary(stdout);
      24 | 
    > 25 | 	expect(code).toBe(0);
         | 	             ^
      26 | 	expect(summary).toEqual(expect.anything());
      27 | 	expect(summary).toContain("foo.js"); // named entry from --entry foo=./a.js
      28 | 	expect(summary).toContain("null.js");

      at Object.<anonymous>.test (test/binCases/entry/named-entry/named-entry.test.js:25:15)

 FAIL  test/binCases/module/module-bind/module-bind.test.js
  ● module-bind

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      20 | 		"post=./post-loader"
      21 | 	]);
    > 22 | 	expect(code).toBe(0);
         | 	             ^
      23 | 
      24 | 	const summary = extractSummary(stdout);
      25 | 

      at Object.<anonymous>.test (test/binCases/module/module-bind/module-bind.test.js:22:15)

 FAIL  test/binCases/output/output-library-single/output-library-single.test.js
  ● output-library-single

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      19 | 	const summary = extractSummary(stdout);
      20 | 
    > 21 | 	expect(code).toBe(0);
         | 	             ^
      22 | 	expect(summary).toEqual(expect.anything());
      23 | 	expect(summary).toContain("index.js");
      24 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/output/output-library-single/output-library-single.test.js:21:15)

 FAIL  test/binCases/stats/single-config/single-config.test.js
  ● single-config

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      12 | 	const summary = extractSummary(stdout);
      13 | 
    > 14 | 	expect(code).toBe(0);
         | 	             ^
      15 | 	expect(summary).toContain("");
      16 | 	expect(summary).toContain("main.js");
      17 | 	expect(summary).toContain("chunk");

      at Object.<anonymous>.done (test/binCases/stats/single-config/single-config.test.js:14:15)

 FAIL  test/binCases/entry/non-hyphenated-args/non-hyphenated-args.test.js
  ● non-hyphenated-args

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      18 | 	const summary = extractSummary(stdout);
      19 | 
    > 20 | 	expect(code).toBe(0);
         | 	             ^
      21 | 	expect(summary).toEqual(expect.anything());
      22 | 	expect(summary).toContain("main.js"); // non-hyphenated arg ./a.js should create chunk "main"
      23 | 	expect(summary).toContain("a.js"); // a.js should be in chunk 0

      at Object.<anonymous>.test (test/binCases/entry/non-hyphenated-args/non-hyphenated-args.test.js:20:15)

 FAIL  test/binCases/entry/multi-file/multi-file.test.js
  ● multi-file

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      21 | 	const summary = extractSummary(stdout);
      22 | 
    > 23 | 	expect(code).toBe(0);
         | 	             ^
      24 | 	expect(summary).toEqual(expect.anything());
      25 | 	expect(summary).toContain("null.js");
      26 | 	expect(summary).toContain("index.js");

      at Object.<anonymous>.test (test/binCases/entry/multi-file/multi-file.test.js:23:15)

 FAIL  test/binCases/config-name/found-many/found-many.test.js
  ● found-many

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      21 | 	const summary = extractSummary(stdout);
      22 | 
    > 23 | 	expect(code).toBe(0);
         | 	             ^
      24 | 	expect(summary).toEqual(expect.anything());
      25 | 	expect(summary).toContain("./index2.js");
      26 | 	expect(summary).toContain("./index3.js");

      at Object.<anonymous>.test (test/binCases/config-name/found-many/found-many.test.js:23:15)

 FAIL  test/binCases/configFile/plugins-precedence/plugins-precedence.test.js
  ● plugins-precedence

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      22 | 	const summary = extractSummary(stdout);
      23 | 
    > 24 | 	expect(code).toBe(0);
         | 	             ^
      25 | 	expect(summary).toEqual(expect.anything());
      26 | 	expect(summary).toContain("ok.js");
      27 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/configFile/plugins-precedence/plugins-precedence.test.js:24:15)

 FAIL  test/binCases/config-type/array/array.test.js
  ● array

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      15 | 	const summary = extractSummary(stdout);
      16 | 
    > 17 | 	expect(code).toBe(0);
         | 	             ^
      18 | 	expect(summary).toEqual(expect.anything());
      19 | 	expect(summary).toContain("Child");
      20 | 	expect(summary).toContain("entry-a.bundle.js");

      at Object.<anonymous>.test (test/binCases/config-type/array/array.test.js:17:15)

 FAIL  test/binCases/env/string/string.test.js
  ● string

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      21 | 	const summary = extractSummary(stdout);
      22 | 
    > 23 | 	expect(code).toBe(0);
         | 	             ^
      24 | 	expect(summary).toEqual(expect.anything());
      25 | 	expect(summary).toContain("Environment (--env)");
      26 | 	expect(summary).toContain("null.js");

      at Object.<anonymous>.test (test/binCases/env/string/string.test.js:23:15)

 FAIL  test/binCases/entry/cli-override/cli-override.test.js
  ● cli-override

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      17 | 	const summary = extractSummary(stdout);
      18 | 
    > 19 | 	expect(code).toBe(0);
         | 	             ^
      20 | 	expect(summary).toEqual(expect.anything());
      21 | 	expect(summary).toContain("cliEntry.js");
      22 | 	expect(summary).toContain("index.js");

      at Object.<anonymous>.test (test/binCases/entry/cli-override/cli-override.test.js:19:15)

 FAIL  test/binCases/config-name/found-one/found-one.test.js
  ● found-one

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      19 | 	const summary = extractSummary(stdout);
      20 | 
    > 21 | 	expect(code).toBe(0);
         | 	             ^
      22 | 	expect(summary).toEqual(expect.anything());
      23 | 	expect(summary).toContain("./index2.js");
      24 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/config-name/found-one/found-one.test.js:21:15)

 FAIL  test/binCases/errors/info-verbosity/info-verbosity.test.js
  ● info-verbosity

    expect(string).toContain(value)

    Expected string:
      "✖ 「webpack」: Promise rejection: UNKNOWN_OPTION: Unknown option: --output-filename
    ✖ 「webpack」: UNKNOWN_OPTION: Unknown option: --output-filename
        at commandLineArgs (/home/travis/build/webpack/webpack-cli/node_modules/command-line-args/dist/index.js:1347:21)
        at runCLI (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:4806)
        at /home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5778
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5806)
        at Module._compile (/home/travis/build/webpack/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
        at Module.replacementCompile (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:58:13)
        at Module._extensions..js (module.js:664:10)
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:62:4)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
    "
    To contain value:
      "Invalid values:"

      17 | 	]);
      18 | 
    > 19 | 	expect(stderr).toContain("Invalid values:");
         | 	               ^
      20 | 	// eslint-disable-next-line quotes
      21 | 	expect(stderr).toContain('Argument: info-verbosity, Given: "false", Choices: "none", "info", "verbose"');
      22 | 	// snapshot not needed

      at Object.<anonymous>.test (test/binCases/errors/info-verbosity/info-verbosity.test.js:19:17)

 FAIL  test/binCases/errors/clean-webpack-options/clean-webpack-options.test.js
  ● clean-webpack-options

    expect(string).toContain(value)

    Expected string:
      "✖ 「webpack」: Promise rejection: UNKNOWN_OPTION: Unknown option: --output-path
    ✖ 「webpack」: UNKNOWN_OPTION: Unknown option: --output-path
        at commandLineArgs (/home/travis/build/webpack/webpack-cli/node_modules/command-line-args/dist/index.js:1347:21)
        at runCLI (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:4806)
        at /home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5778
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5806)
        at Module._compile (/home/travis/build/webpack/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
        at Module.replacementCompile (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:58:13)
        at Module._extensions..js (module.js:664:10)
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:62:4)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
    "
    To contain value:
      "Invalid configuration object."

      12 | 	expect(summary).toHaveLength(0);
      13 | 
    > 14 | 	expect(stderr).toContain("Invalid configuration object.");
         | 	               ^
      15 | 	expect(stderr).toContain("configuration.context should be a string");
      16 | 	expect(stderr).toContain("The base directory ");
      17 | 

      at Object.<anonymous>.test (test/binCases/errors/clean-webpack-options/clean-webpack-options.test.js:14:17)

 FAIL  test/binCases/errors/parse/parse.test.js
  ● info-verbosity

    expect(received).toBe(expected) // Object.is equality

    Expected: 2
    Received: 1

       8 | 	const summary = extractSummary(stdout);
       9 | 
    > 10 | 	expect(code).toBe(2);
         | 	             ^
      11 | 	expect(summary).toContain("./index.js");
      12 | 	expect(summary).toContain("[built]");
      13 | 	expect(summary).toContain("[failed]");

      at Object.<anonymous>.test (test/binCases/errors/parse/parse.test.js:10:15)

 FAIL  test/binCases/config-location/set-explicitly/set-explicitly.test.js
  ● set-explicitly

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      16 | 		"async-node"
      17 | 	]);
    > 18 | 	expect(code).toBe(0);
         | 	             ^
      19 | 	expect(stdout).toEqual(expect.anything());
      20 | 	expect(stdout).toContain("./index.js");
      21 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/config-location/set-explicitly/set-explicitly.test.js:18:15)

 FAIL  test/binCases/config-type/invalid-array/invalid-array.test.js
  ● invalid-array

    expect(string).toContain(value)

    Expected string:
      "✖ 「webpack」: Promise rejection: UNKNOWN_OPTION: Unknown option: --mode
    ✖ 「webpack」: UNKNOWN_OPTION: Unknown option: --mode
        at commandLineArgs (/home/travis/build/webpack/webpack-cli/node_modules/command-line-args/dist/index.js:1347:21)
        at runCLI (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:4806)
        at /home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5778
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5806)
        at Module._compile (/home/travis/build/webpack/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
        at Module.replacementCompile (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:58:13)
        at Module._extensions..js (module.js:664:10)
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:62:4)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
    "
    To contain value:
      "Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema."

      15 | 	expect(code).not.toBe(0);
      16 | 	expect(stderr).toEqual(expect.anything());
    > 17 | 	expect(stderr).toContain(
         | 	               ^
      18 | 		"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema."
      19 | 	);
      20 | });

      at Object.<anonymous>.test (test/binCases/config-type/invalid-array/invalid-array.test.js:17:17)

 FAIL  test/binCases/config-type/invalid-type/invalid-type.test.js
  ● invalid-type

    expect(string).toContain(value)

    Expected string:
      "✖ 「webpack」: Promise rejection: UNKNOWN_OPTION: Unknown option: --mode
    ✖ 「webpack」: UNKNOWN_OPTION: Unknown option: --mode
        at commandLineArgs (/home/travis/build/webpack/webpack-cli/node_modules/command-line-args/dist/index.js:1347:21)
        at runCLI (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:4806)
        at /home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5778
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5806)
        at Module._compile (/home/travis/build/webpack/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
        at Module.replacementCompile (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:58:13)
        at Module._extensions..js (module.js:664:10)
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:62:4)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
    "
    To contain value:
      "Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema."

      15 | 	expect(code).not.toBe(0);
      16 | 	expect(stderr).toEqual(expect.anything());
    > 17 | 	expect(stderr).toContain(
         | 	               ^
      18 | 		"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema."
      19 | 	);
      20 | });

      at Object.<anonymous>.test (test/binCases/config-type/invalid-type/invalid-type.test.js:17:17)

 FAIL  test/binCases/config-location/webpackfile-config/packages/foo/webpackfile-config.test.js
  ● find-recursively

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      12 | 		"async-node"
      13 | 	]);
    > 14 | 	expect(code).toBe(0);
         | 	             ^
      15 | 	expect(stdout).toEqual(expect.anything());
      16 | 	expect(stdout).toContain("/index1.js");
      17 | 	expect(stdout).not.toContain("/index2.js");

      at Object.<anonymous>.test (test/binCases/config-location/webpackfile-config/packages/foo/webpackfile-config.test.js:14:15)

 FAIL  test/binCases/stats/custom-preset/custom-preset.test.js
  ● custom-preset

    expect(received).toHaveLength(length)

    Expected value to have length:
      0
    Received:
      "✖ 「webpack」: Promise rejection: UNKNOWN_OPTION: Unknown option: --output-filename
    ✖ 「webpack」: UNKNOWN_OPTION: Unknown option: --output-filename
        at commandLineArgs (/home/travis/build/webpack/webpack-cli/node_modules/command-line-args/dist/index.js:1347:21)
        at runCLI (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:4806)
        at /home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5778
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5806)
        at Module._compile (/home/travis/build/webpack/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
        at Module.replacementCompile (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:58:13)
        at Module._extensions..js (module.js:664:10)
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:62:4)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
    "
    received.length:
      1014

      18 | 	const summary = extractSummary(stdout);
      19 | 
    > 20 | 	expect(stderr).toHaveLength(0);
         | 	               ^
      21 | 	expect(code).toBe(0);
      22 | 	expect(summary).toHaveLength(0);
      23 | });

      at Object.<anonymous>.test (test/binCases/stats/custom-preset/custom-preset.test.js:20:17)

 FAIL  test/binCases/config-type/function-promise/function-promise.test.js
  ● function-promise

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      15 | 	const summary = extractSummary(stdout);
      16 | 
    > 17 | 	expect(code).toBe(0);
         | 	             ^
      18 | 	expect(summary).toEqual(expect.anything());
      19 | 	expect(summary).toContain("entry.bundle.js");
      20 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/config-type/function-promise/function-promise.test.js:17:15)

 FAIL  test/binCases/output/output-argument/output-argument.test.js
  ● output-argument

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      14 | 	const summary = extractSummary(stdout);
      15 | 
    > 16 | 	expect(code).toBe(0);
         | 	             ^
      17 | 	expect(summary).toEqual(expect.anything());
      18 | 	expect(summary).toContain("bundle.js");
      19 | 	expect(summary).toContain("index.js");

      at Object.<anonymous>.test (test/binCases/output/output-argument/output-argument.test.js:16:15)

 FAIL  test/binCases/config-type/function/function.test.js
  ● function

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      15 | 	const summary = extractSummary(stdout);
      16 | 
    > 17 | 	expect(code).toBe(0);
         | 	             ^
      18 | 	expect(summary).toEqual(expect.anything());
      19 | 	expect(summary).toContain("entry.bundle.js");
      20 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/config-type/function/function.test.js:17:15)

 FAIL  test/binCases/config-type/object/object.test.js
  ● object

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      15 | 	const summary = extractSummary(stdout);
      16 | 
    > 17 | 	expect(code).toBe(0);
         | 	             ^
      18 | 	expect(summary).toEqual(expect.anything());
      19 | 	expect(summary).toContain("entry.bundle.js");
      20 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/config-type/object/object.test.js:17:15)

 FAIL  test/binCases/config-type/promise/promise.test.js
  ● promise

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      15 | 	const summary = extractSummary(stdout);
      16 | 
    > 17 | 	expect(code).toBe(0);
         | 	             ^
      18 | 	expect(summary).toEqual(expect.anything());
      19 | 	expect(summary).toContain("entry.bundle.js");
      20 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/config-type/promise/promise.test.js:17:15)

 FAIL  test/binCases/mode/none/none.test.js
  ● none

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

       6 | 	const { code, stdout, stderr } = run(__dirname, ["./index.js", "--mode", "none"]);
       7 | 
    >  8 | 	expect(code).toBe(0);
         | 	             ^
       9 | 
      10 | 	const summary = extractSummary(stdout);
      11 | 

      at Object.<anonymous>.test (test/binCases/mode/none/none.test.js:8:15)

 FAIL  test/binCases/config-location/find-recursively/packages/foo/find-recursively.test.js
  ● find-recursively

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      12 | 		"async-node"
      13 | 	]);
    > 14 | 	expect(code).toBe(0);
         | 	             ^
      15 | 	expect(stdout).toEqual(expect.anything());
      16 | 	expect(stdout).toContain("/index2.js");
      17 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/config-location/find-recursively/packages/foo/find-recursively.test.js:14:15)

 FAIL  test/binCases/config-location/set-implicitly/set-implicitly.test.js
  ● set-implicitly

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      12 | 		"async-node"
      13 | 	]);
    > 14 | 	expect(code).toBe(0);
         | 	             ^
      15 | 	expect(stdout).toEqual(expect.anything());
      16 | 	expect(stdout).toContain("./index2.js");
      17 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/config-location/set-implicitly/set-implicitly.test.js:14:15)

 FAIL  test/binCases/no-options/production/production.test.js
  ● production

    expect(received).toBe(expected) // Object.is equality

    Expected: 2
    Received: 1

       5 | test("production", () => {
       6 | 	const { code, stdout, stderr } = run(__dirname, ["--mode", "production"]);
    >  7 | 	expect(code).toBe(2);
         | 	             ^
       8 | 	expect(stdout).toEqual(expect.anything());
       9 | 	expect(stderr).toContain("Insufficient number of arguments or no entry found.");
      10 | 	expect(stderr).toContain("Alternatively, run 'webpack(-cli) --help' for usage info.");

      at Object.<anonymous>.test (test/binCases/no-options/production/production.test.js:7:15)

 FAIL  test/binCases/stats/build-delimiter/build-delimiter.test.js
  ● build-delimiter

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      15 | 	const summary = extractSummary(stdout);
      16 | 
    > 17 | 	expect(code).toBe(0);
         | 	             ^
      18 | 	expect(summary).toContain("success");
      19 | 	expect(stderr).toHaveLength(0);
      20 | });

      at Object.<anonymous>.test (test/binCases/stats/build-delimiter/build-delimiter.test.js:17:15)

 FAIL  test/binCases/config-name/not-found/not-found.test.js
  ● not-found

    expect(string).toContain(value)

    Expected string:
      "✖ 「webpack」: Promise rejection: UNKNOWN_OPTION: Unknown option: --config-name
    ✖ 「webpack」: UNKNOWN_OPTION: Unknown option: --config-name
        at commandLineArgs (/home/travis/build/webpack/webpack-cli/node_modules/command-line-args/dist/index.js:1347:21)
        at runCLI (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:4806)
        at /home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5778
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5806)
        at Module._compile (/home/travis/build/webpack/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
        at Module.replacementCompile (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:58:13)
        at Module._extensions..js (module.js:664:10)
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:62:4)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
    "
    To contain value:
      "Configuration with name 'foo' was not found."

      10 | 	expect(code).not.toBe(0);
      11 | 	expect(summary).toHaveLength(0);
    > 12 | 	expect(stderr).toContain("Configuration with name 'foo' was not found.");
         | 	               ^
      13 | });
      14 | 

      at Object.<anonymous>.test (test/binCases/config-name/not-found/not-found.test.js:12:17)

 FAIL  test/binCases/config-location/not-found/not-found.test.js
  ● not-found

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      14 | 		"production"
      15 | 	]);
    > 16 | 	expect(code).toBe(0);
         | 	             ^
      17 | 	expect(stdout).toContain("./src/index.js");
      18 | 	expect(stderr).toHaveLength(0);
      19 | });

      at Object.<anonymous>.test (test/binCases/config-location/not-found/not-found.test.js:16:15)

 FAIL  test/binCases/no-options/none/none.test.js
  ● none

    expect(received).toBe(expected) // Object.is equality

    Expected: 2
    Received: 1

       5 | test("none", () => {
       6 | 	const { code, stdout, stderr } = run(__dirname);
    >  7 | 	expect(code).toBe(2);
         | 	             ^
       8 | 	expect(stdout).toEqual(expect.anything());
       9 | 	expect(stderr).toContain("Insufficient number of arguments or no entry found.");
      10 | 	expect(stderr).toContain("Alternatively, run 'webpack(-cli) --help' for usage info.");

      at Object.<anonymous>.test (test/binCases/no-options/none/none.test.js:7:15)

 FAIL  test/binCases/errors/issue-5576/issue-5576.test.js
  ● info-verbosity

    expect(received).toBe(expected) // Object.is equality

    Expected: 2
    Received: 1

       8 | 	const summary = extractSummary(stdout);
       9 | 
    > 10 | 	expect(code).toBe(2);
         | 	             ^
      11 | 	expect(summary).toContain("bundle.js");
      12 | 
      13 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/errors/issue-5576/issue-5576.test.js:10:15)

 FAIL  test/binCases/configFile/profile/profile.test.js
  ● profile

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

       8 | 	const summary = extractSummary(stdout);
       9 | 
    > 10 | 	expect(code).toBe(0);
         | 	             ^
      11 | 	expect(summary).toEqual(expect.anything());
      12 | 	expect(summary).toContain("factory:");
      13 | 	expect(stderr).toHaveLength(0);

      at Object.<anonymous>.test (test/binCases/configFile/profile/profile.test.js:10:15)

 FAIL  test/binCases/entry/display-entrypoints/display-entrypoints.test.js
  ● display-entrypoints

    expect(received).toHaveLength(length)

    Expected value to have length:
      0
    Received:
      "✖ 「webpack」: Promise rejection: UNKNOWN_OPTION: Unknown option: --display-entrypoints
    ✖ 「webpack」: UNKNOWN_OPTION: Unknown option: --display-entrypoints
        at commandLineArgs (/home/travis/build/webpack/webpack-cli/node_modules/command-line-args/dist/index.js:1347:21)
        at runCLI (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:4806)
        at /home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5778
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/lib/bootstrap.js:1:5806)
        at Module._compile (/home/travis/build/webpack/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
        at Module.replacementCompile (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:58:13)
        at Module._extensions..js (module.js:664:10)
        at Object.<anonymous> (/home/travis/build/webpack/webpack-cli/node_modules/nyc/node_modules/append-transform/index.js:62:4)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
    "
    received.length:
      1022

       9 | 
      10 | 	expect(summary).not.toContain("Entrypoint");
    > 11 | 	expect(stderr).toHaveLength(0);
         | 	               ^
      12 | });
      13 | 

      at Object.<anonymous>.test (test/binCases/entry/display-entrypoints/display-entrypoints.test.js:11:17)

 FAIL  test/binCases/stats/multi-config/multi-config.test.js
  ● multi-config

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

       8 | 	const summary = extractSummary(stdout);
       9 | 
    > 10 | 	expect(code).toBe(0);
         | 	             ^
      11 | 	expect(summary).toEqual(expect.anything());
      12 | 	expect(stderr).toHaveLength(0);
      13 | });

      at Object.<anonymous>.test (test/binCases/stats/multi-config/multi-config.test.js:10:15)

 FAIL  test/binCases/config-location/webpack-babel-config/webpack-babel-config.test.js
  ● webpack-babel-config

    expect(string).toContain(value)

    Expected string:
      ""
    To contain value:
      "es6.js"

       5 | test("webpack-babel-config", () => {
       6 | 	const { stdout, stderr } = run(__dirname, ["--target", "async-node", "-r", "esm", "@babel/register"]);
    >  7 | 	expect(stdout).toContain("es6.js");
         | 	               ^
       8 | 	expect(stderr).toHaveLength(0);
       9 | });
      10 | 

      at Object.<anonymous>.test (test/binCases/config-location/webpack-babel-config/webpack-babel-config.test.js:7:17)

 FAIL  test/binCases/silent/silent-output/silent.test.js
  ● silent

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

       8 | 	const summary = extractSummary(stdout);
       9 | 
    > 10 | 	expect(code).toBe(0);
         | 	             ^
      11 | 	expect(summary).toHaveLength(0);
      12 | 	expect(stderr).toHaveLength(0);
      13 | });

      at Object.<anonymous>.test (test/binCases/silent/silent-output/silent.test.js:10:15)

 FAIL  test/binCases/stats/none/none.test.js
  ● none

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

       6 | 	const { code, stdout, stderr } = run(__dirname);
       7 | 
    >  8 | 	expect(code).toBe(0);
         | 	             ^
       9 | 	expect(stdout).toHaveLength(0);
      10 | 	expect(stderr).toHaveLength(0);
      11 | });

      at Object.<anonymous>.test (test/binCases/stats/none/none.test.js:8:15)

�[999D�[K
=============================== Coverage summary ===============================
Statements   : 66.18% ( 45/68 )
Branches     : 71.43% ( 15/21 )
Functions    : 46.67% ( 7/15 )
Lines        : 65.15% ( 43/66 )
===

See complete report here.

@anikethsaha anikethsaha changed the title fix: changed the islocalPath conditions to more effective [NEXT] fix: changed the islocalPath conditions to more effective Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants