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

Tests on path resolution fail #2

Closed
clarmso opened this issue Mar 12, 2017 · 5 comments
Closed

Tests on path resolution fail #2

clarmso opened this issue Mar 12, 2017 · 5 comments

Comments

@clarmso
Copy link

clarmso commented Mar 12, 2017

All tests with path resolution fail. Here's the test result given by "npm test":

gulp-sri-hash
plugin
✓ should know it's name
✓ should be callable
plugin()
✓ should pass through null files
✓ should throw on streams
✓ should bail on unsupported hashing algorithm
✓ should ignore missing external files
✓ should ignore existing integrity attribute
with absolute path resolution
1) should apply integrity hash sha256
2) should apply integrity hash sha384
3) should apply integrity hash sha512
4) should apply custom selectors
5) should apply hashing to whitelisted prefixes
with relative path resolution
6) should apply integrity hash sha256
7) should apply integrity hash sha384
8) should apply integrity hash sha512
9) should apply custom selectors

Here is the error message for one of the failed tests. All failed tests start with "Uncaught TypeError: this is not a typed array.".

 1) gulp-sri-hash plugin() with absolute path resolution should apply integrity hash sha256:
     Uncaught TypeError: this is not a typed array.
      at Function.from (native)
      at calculateSri (index.js:56:17)
      at getFileHash (index.js:63:7)
      at Object.addIntegrityAttribute (index.js:87:33)
      at exports.each (node_modules/cheerio/lib/api/traversing.js:300:24)
      at updateDOM (index.js:75:17)
      at DestroyableTransform.pipeHandler [as _transform] (index.js:126:29)
      at DestroyableTransform.Transform._read (node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
      at DestroyableTransform.Transform._write (node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
      at doWrite (node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:347:64)
      at writeOrBuffer (node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:336:5)
      at DestroyableTransform.Writable.write (node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:274:11)
      at write (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
      at flow (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
      at DestroyableTransform.pipeOnReadable (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
      at emitReadable_ (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
      at emitReadable (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:444:5)
      at readableAddChunk (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:187:9)
      at DestroyableTransform.Readable.push (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:149:10)
      at DestroyableTransform.Transform.push (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:145:32)
      at afterTransform (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:101:12)
      at TransformState.afterTransform (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:79:12)
      at DestroyableTransform.noop [as _transform] (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/through2.js:26:3)
      at DestroyableTransform.Transform._read (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
      at DestroyableTransform.Transform._write (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
      at doWrite (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
      at writeOrBuffer (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
      at DestroyableTransform.Writable.write (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
      at write (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
      at flow (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
      at DestroyableTransform.pipeOnReadable (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
      at emitReadable_ (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
      at emitReadable (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:444:5)
      at readableAddChunk (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:187:9)
      at DestroyableTransform.Readable.push (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:149:10)
      at DestroyableTransform.Transform.push (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:145:32)
      at afterTransform (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:101:12)
      at TransformState.afterTransform (node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:79:12)
      at node_modules/gulp/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js:12:5
      at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
macedigital added a commit that referenced this issue Mar 13, 2017
Add version detection and use deprecated `new Buffer(<string>)`, if the
new Buffer API isn't supported by runtime.

See nodejs/node#7562.
@macedigital
Copy link
Owner

@clarmso Thanks for report!

You're right, I totally missed that Buffer.from(<string>) is only supported since node v4.5+ (https://nodejs.org/dist/latest-v4.x/docs/api/buffer.html#buffer_class_method_buffer_from_str_encoding).

Commit 32604ba contains a fix for older node versions.

Expect a patch-release later today.

macedigital added a commit that referenced this issue Mar 13, 2017
…overage (#2)

Revert version-check from previous commit 32604ba, and use Buffer constructor for converting HTML-formatted string. Looks like, nodejs isn't emitting a deprecation warning any more since v7.2.1 (nodejs/node#9529).

Mocking/Stubbing `process.version` is not only super ugly, but also super tricky. Until 8.x is released, no further changes should be necessary.
@clarmso
Copy link
Author

clarmso commented Mar 13, 2017

@macedigital It was my bad that I did not include the version of Node.js in my report. It's good that you figured out the error is related to my old Node install.

Once the patch release is available, I'll try it with both of my old and new Node installation.

@macedigital
Copy link
Owner

@clarmso No problem 😄

Release v1.2.1 is out, let me know if it works for you now.

@clarmso
Copy link
Author

clarmso commented Mar 14, 2017

All tests passed on Node v4.2.2 and v6.10.0 😄

@macedigital
Copy link
Owner

Cool, happy to help 😃

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