danvk / source-map-explorer

Analyze and debug space usage through source maps
Apache License 2.0
3.83k stars 101 forks source link

fix windows test issue. #77

Closed mattjin closed 5 years ago

mattjin commented 5 years ago

a test that fails without your change but passes with it

Actually the current test will fail without my changes under windows. The error message shows:

source-map-explorer commonPathPrefix √ should find common prefixes mapKeys √ should map keys adjustSourcePaths √ should factor out a common prefix √ should find/replace √ should find/replace with regexp √ should find/replace with regexp, can be used to add root Public API 1) should generate data when provided with js file with inline map 2) should generate data when provided with file with referenced map √ should generate data when provided with file with separated map file 3) should generate data respecting onlyMapped and replace options 4) should accept options passed as second or third argument 5) should accept buffer with inline map 6) should accept buffers with js and map √ should generate html √ should throw when specified file (js or map) not found √ should trow when cannot locate sourcemap √ should throw when used with bad sourcemap

11 passing (87ms) 6 failing

1) source-map-explorer Public API should generate data when provided with js file with inline map:

  AssertionError: expected { Object (totalBytes, unmappedBytes, ...) } to deeply equal { Object (files, unmappedBytes, ...) }
  + expected - actual

   {
     "files": {
       "<unmapped>": 0
  -    "dist/bar.js": 2855
  -    "dist/foo.js": 138
  +    "dist/bar.js": 2854
  +    "dist/foo.js": 137
       "node_modules/browserify/node_modules/browser-pack/_prelude.js": 463
     }
  -  "totalBytes": 3456
  +  "totalBytes": 3454
     "unmappedBytes": 0
   }

  at Assertion.assertEqual (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\core\assertions.js:485:19)
  at Assertion.ctx.(anonymous function) [as equal] (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\utils\addMethod.js:41:25)
  at Context.<anonymous> (D:\depot\react\source-map-explorer_fork\test.js:93:75)
  at callFn (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:326:21)
  at Test.Runnable.run (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:319:7)
  at Runner.runTest (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:422:10)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:528:12
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:342:14)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:352:7
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:284:14)
  at Immediate._onImmediate (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:320:5)

2) source-map-explorer Public API should generate data when provided with file with referenced map:

  AssertionError: expected { Object (totalBytes, unmappedBytes, ...) } to deeply equal { Object (files, unmappedBytes, ...) }
  + expected - actual

   {
     "files": {
       "<unmapped>": 0
  -    "dist/bar.js": 98
  -    "dist/foo.js": 138
  +    "dist/bar.js": 97
  +    "dist/foo.js": 137
       "node_modules/browserify/node_modules/browser-pack/_prelude.js": 463
     }
  -  "totalBytes": 699
  +  "totalBytes": 697
     "unmappedBytes": 0
   }

  at Assertion.assertEqual (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\core\assertions.js:485:19)
  at Assertion.ctx.(anonymous function) [as equal] (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\utils\addMethod.js:41:25)
  at Context.<anonymous> (D:\depot\react\source-map-explorer_fork\test.js:98:18)
  at callFn (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:326:21)
  at Test.Runnable.run (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:319:7)
  at Runner.runTest (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:422:10)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:528:12
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:342:14)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:352:7
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:284:14)
  at Immediate._onImmediate (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:320:5)

3) source-map-explorer Public API should generate data respecting onlyMapped and replace options:

  AssertionError: expected { Object (totalBytes, unmappedBytes, ...) } to deeply equal { Object (files, unmappedBytes, ...) }
  + expected - actual

   {
     "files": {
  -    "hello/bar.js": 98
  -    "hello/foo.js": 138
  +    "hello/bar.js": 97
  +    "hello/foo.js": 137
       "node_modules/browserify/node_modules/browser-pack/_prelude.js": 463
     }
  -  "totalBytes": 699
  +  "totalBytes": 697
     "unmappedBytes": 0
   }

  at Assertion.assertEqual (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\core\assertions.js:485:19)
  at Assertion.ctx.(anonymous function) [as equal] (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\utils\addMethod.js:41:25)
  at Context.<anonymous> (D:\depot\react\source-map-explorer_fork\test.js:137:17)
  at callFn (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:326:21)
  at Test.Runnable.run (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:319:7)
  at Runner.runTest (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:422:10)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:528:12
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:342:14)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:352:7
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:284:14)
  at Immediate._onImmediate (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:320:5)

4) source-map-explorer Public API should accept options passed as second or third argument:

  AssertionError: expected { Object (totalBytes, unmappedBytes, ...) } to deeply equal { Object (files, unmappedBytes, ...) }
  + expected - actual

   {
     "files": {
  -    "dist/bar.js": 98
  -    "dist/foo.js": 138
  +    "dist/bar.js": 97
  +    "dist/foo.js": 137
       "node_modules/browserify/node_modules/browser-pack/_prelude.js": 463
     }
  -  "totalBytes": 699
  +  "totalBytes": 697
     "unmappedBytes": 0
   }

  at Assertion.assertEqual (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\core\assertions.js:485:19)
  at Assertion.ctx.(anonymous function) [as equal] (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\utils\addMethod.js:41:25)
  at Context.<anonymous> (D:\depot\react\source-map-explorer_fork\test.js:152:18)
  at callFn (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:326:21)
  at Test.Runnable.run (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:319:7)
  at Runner.runTest (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:422:10)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:528:12
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:342:14)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:352:7
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:284:14)
  at Immediate._onImmediate (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:320:5)

5) source-map-explorer Public API should accept buffer with inline map:

  AssertionError: expected { Object (totalBytes, unmappedBytes, ...) } to deeply equal { Object (files, unmappedBytes, ...) }
  + expected - actual

   {
     "files": {
       "<unmapped>": 0
  -    "dist/bar.js": 2855
  -    "dist/foo.js": 138
  +    "dist/bar.js": 2854
  +    "dist/foo.js": 137
       "node_modules/browserify/node_modules/browser-pack/_prelude.js": 463
     }
  -  "totalBytes": 3456
  +  "totalBytes": 3454
     "unmappedBytes": 0
   }

  at Assertion.assertEqual (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\core\assertions.js:485:19)
  at Assertion.ctx.(anonymous function) [as equal] (D:\depot\react\source-map-explorer_fork\node_modules\chai\lib\chai\utils\addMethod.js:41:25)
  at Context.<anonymous> (D:\depot\react\source-map-explorer_fork\test.js:160:18)
  at callFn (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:326:21)
  at Test.Runnable.run (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runnable.js:319:7)
  at Runner.runTest (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:422:10)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:528:12
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:342:14)
  at D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:352:7
  at next (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:284:14)
  at Immediate._onImmediate (D:\depot\react\source-map-explorer_fork\node_modules\mocha\lib\runner.js:320:5)

6) source-map-explorer Public API should accept buffers with js and map:

  AssertionError: expected { Object (totalBytes, unmappedBytes, ...) } to deeply equal { Object (files, unmappedBytes, ...) }
  + expected - actual

   {
     "files": {
       "<unmapped>": 0
  -    "dist/bar.js": 98
  -    "dist/foo.js": 138
  +    "dist/bar.js": 97
  +    "dist/foo.js": 137
       "node_modules/browserify/node_modules/browser-pack/_prelude.js": 463
     }
  -  "totalBytes": 699
  +  "totalBytes": 697
     "unmappedBytes": 0
   }