serverless-heaven / serverless-webpack

Serverless plugin to bundle your lambdas with Webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unit tests fail on Windows because of path separator

HyperBrain opened this issue · comments

This is a Bug Report

Description

When running npm test on Windows, the unit tests fail like:

      + expected - actual

       {
         "filename": "last"
         "libraryTarget": "commonjs"
      -  "path": "testpath\\.webpack"
      +  "path": "testpath/.webpack"
       }

The failures happen in multiple tests, everywhere where paths are checked against
their expectations.

Proposed solution

The expectations should be composed by using path.sep as path separator to keep the tests platform independent.

Perhaps we could use AppVeyor to run the tests on a Windows-based CI in the future?

Sounds like a good idea. This would complement Travis (where we can run linux and osx tests) perfectly. I will take care of the Travis integration in the next days, and will do some experiments with AppVeyor too.

The issue on Windows is not just replacing the path separators. After fixing these, the unit tests on Windows still bail out with a failing require that seems to behave differently on Windows and Linux. Did the same test on Linux and it worked.
Will continue with this.

Will suspend work on this, until the code base for 3.0.0 is ready. Due to the removal of serve and run, the unit tests should be runnable on Windows again with only a few changes.

V3 merged