diff --git a/package.json b/package.json index 8a7ac13e..efc10757 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,13 @@ ], "helpers": [ "**/testUtils/**/*" + ], + "compileEnhancements": false, + "extensions": [ + "ts" + ], + "require": [ + "ts-node/register/transpile-only" ] }, "eslintConfig": { @@ -297,6 +304,7 @@ "@types/seamless-immutable": "7.1.11", "@types/styled-jsx": "2.2.8", "@types/uuid": "3.4.6", + "@types/webdriverio": "^4.8.0", "@typescript-eslint/eslint-plugin": "2.10.0", "@typescript-eslint/parser": "2.10.0", "ava": "2.4.0", @@ -324,6 +332,7 @@ "proxyquire": "2.1.3", "spectron": "9.0.0", "style-loader": "1.0.1", + "ts-node": "8.5.4", "typescript": "3.7.3", "webpack": "4.41.2" }, diff --git a/test/index.js b/test/index.ts similarity index 92% rename from test/index.js rename to test/index.ts index eba8f93e..b67442e3 100644 --- a/test/index.js +++ b/test/index.ts @@ -5,7 +5,7 @@ import path from 'path'; import test from 'ava'; import {Application} from 'spectron'; -let app; +let app: Application; test.before(async () => { let pathToBinary; @@ -40,5 +40,5 @@ test.after(async () => { test('see if dev tools are open', async t => { await app.client.waitUntilWindowLoaded(); - t.false(await app.browserWindow.isDevToolsOpened()); + t.false(await app.webContents.isDevToolsOpened()); }); diff --git a/test/testUtils/is-hex-color.js b/test/testUtils/is-hex-color.ts similarity index 56% rename from test/testUtils/is-hex-color.js rename to test/testUtils/is-hex-color.ts index 310f7d09..07aa3d56 100644 --- a/test/testUtils/is-hex-color.js +++ b/test/testUtils/is-hex-color.ts @@ -1,5 +1,5 @@ -function isHexColor(color) { +function isHexColor(color: string) { return /(^#[0-9A-F]{6,8}$)|(^#[0-9A-F]{3}$)/i.test(color); // https://regex101.com/ } -module.exports.isHexColor = isHexColor; +export {isHexColor}; diff --git a/test/unit/cli-api.test.js b/test/unit/cli-api.test.ts similarity index 91% rename from test/unit/cli-api.test.js rename to test/unit/cli-api.test.ts index 68ca771d..62b560fc 100644 --- a/test/unit/cli-api.test.js +++ b/test/unit/cli-api.test.ts @@ -2,10 +2,10 @@ import test from 'ava'; const proxyquire = require('proxyquire').noCallThru(); test('existsOnNpm() builds the url for non-scoped packages', t => { - let getUrl; + let getUrl: string; const {existsOnNpm} = proxyquire('../../cli/api', { got: { - get(url) { + get(url: string) { getUrl = url; return Promise.resolve({ body: { @@ -23,10 +23,10 @@ test('existsOnNpm() builds the url for non-scoped packages', t => { }); test('existsOnNpm() builds the url for scoped packages', t => { - let getUrl; + let getUrl: string; const {existsOnNpm} = proxyquire('../../cli/api', { got: { - get(url) { + get(url: string) { getUrl = url; return Promise.resolve({ body: { diff --git a/test/unit/to-electron-background-color.test.js b/test/unit/to-electron-background-color.test.ts similarity index 100% rename from test/unit/to-electron-background-color.test.js rename to test/unit/to-electron-background-color.test.ts diff --git a/test/unit/window-utils.test.js b/test/unit/window-utils.test.ts similarity index 100% rename from test/unit/window-utils.test.js rename to test/unit/window-utils.test.ts diff --git a/tsconfig.json b/tsconfig.json index 6eb82fd0..9dc03b69 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,8 @@ }, "include": [ "./app/", - "./lib/" + "./lib/", + "./test/" ], "references": [ { diff --git a/yarn.lock b/yarn.lock index 5e6d0250..57e4918b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -738,6 +738,13 @@ dependencies: "@types/node" "*" +"@types/webdriverio@^4.8.0": + version "4.13.3" + resolved "https://registry.yarnpkg.com/@types/webdriverio/-/webdriverio-4.13.3.tgz#c1571c4e62724135c0b11e7d7e36b07af5168856" + integrity sha512-AfSQM1xTO9Ax+u9uSQPDuw69DQ0qA2RMoKHn86jCgWNcwKVUjGMSP4sfSl3JOfcZN8X/gWvn7znVPp2/g9zcJA== + dependencies: + "@types/node" "*" + "@typescript-eslint/eslint-plugin@2.10.0": version "2.10.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.10.0.tgz#c4cb103275e555e8a7e9b3d14c5951eb6d431e70" @@ -1193,6 +1200,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.2.tgz#e70c90579e02c63d80e3ad4e31d8bfdb8bd50064" + integrity sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -3006,6 +3018,11 @@ dev-null@^0.1.1: resolved "https://registry.yarnpkg.com/dev-null/-/dev-null-0.1.1.tgz#5a205ce3c2b2ef77b6238d6ba179eb74c6a0e818" integrity sha1-WiBc48Ky73e2I41roXnrdMag6Bg= +diff@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" + integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -5434,6 +5451,11 @@ make-dir@^3.0.0: dependencies: semver "^6.0.0" +make-error@^1.1.1: + version "1.3.5" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" + integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== + mamacro@^0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4" @@ -7636,7 +7658,7 @@ source-map-support@^0.5.13, source-map-support@~0.5.12: buffer-from "^1.0.0" source-map "^0.6.0" -source-map-support@^0.5.16: +source-map-support@^0.5.16, source-map-support@^0.5.6: version "0.5.16" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== @@ -8327,6 +8349,17 @@ truncate-utf8-bytes@^1.0.0: dependencies: utf8-byte-length "^1.0.1" +ts-node@8.5.4: + version "8.5.4" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.5.4.tgz#a152add11fa19c221d0b48962c210cf467262ab2" + integrity sha512-izbVCRV68EasEPQ8MSIGBNK9dc/4sYJJKYA+IarMQct1RtEot6Xp0bXuClsbUSnKpg50ho+aOAx8en5c+y4OFw== + dependencies: + arg "^4.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.6" + yn "^3.0.0" + tslib@^1.8.1, tslib@^1.9.0: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" @@ -9016,6 +9049,11 @@ yauzl@2.4.1: dependencies: fd-slicer "~1.0.1" +yn@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + zip-stream@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-1.2.0.tgz#a8bc45f4c1b49699c6b90198baacaacdbcd4ba04"