Skip to content

Commit

Permalink
update for node 14 support
Browse files Browse the repository at this point in the history
  • Loading branch information
cjihrig committed Jul 24, 2020
1 parent 2bf5837 commit c6eaaed
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
18 changes: 5 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
language: node_js
version: ~> 1.0

node_js:
- "12"
- "node"

sudo: false

install:
- "npm install"

os:
- "linux"
- "osx"
- "windows"
import:
- hapijs/ci-config-travis:node_js.yml@main
- hapijs/ci-config-travis:install.yml@main
- hapijs/ci-config-travis:os.yml@main
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ exports.incomplete = function () {
};


internals.atNamedRx = /^\s*at [^(/]*\(?(.+)\:(\d+)\:(\d+)\)?$/;
internals.atNamedRx = /^\s*at (?:async )?[^(/]*\(?(.+)\:(\d+)\:(\d+)\)?$/;


internals.atUnnamedRx = /^\s*at (.+)\:(\d+)\:(\d+)\)?$/;
internals.atUnnamedRx = /^\s*at (?:async )?(.+)\:(\d+)\:(\d+)\)?$/;


exports.thrownAt = function (error) {
Expand Down
25 changes: 25 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2369,6 +2369,31 @@ describe('expect()', () => {
});
});
});

it('handles cases where thrownAt() cannot parse the error', () => {

const captureStackTrace = Error.captureStackTrace;

Error.captureStackTrace = (error) => {

error.stack = 5;
};

try {
Code.expect(1).to.equal(2);
}
catch (err) {
var exception = err;
}
finally {
Error.captureStackTrace = captureStackTrace;
}

Hoek.assert(exception);
Hoek.assert(exception.message === 'Expected 1 to equal specified value: 2', exception.message);
Hoek.assert(exception.at.filename === __filename);
Hoek.assert(exception.at.column === '18');
});
});

describe('fail', () => {
Expand Down

0 comments on commit c6eaaed

Please sign in to comment.