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

Cannot read property 'replace' of undefined #64

Open
bitmage opened this issue Oct 2, 2018 · 1 comment
Open

Cannot read property 'replace' of undefined #64

bitmage opened this issue Oct 2, 2018 · 1 comment

Comments

@bitmage
Copy link

bitmage commented Oct 2, 2018

.../node_modules/trim/index.js:5
  return str.replace(/^\s*|\s*$/g, '');
             ^

TypeError: Cannot read property 'replace' of undefined
    at trim (.../node_modules/trim/index.js:5:14)
    at Parser._handleError (.../node_modules/tap-out/index.js:187:14)
    at Parser.handleLine (.../node_modules/tap-out/index.js:48:8)
    at Stream.<anonymous> (.../node_modules/tap-out/index.js:241:14)
    at Stream.emit (events.js:180:13)
    at drain (.../node_modules/through/index.js:36:16)
    at Stream.stream.queue.stream.push (.../node_modules/through/index.js:45:5)
    at emit (.../node_modules/split/index.js:37:14)
    at next (.../node_modules/split/index.js:49:7)
    at Stream.<anonymous> (.../node_modules/split/index.js:54:5)

I get this when using:

const tape = require('tape')
const {test} = tape
tape.createStream()
  .pipe(require('tap-spec')())
  .pipe(process.stdout);

And calling t.err(error) on an error that contains endlines in the message body.

@craigphicks
Copy link

I had this problem also. I noticed that tape-spec depends on tape-out, I ran it on tap-out and found it crached with that error message. It turns out that tape-out sometimes breaks on lines that don't begin with ok, not, or #. So it put in and extra filter to put a # on lines that begin with a space

(some-test-rig) | sed 's/^ /#/1' | npm tap-out

and then it passed the particular output I was throwing at it.
But I think there are more issues besides just this one.

.../node_modules/trim/index.js:5
  return str.replace(/^\s*|\s*$/g, '');
             ^

TypeError: Cannot read property 'replace' of undefined
    at trim (.../node_modules/trim/index.js:5:14)
    at Parser._handleError (.../node_modules/tap-out/index.js:187:14)
    at Parser.handleLine (.../node_modules/tap-out/index.js:48:8)
    at Stream.<anonymous> (.../node_modules/tap-out/index.js:241:14)
    at Stream.emit (events.js:180:13)
    at drain (.../node_modules/through/index.js:36:16)
    at Stream.stream.queue.stream.push (.../node_modules/through/index.js:45:5)
    at emit (.../node_modules/split/index.js:37:14)
    at next (.../node_modules/split/index.js:49:7)
    at Stream.<anonymous> (.../node_modules/split/index.js:54:5)

I get this when using:

const tape = require('tape')
const {test} = tape
tape.createStream()
  .pipe(require('tap-spec')())
  .pipe(process.stdout);

And calling t.err(error) on an error that contains endlines in the message body.

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

No branches or pull requests

2 participants