diff --git a/libraries/o-error/.eslintrc.json b/libraries/o-error/.eslintrc.json index 6d31095967..1469158283 100644 --- a/libraries/o-error/.eslintrc.json +++ b/libraries/o-error/.eslintrc.json @@ -17,9 +17,6 @@ "files": ["test/**/*.js"], "env": { "mocha": true - }, - "globals": { - "expect": "readonly" } } ] diff --git a/libraries/o-error/package-lock.json b/libraries/o-error/package-lock.json index 9f8ca73d3c..01f5b60431 100644 --- a/libraries/o-error/package-lock.json +++ b/libraries/o-error/package-lock.json @@ -36,6 +36,12 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, + "@types/node": { + "version": "13.13.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.2.tgz", + "integrity": "sha512-LB2R1Oyhpg8gu4SON/mfforE525+Hi/M1ineICEDftqNVTyFg1aRIeGuTvXAoWHc4nbrFncWtJgMmoyRvuGh7A==", + "dev": true + }, "acorn": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", @@ -2207,6 +2213,12 @@ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "dev": true + }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", diff --git a/libraries/o-error/package.json b/libraries/o-error/package.json index 6256793d16..90aa4e170d 100644 --- a/libraries/o-error/package.json +++ b/libraries/o-error/package.json @@ -5,12 +5,14 @@ "main": "index.js", "scripts": { "lint": "eslint .", - "test": "mocha --require test/support" + "test": "mocha", + "typecheck": "tsc --allowJs --checkJs --noEmit --moduleResolution node --target ES6 *.js test/**/*.js" }, "author": "Overleaf (https://www.overleaf.com)", "license": "MIT", "repository": "github:overleaf/o-error", "devDependencies": { + "@types/node": "^13.13.2", "chai": "^3.3.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.10.1", @@ -24,6 +26,7 @@ "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.1", "mocha": "^7.1.1", - "prettier": "^2.0.2" + "prettier": "^2.0.2", + "typescript": "^3.8.3" } } diff --git a/libraries/o-error/test/http.test.js b/libraries/o-error/test/http.test.js index 210ee535b3..94886ee854 100644 --- a/libraries/o-error/test/http.test.js +++ b/libraries/o-error/test/http.test.js @@ -1,3 +1,5 @@ +const { expect } = require('chai') + const HttpErrors = require('../http') const { expectError } = require('./support') diff --git a/libraries/o-error/test/o-error-util.test.js b/libraries/o-error/test/o-error-util.test.js index f803a7feda..06fb22b04c 100644 --- a/libraries/o-error/test/o-error-util.test.js +++ b/libraries/o-error/test/o-error-util.test.js @@ -1,4 +1,5 @@ const { getFullInfo, getFullStack, hasCauseInstanceOf } = require('..') +const { expect } = require('chai') describe('OError.getFullInfo', function () { it('works on a normal error', function () { diff --git a/libraries/o-error/test/o-error.test.js b/libraries/o-error/test/o-error.test.js index 86bb6703b7..30318e416f 100644 --- a/libraries/o-error/test/o-error.test.js +++ b/libraries/o-error/test/o-error.test.js @@ -1,3 +1,5 @@ +const { expect } = require('chai') + const OError = require('..') const { expectError } = require('./support') diff --git a/libraries/o-error/test/support/index.js b/libraries/o-error/test/support/index.js index 009391d62d..52a81d9d7b 100644 --- a/libraries/o-error/test/support/index.js +++ b/libraries/o-error/test/support/index.js @@ -1,8 +1,6 @@ -'use strict' +const { expect } = require('chai') -var chai = require('chai') - -global.expect = chai.expect +const OError = require('../..') exports.expectError = function OErrorExpectError(e, expected) { // should set the name to the error's name