setup ava for ts, port test/ to ts

This commit is contained in:
Labhansh Agrawal 2019-12-14 12:01:15 +05:30 committed by Benjamin Staneck
parent acbf06e4ac
commit 09980caa67
8 changed files with 58 additions and 10 deletions

View file

@ -22,6 +22,13 @@
], ],
"helpers": [ "helpers": [
"**/testUtils/**/*" "**/testUtils/**/*"
],
"compileEnhancements": false,
"extensions": [
"ts"
],
"require": [
"ts-node/register/transpile-only"
] ]
}, },
"eslintConfig": { "eslintConfig": {
@ -297,6 +304,7 @@
"@types/seamless-immutable": "7.1.11", "@types/seamless-immutable": "7.1.11",
"@types/styled-jsx": "2.2.8", "@types/styled-jsx": "2.2.8",
"@types/uuid": "3.4.6", "@types/uuid": "3.4.6",
"@types/webdriverio": "^4.8.0",
"@typescript-eslint/eslint-plugin": "2.10.0", "@typescript-eslint/eslint-plugin": "2.10.0",
"@typescript-eslint/parser": "2.10.0", "@typescript-eslint/parser": "2.10.0",
"ava": "2.4.0", "ava": "2.4.0",
@ -324,6 +332,7 @@
"proxyquire": "2.1.3", "proxyquire": "2.1.3",
"spectron": "9.0.0", "spectron": "9.0.0",
"style-loader": "1.0.1", "style-loader": "1.0.1",
"ts-node": "8.5.4",
"typescript": "3.7.3", "typescript": "3.7.3",
"webpack": "4.41.2" "webpack": "4.41.2"
}, },

View file

@ -5,7 +5,7 @@ import path from 'path';
import test from 'ava'; import test from 'ava';
import {Application} from 'spectron'; import {Application} from 'spectron';
let app; let app: Application;
test.before(async () => { test.before(async () => {
let pathToBinary; let pathToBinary;
@ -40,5 +40,5 @@ test.after(async () => {
test('see if dev tools are open', async t => { test('see if dev tools are open', async t => {
await app.client.waitUntilWindowLoaded(); await app.client.waitUntilWindowLoaded();
t.false(await app.browserWindow.isDevToolsOpened()); t.false(await app.webContents.isDevToolsOpened());
}); });

View file

@ -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/ return /(^#[0-9A-F]{6,8}$)|(^#[0-9A-F]{3}$)/i.test(color); // https://regex101.com/
} }
module.exports.isHexColor = isHexColor; export {isHexColor};

View file

@ -2,10 +2,10 @@ import test from 'ava';
const proxyquire = require('proxyquire').noCallThru(); const proxyquire = require('proxyquire').noCallThru();
test('existsOnNpm() builds the url for non-scoped packages', t => { test('existsOnNpm() builds the url for non-scoped packages', t => {
let getUrl; let getUrl: string;
const {existsOnNpm} = proxyquire('../../cli/api', { const {existsOnNpm} = proxyquire('../../cli/api', {
got: { got: {
get(url) { get(url: string) {
getUrl = url; getUrl = url;
return Promise.resolve({ return Promise.resolve({
body: { body: {
@ -23,10 +23,10 @@ test('existsOnNpm() builds the url for non-scoped packages', t => {
}); });
test('existsOnNpm() builds the url for scoped packages', t => { test('existsOnNpm() builds the url for scoped packages', t => {
let getUrl; let getUrl: string;
const {existsOnNpm} = proxyquire('../../cli/api', { const {existsOnNpm} = proxyquire('../../cli/api', {
got: { got: {
get(url) { get(url: string) {
getUrl = url; getUrl = url;
return Promise.resolve({ return Promise.resolve({
body: { body: {

View file

@ -5,7 +5,8 @@
}, },
"include": [ "include": [
"./app/", "./app/",
"./lib/" "./lib/",
"./test/"
], ],
"references": [ "references": [
{ {

View file

@ -738,6 +738,13 @@
dependencies: dependencies:
"@types/node" "*" "@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": "@typescript-eslint/eslint-plugin@2.10.0":
version "2.10.0" version "2.10.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.10.0.tgz#c4cb103275e555e8a7e9b3d14c5951eb6d431e70" 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" delegates "^1.0.0"
readable-stream "^2.0.6" 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: argparse@^1.0.7:
version "1.0.10" version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" 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" resolved "https://registry.yarnpkg.com/dev-null/-/dev-null-0.1.1.tgz#5a205ce3c2b2ef77b6238d6ba179eb74c6a0e818"
integrity sha1-WiBc48Ky73e2I41roXnrdMag6Bg= 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: diffie-hellman@^5.0.0:
version "5.0.3" version "5.0.3"
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"
@ -5434,6 +5451,11 @@ make-dir@^3.0.0:
dependencies: dependencies:
semver "^6.0.0" 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: mamacro@^0.0.3:
version "0.0.3" version "0.0.3"
resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4" 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" buffer-from "^1.0.0"
source-map "^0.6.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" version "0.5.16"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042"
integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==
@ -8327,6 +8349,17 @@ truncate-utf8-bytes@^1.0.0:
dependencies: dependencies:
utf8-byte-length "^1.0.1" 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: tslib@^1.8.1, tslib@^1.9.0:
version "1.10.0" version "1.10.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
@ -9016,6 +9049,11 @@ yauzl@2.4.1:
dependencies: dependencies:
fd-slicer "~1.0.1" 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: zip-stream@^1.2.0:
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-1.2.0.tgz#a8bc45f4c1b49699c6b90198baacaacdbcd4ba04" resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-1.2.0.tgz#a8bc45f4c1b49699c6b90198baacaacdbcd4ba04"