electron-userland / electron-webpack

Scripts and configurations to compile Electron applications using webpack
https://webpack.electron.build/
905 stars 171 forks source link

Tests fail on windows #198

Open loopmode opened 6 years ago

loopmode commented 6 years ago

Several tests fail when executing them on a Windows system. It seems that local file paths do not get translated or processed correctly.

This is the summary for me after running yarn test on the freshly cloned and installed project:

Test Suites: 2 failed, 1 passed, 3 total
Tests:       6 failed, 6 passed, 12 total
Snapshots:   10 failed, 8 passed, 18 total
Time:        10.239s
Ran all test suites.

All failures seem to be related to file paths, similar to this one:

    -     [0] <cwd>/node_modules/css-loader!./src/renderer/style.css {0} [built]
    -     [1] <cwd>/node_modules/css-loader/lib/css-base.js 2.21 KiB {0} [built]"
    +     [0] C:/Users/Jovica.Aleksic/Desktop/electron-webpack/node_modules/css-loader!./src/renderer/style.css {0} [built]
    +     [1] C:/Users/Jovica.Aleksic/Desktop/electron-webpack/node_modules/css-loader/lib/css-base.js 2.21 KiB {0} [built]"

Some are failing due to mismatch in file size, but that might be just a consequence of generated files containing the longer local file paths in several occasions, e.g.:

    -      styles.css  135 bytes       0  [emitted]  renderer
    +      styles.css  141 bytes       0  [emitted]  renderer

Would be great if somebody could fix the test setup so that it works on any platform. I chatted about this with @develar once, and he said I shouldn't worry much as a user, this is rather for the core developers only. However, writing a reply to https://github.com/electron-userland/electron-webpack/issues/197 I realized how important it is to have working tests, especially for somebody who is new and wants to contribute. In that case, having not-really-working tests is worse than having no tests at all, because as a somewhat experienced developer, you see there are tests and naturally the first thing you do is run the tests.

In my case when I first came to this project, I spent quite some time trying to figure out what's wrong and I even approached the main developer via Slack to ask.. Because I wasn't sure if I did something wrong during project setup. So instead of actually contributing and developing, I was "wasting time", and this may happen to other users as well.

On the other hand, having the tests simply pass - well, they are green, give you a good feeling and motivation to start hacking, and I think.. it can just be expected for the tests to work out of the box.

loopmode commented 5 years ago

Tests are still failing on Windows apparently due to path resolution problems.

Here is the full output:

$ yarn jest
yarn run v1.16.0
$ D:\Projects\@github.com\loopmode@github\electron-webpack\node_modules\.bin\jest
 FAIL  test/out/loaderDetectionTest.js
  ● Console

    console.log test/out/helpers/helper.js:147
      Hash: e8bfaefa3515a0b7dff2
      Version: webpack 4.35.3
      Time: 482ms
      Built at: 2019-07-23 19:55:43
            Asset      Size  Chunks  Chunk Names
          main.js  1.17 KiB       0  main
      main.js.map  1.61 KiB       0  main
      Entrypoint main = main.js main.js.map
      [0] multi ./src/main/index.js 28 bytes {0} [built]
      [1] ./src/main/index.js 37 bytes {0} [built]

      ERROR in ./src/main/index.js
      Module not found: Error: Can't resolve 'nunjucks-loader' in 'C:\Users\JOVICA~1.ALE\AppData\Local\Temp\t-f9KhO2\0'
       @ ./src/main/index.js 3:0-21
       @ multi ./src/main/index.js
    console.log test/out/helpers/helper.js:147
      Hash: 579eadc77edafbee395c
      Version: webpack 4.35.3
      Time: 291ms
      Built at: 2019-07-23 19:55:44
                Asset      Size  Chunks  Chunk Names
          renderer.js  1.11 KiB       0  renderer
      renderer.js.map  1.62 KiB       0  renderer
      Entrypoint renderer = renderer.js renderer.js.map
      [0] multi ./src/renderer/index.js 28 bytes {0} [built]
      [1] ./src/renderer/index.js 38 bytes {0} [built]

      ERROR in ./src/renderer/index.js
      Module not found: Error: Can't resolve 'sass-loader' in 'C:\Users\JOVICA~1.ALE\AppData\Local\Temp\t-f9KhO2\1'
       @ ./src/renderer/index.js 3:0-22
       @ multi ./src/renderer/index.js
      Child html-webpack-plugin for "index.html":
               Asset      Size  Chunks  Chunk Names
          index.html  3.99 KiB       0
          Entrypoint undefined = index.html
          [0] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html 255 bytes {0} [built]

  ● nunjucks

    expect(received).toMatchSnapshot()

    Snapshot name: `nunjucks 1`

    - Snapshot
    + Received

      "./src/main/index.js
    - Module not found: Error: Can't resolve 'nunjucks-loader' in '<project-dir>'
    - resolve 'nunjucks-loader' in '<project-dir>'
    + Module not found: Error: Can't resolve 'nunjucks-loader' in 'C:\\Users\\JOVICA~1.ALE\\AppData\\Local\\Temp\\t-f9KhO2\\0'
    + resolve 'nunjucks-loader' in 'C:\\Users\\JOVICA~1.ALE\\AppData\\Local\\Temp\\t-f9KhO2\\0'
        Parsed request is a module
    -   using description file: <project-dir>/package.json (relative path: .)
    +   using description file: C:\\Users\\JOVICA~1.ALE\\AppData\\Local\\Temp\\t-f9KhO2\\0\\package.json (relative path: .)
          resolve as module
    -       looking for modules in <root-dir>/node_modules
    -         using description file: <root-dir>/package.json (relative path: ./node_modules)
    -           using description file: <root-dir>/package.json (relative path: ./node_modules/nunjucks-loader)
    +       looking for modules in D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules
    +         using description file: D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\package.json (relative path: ./node_modules)
    +           using description file: D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\package.json (relative path: ./node_modules/nunjucks-loader)
                  no extension
    -               <root-dir>/node_modules/nunjucks-loader doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\nunjucks-loader doesn't exist
                  .js
    -               <root-dir>/node_modules/nunjucks-loader.js doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\nunjucks-loader.js doesn't exist
                  .json
    -               <root-dir>/node_modules/nunjucks-loader.json doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\nunjucks-loader.json doesn't exist
                  as directory
    -               <root-dir>/node_modules/nunjucks-loader doesn't exist
    -       looking for modules in <root-dir>/packages/electron-webpack/node_modules
    -         using description file: <root-dir>/packages/electron-webpack/package.json (relative path: ./node_modules)
    -           using description file: <root-dir>/packages/electron-webpack/package.json (relative path: ./node_modules/nunjucks-loader)
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\nunjucks-loader doesn't exist
    +       looking for modules in D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules
    +         using description file: D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\package.json (relative path: ./node_modules)
    +           using description file: D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\package.json (relative path: ./node_modules/nunjucks-loader)
                  no extension
    -               <root-dir>/packages/electron-webpack/node_modules/nunjucks-loader doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\nunjucks-loader doesn't exist
                  .js
    -               <root-dir>/packages/electron-webpack/node_modules/nunjucks-loader.js doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\nunjucks-loader.js doesn't exist
                  .json
    -               <root-dir>/packages/electron-webpack/node_modules/nunjucks-loader.json doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\nunjucks-loader.json doesn't exist
                  as directory
    -               <root-dir>/packages/electron-webpack/node_modules/nunjucks-loader doesn't exist
    - [<root-dir>/node_modules/nunjucks-loader]
    - [<root-dir>/node_modules/nunjucks-loader.js]
    - [<root-dir>/node_modules/nunjucks-loader.json]
    - [<root-dir>/packages/electron-webpack/node_modules/nunjucks-loader]
    - [<root-dir>/packages/electron-webpack/node_modules/nunjucks-loader.js]
    - [<root-dir>/packages/electron-webpack/node_modules/nunjucks-loader.json]
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\nunjucks-loader doesn't exist
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\nunjucks-loader]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\nunjucks-loader.js]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\nunjucks-loader.json]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\nunjucks-loader]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\nunjucks-loader.js]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\nunjucks-loader.json]
       @ ./src/main/index.js 3:0-21
       @ multi ./src/main/index.js"

      at Assertions.throws (test/out/helpers/helper.js:241:17)

  ● sass

    expect(received).toMatchSnapshot()

    Snapshot name: `sass 1`

    - Snapshot
    + Received

      "./src/renderer/index.js
    - Module not found: Error: Can't resolve 'sass-loader' in '<project-dir>'
    - resolve 'sass-loader' in '<project-dir>'
    + Module not found: Error: Can't resolve 'sass-loader' in 'C:\\Users\\JOVICA~1.ALE\\AppData\\Local\\Temp\\t-f9KhO2\\1'
    + resolve 'sass-loader' in 'C:\\Users\\JOVICA~1.ALE\\AppData\\Local\\Temp\\t-f9KhO2\\1'
        Parsed request is a module
    -   using description file: <project-dir>/package.json (relative path: .)
    +   using description file: C:\\Users\\JOVICA~1.ALE\\AppData\\Local\\Temp\\t-f9KhO2\\1\\package.json (relative path: .)
          resolve as module
    -       looking for modules in <root-dir>/node_modules
    -         using description file: <root-dir>/package.json (relative path: ./node_modules)
    -           using description file: <root-dir>/package.json (relative path: ./node_modules/sass-loader)
    +       looking for modules in D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules
    +         using description file: D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\package.json (relative path: ./node_modules)
    +           using description file: D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\package.json (relative path: ./node_modules/sass-loader)
                  no extension
    -               <root-dir>/node_modules/sass-loader doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\sass-loader doesn't exist
                  .js
    -               <root-dir>/node_modules/sass-loader.js doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\sass-loader.js doesn't exist
                  .json
    -               <root-dir>/node_modules/sass-loader.json doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\sass-loader.json doesn't exist
                  as directory
    -               <root-dir>/node_modules/sass-loader doesn't exist
    -       looking for modules in <root-dir>/packages/electron-webpack/node_modules
    -         using description file: <root-dir>/packages/electron-webpack/package.json (relative path: ./node_modules)
    -           using description file: <root-dir>/packages/electron-webpack/package.json (relative path: ./node_modules/sass-loader)
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\sass-loader doesn't exist
    +       looking for modules in D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules
    +         using description file: D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\package.json (relative path: ./node_modules)
    +           using description file: D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\package.json (relative path: ./node_modules/sass-loader)
                  no extension
    -               <root-dir>/packages/electron-webpack/node_modules/sass-loader doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\sass-loader doesn't exist
                  .js
    -               <root-dir>/packages/electron-webpack/node_modules/sass-loader.js doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\sass-loader.js doesn't exist
                  .json
    -               <root-dir>/packages/electron-webpack/node_modules/sass-loader.json doesn't exist
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\sass-loader.json doesn't exist
                  as directory
    -               <root-dir>/packages/electron-webpack/node_modules/sass-loader doesn't exist
    - [<root-dir>/node_modules/sass-loader]
    - [<root-dir>/node_modules/sass-loader.js]
    - [<root-dir>/node_modules/sass-loader.json]
    - [<root-dir>/packages/electron-webpack/node_modules/sass-loader]
    - [<root-dir>/packages/electron-webpack/node_modules/sass-loader.js]
    - [<root-dir>/packages/electron-webpack/node_modules/sass-loader.json]
    +               D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\sass-loader doesn't exist
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\sass-loader]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\sass-loader.js]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\node_modules\\sass-loader.json]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\sass-loader]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\sass-loader.js]
    + [D:\\Projects\\@github.com\\loopmode@github\\electron-webpack\\packages\\electron-webpack\\node_modules\\sass-loader.json]
       @ ./src/renderer/index.js 3:0-22
       @ multi ./src/renderer/index.js"

      at Assertions.throws (test/out/helpers/helper.js:241:17)

 › 2 snapshots failed.
 PASS  test/out/titleTest.js
 FAIL  test/out/test.js (5.698s)
  ● app

    expect(received).toMatchSnapshot()

    Snapshot name: `app 1`

    - Snapshot
    + Received

    @@ -8,23 +8,23 @@
      Child
                    Asset       Size  Chunks             Chunk Names
               index.html  329 bytes          [emitted]  
              renderer.js   1.65 KiB       0  [emitted]  renderer
          renderer.js.map   2.01 KiB       0  [emitted]  renderer
    -          styles.css  135 bytes       0  [emitted]  renderer
    +          styles.css  141 bytes       0  [emitted]  renderer
           styles.css.map  156 bytes       0  [emitted]  renderer
          Entrypoint renderer = styles.css renderer.js styles.css.map renderer.js.map
          [0] multi ./src/renderer/index.js 28 bytes {0} [built]
          [1] ./src/renderer/index.js 972 bytes {0} [built]
          [2] ./src/renderer/style.css {0} [built]
          [3] ./src/renderer/foo.html 34 bytes {0} [built]
          [4] external "path" 42 bytes {0} [built]
    -     [] css <cwd>/node_modules/css-loader/dist/cjs.js??ref--6-1!./src/renderer/style.css {0}
    +     [] css D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!./src/renderer/style.css {0}
          Child html-webpack-plugin for "index.html":
                   Asset      Size  Chunks  Chunk Names
              index.html  3.99 KiB       0  
              Entrypoint undefined = index.html
    -         [0] <cwd>/node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html 255 bytes {0} [built]
    -     Child mini-css-extract-plugin ../../../data/Documents/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!src/renderer/style.css:
    +         [0] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html 255 bytes {0} [built]
    +     Child mini-css-extract-plugin D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!src/renderer/style.css:
              Entrypoint mini-css-extract-plugin = *
    -         [0] <cwd>/node_modules/css-loader/dist/cjs.js??ref--6-1!./src/renderer/style.css {0} [built]
    -         [1] <cwd>/node_modules/css-loader/dist/runtime/api.js 2.61 KiB {0} [built]"
    +         [0] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!./src/renderer/style.css {0} [built]
    +         [1] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/runtime/api.js 2.61 KiB {0} [built]"

      66 |     })
      67 |     .join("\n")
    > 68 |     .replace(new RegExp(`[./]*${projectDir}`, "g"), "<project-dir>")
         |                                           ^
      69 |     .replace(new RegExp(`[./]*${process.cwd()}`, "g"), "<cwd>")
      70 |     // no idea why failed on CI - in any case we validate file content
      71 |     .replace(/\/style\.css \d+ bytes/g, "/style.css")

      at testWebpack (test/src/helpers/helper.ts:68:43)

  ● renderer custom sourceDirectory

    expect(received).toMatchSnapshot()

    Snapshot name: `renderer custom sourceDirectory 1`

    - Snapshot
    + Received

      "          Asset       Size  Chunks             Chunk Names
           index.html  329 bytes          [emitted]  
          renderer.js   1.65 KiB       0  [emitted]  renderer
      renderer.js.map   2.02 KiB       0  [emitted]  renderer
    -      styles.css  135 bytes       0  [emitted]  renderer
    +      styles.css  141 bytes       0  [emitted]  renderer
       styles.css.map  158 bytes       0  [emitted]  renderer
      Entrypoint renderer = styles.css renderer.js styles.css.map renderer.js.map
      [0] multi ./customRenderer/index.js 28 bytes {0} [built]
      [1] ./customRenderer/index.js 972 bytes {0} [built]
      [2] ./customRenderer/style.css {0} [built]
      [3] ./customRenderer/foo.html 34 bytes {0} [built]
      [4] external "path" 42 bytes {0} [built]
    - [] css <cwd>/node_modules/css-loader/dist/cjs.js??ref--6-1!./customRenderer/style.css {0}
    + [] css D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!./customRenderer/style.css {0}
      Child html-webpack-plugin for "index.html":
               Asset      Size  Chunks  Chunk Names
          index.html  3.99 KiB       0  
          Entrypoint undefined = index.html
    -     [0] <cwd>/node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html 255 bytes {0} [built]
    - Child mini-css-extract-plugin ../../../data/Documents/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!customRenderer/style.css:
    +     [0] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html 255 bytes {0} [built]
    + Child mini-css-extract-plugin D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!customRenderer/style.css:
          Entrypoint mini-css-extract-plugin = *
    -     [0] <cwd>/node_modules/css-loader/dist/cjs.js??ref--6-1!./customRenderer/style.css {0} [built]
    -     [1] <cwd>/node_modules/css-loader/dist/runtime/api.js 2.61 KiB {0} [built]"
    +     [0] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!./customRenderer/style.css {0} [built]
    +     [1] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/runtime/api.js 2.61 KiB {0} [built]"

      66 |     })
      67 |     .join("\n")
    > 68 |     .replace(new RegExp(`[./]*${projectDir}`, "g"), "<project-dir>")
         |                                           ^
      69 |     .replace(new RegExp(`[./]*${process.cwd()}`, "g"), "<cwd>")
      70 |     // no idea why failed on CI - in any case we validate file content
      71 |     .replace(/\/style\.css \d+ bytes/g, "/style.css")

      at testWebpack (test/src/helpers/helper.ts:68:43)

  ● renderer production

    expect(received).toMatchSnapshot()

    Snapshot name: `renderer production 1`

    - Snapshot
    + Received

      "          Asset       Size  Chunks             Chunk Names
           index.html  329 bytes          [emitted]  
          renderer.js   1.65 KiB       0  [emitted]  renderer
      renderer.js.map   2.01 KiB       0  [emitted]  renderer
    -      styles.css  135 bytes       0  [emitted]  renderer
    +      styles.css  141 bytes       0  [emitted]  renderer
       styles.css.map  156 bytes       0  [emitted]  renderer
      Entrypoint renderer = styles.css renderer.js styles.css.map renderer.js.map
      [0] multi ./src/renderer/index.js 28 bytes {0} [built]
      [1] ./src/renderer/index.js 972 bytes {0} [built]
      [2] ./src/renderer/style.css {0} [built]
      [3] ./src/renderer/foo.html 34 bytes {0} [built]
      [4] external "path" 42 bytes {0} [built]
    - [] css <cwd>/node_modules/css-loader/dist/cjs.js??ref--6-1!./src/renderer/style.css {0}
    + [] css D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!./src/renderer/style.css {0}
      Child html-webpack-plugin for "index.html":
               Asset      Size  Chunks  Chunk Names
          index.html  3.99 KiB       0  
          Entrypoint undefined = index.html
    -     [0] <cwd>/node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html 255 bytes {0} [built]
    - Child mini-css-extract-plugin ../../../data/Documents/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!src/renderer/style.css:
    +     [0] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/html-loader/dist/cjs.js?minimize=false&url=false!./dist/.renderer-index-template.html 255 bytes {0} [built]
    + Child mini-css-extract-plugin D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!src/renderer/style.css:
          Entrypoint mini-css-extract-plugin = *
    -     [0] <cwd>/node_modules/css-loader/dist/cjs.js??ref--6-1!./src/renderer/style.css {0} [built]
    -     [1] <cwd>/node_modules/css-loader/dist/runtime/api.js 2.61 KiB {0} [built]"
    +     [0] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/cjs.js??ref--6-1!./src/renderer/style.css {0} [built]
    +     [1] D:/Projects/@github.com/loopmode@github/electron-webpack/node_modules/css-loader/dist/runtime/api.js 2.61 KiB {0} [built]"

      66 |     })
      67 |     .join("\n")
    > 68 |     .replace(new RegExp(`[./]*${projectDir}`, "g"), "<project-dir>")
         |                                           ^
      69 |     .replace(new RegExp(`[./]*${process.cwd()}`, "g"), "<cwd>")
      70 |     // no idea why failed on CI - in any case we validate file content
      71 |     .replace(/\/style\.css \d+ bytes/g, "/style.css")

      at testWebpack (test/src/helpers/helper.ts:68:43)

 › 3 snapshots failed.
Snapshot Summary
 › 5 snapshots failed from 2 test suites. Inspect your code changes or re-run jest with `-u` to update them.

Test Suites: 2 failed, 1 passed, 3 total
Tests:       5 failed, 7 passed, 12 total
Snapshots:   5 failed, 13 passed, 18 total
Time:        6.132s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
b-zurg commented 4 years ago

100% agree. I tried taking a look at them and the testing setup is quite confusing. It looks like the tests have to be built before they're tested, and then the subject matter of the tests themselves is not obvious, neither are their descriptions.

If they're not working then maybe it's even better to move them to an "archived tests" folder, and start making new ones. What do you think?

xinpingwang commented 3 years ago

same issues on mac:

Test Suites: 3 failed, 3 total
Tests:       9 failed, 3 passed, 12 total
Snapshots:   2 updated, 3 passed, 5 total
Time:        9.285s
Ran all test suites.