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

Fix failing tests for createGetPublicPath on windows(path compare) #27

Merged
merged 1 commit into from
Jul 6, 2017

Conversation

sudo-suhas
Copy link
Collaborator

Tests for createGetPublicPath fail due to difference in path separator for unix and windows:

⨯ createGetPublicPath: should return publicPath path currently
  not ok 7 should be equal
    ---
      operator: equal
      expected: '/base/dllPath/filename.js'
      actual:   '\\base\\dllPath\\filename.js'
      at: Test.<anonymous> (E:/Projects/repos/autodll-webpack-plugin/specs/createGetPublicPath.spec.js:11:6)
      stack: |-
        Error: should be equal
            ...
            at Test.<anonymous> (E:/Projects/repos/autodll-webpack-plugin/specs/createGetPublicPath.spec.js:11:6)
            ...
    ...
⨯ createGetPublicPath: should return relative path currently when relative = true
  not ok 8 should be equal
    ---
      operator: equal
      expected: 'dllPath/filename.js'
      actual:   'dllPath\\filename.js'
      at: Test.<anonymous> (E:/Projects/repos/autodll-webpack-plugin/specs/createGetPublicPath.spec.js:22:6)
      stack: |-
        Error: should be equal
            ...
            at Test.<anonymous> (E:/Projects/repos/autodll-webpack-plugin/specs/createGetPublicPath.spec.js:22:6)
            ...
    ...
⨯ createGetPublicPath: without compiler.options.publicPath
  not ok 9 should be equal
    ---
      operator: equal
      expected: 'dllPath/filename.js'
      actual:   'dllPath\\filename.js'
      at: Test.<anonymous> (E:/Projects/repos/autodll-webpack-plugin/specs/createGetPublicPath.spec.js:34:5)
      stack: |-
        Error: should be equal
            ...
            at Test.<anonymous> (E:/Projects/repos/autodll-webpack-plugin/specs/createGetPublicPath.spec.js:34:5)
            ...

We can solve this by using slash and converting the path returned by getPublicPath to unix format before comparing with out expected path.

@asfktz
Copy link
Owner

asfktz commented Jul 6, 2017

So good you're using windows!

Can you check please if normalizing the expected value solves that?

const expected = path.normalize('dllPath/filename.js');

Unverified

No user is associated with the committer email.
@sudo-suhas sudo-suhas force-pushed the test_fix_path_comp_win branch from 52227c5 to 9d3da0e Compare July 6, 2017 06:04
@sudo-suhas
Copy link
Collaborator Author

So good you're using windows!

Ha ha.. Even my very first PR was thanks to wonderful bugs thanks to windows. Not on windows by choice but appreciating the silver lining 😄

Can you check please if normalizing the expected value solves that?

Yes it did. Rebased.

@asfktz
Copy link
Owner

asfktz commented Jul 6, 2017

Awesome (:

@asfktz asfktz merged commit ed4b3bc into asfktz:master Jul 6, 2017
@sudo-suhas sudo-suhas deleted the test_fix_path_comp_win branch July 6, 2017 06:51
@asfktz asfktz added this to the 0.1.0 milestone Jul 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants