avajs/ava

An error occurred while trying to read the map file #982

kaelzhang posted onGitHub

Reproduction

test/crash.js

const ava = require('ava')

test('anything', t => {
  `//# sourceMappingURL=a.js.map`
})

Bash

> ava test/crash.js

1. Uncaught Exception
   Error: An error occurred while trying to read the map file at /path/to/test/a.js.map`
Error: ENOENT: no such file or directory, open 'path/to/test/test/a.js.map`'

Environment

  • Node.js v6.3.0
  • darwin 15.5.0
  • ava 0.15.2
  • npm 3.10.3

Is the problem that you have a test file that intentionally contains the string //# sourceMappingURL=a.js.map, which then crashes?

posted by novemberborn over 8 years ago

But it is a string, not a real comment.

posted by kaelzhang over 8 years ago

Yea. I suppose the source map library we use just does a simple scan of the source. Will try and investigate further.

As a workaround you should be able to break up the string:

`//# source${''}MappingURL=a.js.map`
posted by novemberborn over 8 years ago

Yes, I had made it right by changing it to something else. But there is something wrong that is necessary to report.

posted by kaelzhang over 8 years ago

@issuehunt has funded $30.00 to this issue.


posted by IssueHuntBot almost 6 years ago

@novemberborn I am trying to start contributing to this package and solving this issue. I did a small test with one small issue of not being able to use darwin 15.5.0 for my test environment.

here is the code and the error is not reproduced it passes, I am wondering why ?

import test from 'ava';
var packageInfo = require('./package.json');

import os from 'os';

console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())
console.log('Ava version: ' + packageInfo.dependencies.ava)

test('anything', t => {
  `//# sourceMappingURL=a.js.map`
})
posted by okandas almost 6 years ago

@okandas it might be that this issue was resolved, perhaps the dependency improved. Try adding a t.fail() in your test and see if that shows up correctly.

posted by novemberborn almost 6 years ago

@novemberborn let me check it and if it doesn't produce errors can you close this

posted by okandas almost 6 years ago

@novemberborn I got the next result

> ava test.js



  1 test failed

  anything


  Error: Test finished without running any assertions

npm ERR! Test failed.  See above for more details.

seems can be closed

posted by havenchyk over 5 years ago

That's great news @havenchyk. Thank you for confirming.

posted by novemberborn over 5 years ago

Fund this Issue

$30.00
Funded

Pull requests

Recent activities

issuehunt funded 30.00 for avajs/ava# 982
almost 6 years ago