diff --git a/package.json b/package.json index c65e213..9c6569c 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "url-parse-lax": "^1.0.0" }, "devDependencies": { - "ava": "^0.11.0", + "ava": "^0.12.0", "coveralls": "^2.11.4", "get-port": "^2.0.0", "into-stream": "^2.0.0", diff --git a/test/arguments.js b/test/arguments.js index cc7548e..7692350 100644 --- a/test/arguments.js +++ b/test/arguments.js @@ -28,7 +28,7 @@ test('url is required', async t => { await got(); t.fail('Exception was not thrown'); } catch (err) { - t.regexTest(/Parameter `url` must be a string or object, not undefined/, err.message); + t.regex(err.message, /Parameter `url` must be a string or object, not undefined/); } }); @@ -49,7 +49,7 @@ test('should throw with auth in url', async t => { await got('https://test:45d3ps453@account.myservice.com/api/token'); t.fail('Exception was not thrown'); } catch (err) { - t.regexTest(/Basic authentication must be done with auth option/, err.message); + t.regex(err.message, /Basic authentication must be done with auth option/); } }); diff --git a/test/error.js b/test/error.js index bf9900e..e81cdae 100644 --- a/test/error.js +++ b/test/error.js @@ -36,7 +36,7 @@ test('dns message', async t => { t.fail('Exception was not thrown'); } catch (err) { t.ok(err); - t.regexTest(/getaddrinfo ENOTFOUND/, err.message); + t.regex(err.message, /getaddrinfo ENOTFOUND/); t.is(err.host, '.com'); t.is(err.method, 'GET'); } @@ -47,7 +47,7 @@ test('options.body error message', async t => { await got(s.url, {body: () => {}}); t.fail('Exception was not thrown'); } catch (err) { - t.regexTest(/options.body must be a ReadableStream, string, Buffer or plain Object/, err.message); + t.regex(err.message, /options.body must be a ReadableStream, string, Buffer or plain Object/); } }); diff --git a/test/json.js b/test/json.js index a30b8d7..3266714 100644 --- a/test/json.js +++ b/test/json.js @@ -47,7 +47,7 @@ test('wraps parsing errors', async t => { await got(`${s.url}/invalid`, {json: true}); t.fail('Exception was not thrown'); } catch (err) { - t.regexTest(/Unexpected token/, err.message); + t.regex(err.message, /Unexpected token/); t.ok(err.message.indexOf(err.hostname) !== -1, err.message); t.is(err.path, '/invalid'); } @@ -67,7 +67,7 @@ test('catches errors on invalid non-200 responses', async t => { await got(`${s.url}/non200-invalid`, {json: true}); t.fail('Exception was not thrown'); } catch (err) { - t.regexTest(/Unexpected token/, err.message); + t.regex(err.message, /Unexpected token/); t.is(err.response.body, 'Internal error'); t.is(err.path, '/non200-invalid'); } diff --git a/test/stream.js b/test/stream.js index 20652c4..3e28d68 100644 --- a/test/stream.js +++ b/test/stream.js @@ -106,7 +106,7 @@ test.cb('have error event', t => { t.fail('response event should not be emitted'); }) .on('error', err => { - t.regexTest(/getaddrinfo ENOTFOUND/, err.message); + t.regex(err.message, /getaddrinfo ENOTFOUND/); t.end(); }); });