Skip to content

Commit c6eaaed

Browse files
committed
update for node 14 support
1 parent 2bf5837 commit c6eaaed

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

.travis.yml

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
language: node_js
1+
version: ~> 1.0
22

3-
node_js:
4-
- "12"
5-
- "node"
63

7-
sudo: false
8-
9-
install:
10-
- "npm install"
11-
12-
os:
13-
- "linux"
14-
- "osx"
15-
- "windows"
4+
import:
5+
- hapijs/ci-config-travis:node_js.yml@main
6+
- hapijs/ci-config-travis:install.yml@main
7+
- hapijs/ci-config-travis:os.yml@main

lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ exports.incomplete = function () {
4242
};
4343

4444

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

4747

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

5050

5151
exports.thrownAt = function (error) {

test/index.js

+25
Original file line numberDiff line numberDiff line change
@@ -2369,6 +2369,31 @@ describe('expect()', () => {
23692369
});
23702370
});
23712371
});
2372+
2373+
it('handles cases where thrownAt() cannot parse the error', () => {
2374+
2375+
const captureStackTrace = Error.captureStackTrace;
2376+
2377+
Error.captureStackTrace = (error) => {
2378+
2379+
error.stack = 5;
2380+
};
2381+
2382+
try {
2383+
Code.expect(1).to.equal(2);
2384+
}
2385+
catch (err) {
2386+
var exception = err;
2387+
}
2388+
finally {
2389+
Error.captureStackTrace = captureStackTrace;
2390+
}
2391+
2392+
Hoek.assert(exception);
2393+
Hoek.assert(exception.message === 'Expected 1 to equal specified value: 2', exception.message);
2394+
Hoek.assert(exception.at.filename === __filename);
2395+
Hoek.assert(exception.at.column === '18');
2396+
});
23722397
});
23732398

23742399
describe('fail', () => {

0 commit comments

Comments
 (0)