Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": ["oclif", "oclif-typescript", "prettier"],
"rules": {
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "error"
"@typescript-eslint/no-useless-constructor": "error",
"node/no-missing-import": ["off"]
}
}
3 changes: 3 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ permissions:
id-token: write
contents: read

env:
NODE_OPTIONS: --experimental-vm-modules

jobs:
tarball:
strategy:
Expand Down
31 changes: 0 additions & 31 deletions bin/dev

This file was deleted.

2 changes: 1 addition & 1 deletion bin/dev.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ IF EXIST "%dp0%\node.exe" (
SET PATHEXT=%PATHEXT:;.JS;=;%
)

endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\dev" %*
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\dev.js" %*
36 changes: 36 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env ts-node

import { settings, Errors, flush, run } from "@oclif/core";
import path from "node:path";
import url from "node:url";
import { register } from "ts-node";

const project = path.join(
path.dirname(url.fileURLToPath(import.meta.url)),
"..",
"tsconfig.json"
);

// In dev mode -> use ts-node and dev plugins
// When `bin/dev.js` is invoked in integration-test it'll be "test"
process.env.NODE_ENV ||= "development";

register({ project });

// In dev mode, always show stack traces
// In test mode, stack traces shouldn't appeared in snapshot
if (process.env.NODE_ENV === "development") {
settings.debug = true;
}

// Start the CLI
run(process.argv.slice(2), import.meta.url)
.then(flush)
.catch((error) => {
const oclifHandler = Errors.handle;
if (error.response?.data)
error.message = `${error.message}: ${JSON.stringify(
error.response.data
)}`;
return oclifHandler(error);
});
9 changes: 4 additions & 5 deletions bin/run → bin/run.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/env node

const oclif = require("@oclif/core");
import { run, Errors, flush } from "@oclif/core";

oclif
.run()
.then(require("@oclif/core/flush"))
run(process.argv.slice(2), import.meta.url)
.then(flush)
.catch((error) => {
const oclifHandler = require("@oclif/core/handle");
const oclifHandler = Errors.handle;
if (error.response?.data)
error.message = `${error.message}: ${JSON.stringify(
error.response.data
Expand Down
2 changes: 1 addition & 1 deletion integration-test/bin/autify-cli-integration-test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require("../dist/bin/autify-cli-integration-test.js");
import "../dist/bin/autify-cli-integration-test.js";
2 changes: 1 addition & 1 deletion integration-test/bin/autify-mobile-generate-fake-app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require("../dist/bin/autify-mobile-generate-fake-app.js");
import "../dist/bin/autify-mobile-generate-fake-app.js";
2 changes: 1 addition & 1 deletion integration-test/bin/autify-with-proxy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require("../dist/bin/autify-with-proxy.js");
import "../dist/bin/autify-with-proxy.js";
1 change: 1 addition & 0 deletions integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"autify-mobile-generate-fake-app": "bin/autify-mobile-generate-fake-app.js",
"autify-with-proxy": "bin/autify-with-proxy.js"
},
"type": "module",
"homepage": "https://github.com/autifyhq/autify-cli",
"license": "MIT",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions integration-test/src/bin/autify-cli-integration-test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { execSync } from "node:child_process";
import path from "node:path";
import { argv, env } from "node:process";
import { fileURLToPath } from "node:url";

// eslint-disable-next-line unicorn/prefer-module
const scriptDir = __dirname;
const scriptDir = fileURLToPath(new URL(".", import.meta.url));
const rootDir = path.join(scriptDir, "..", "..");
const isRecord = Boolean(env.AUTIFY_CLI_INTEGRATION_TEST_RECORD);
const command = isRecord ? "test:record" : "test";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { androidBuildPath, iosBuildPath } from "../commands";
import { androidBuildPath, iosBuildPath } from "../commands.js";

// https://commons.wikimedia.org/wiki/File:Transparent.gif
const tinyBinary = Buffer.from(
Expand Down
6 changes: 3 additions & 3 deletions integration-test/src/bin/autify-with-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import path from "node:path";
import { argv, env, exit } from "node:process";
import { existsSync } from "node:fs";
import which from "which";
import { normalizeCommand } from "../commands";
import { normalizeCommand } from "../commands.js";
import { fileURLToPath } from "node:url";

Polly.register(NodeHttpAdapter);
Polly.register(FSPersister);
Expand Down Expand Up @@ -71,8 +72,7 @@ const filterRecording = ({ request, response }: HarEntry) => {

const createPolly = async (args: string[]) => {
const mode = getPollyMode();
// eslint-disable-next-line unicorn/prefer-module
const scriptDir = __dirname;
const scriptDir = fileURLToPath(new URL(".", import.meta.url));
const recordingsDir = path.join(
scriptDir,
"..",
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/golden/mobileBuildUpload.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile build upload /path/to/app-debug.apk --workspace-id AAA"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile build upload /path/to/ios.app --workspace-id AAA"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile build upload /path/to/app-debug.apk --workspace-id AAA --json"
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/golden/mobileTestRun.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile test run https://mobile-app.autify.com/projects/AAA/test_plans/BBB --build-id CCC"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile test run https://mobile-app.autify.com/projects/AAA/test_plans/BBB --build-path /path/to/app-debug.apk"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile test run https://mobile-app.autify.com/projects/AAA/test_plans/BBB --build-path /path/to/app-debug.apk --wait"
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/golden/mobileTestRunIos.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile test run https://mobile-app.autify.com/projects/AAA/test_plans/BBB --build-path /path/to/MyApp.app"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile test run https://mobile-app.autify.com/projects/AAA/test_plans/BBB --build-path /path/to/MyApp.app --wait"
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/golden/mobileTestRunWait.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"mobile test run https://mobile-app.autify.com/projects/AAA/test_plans/BBB --build-id CCC --wait"
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/golden/webTestRun.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"web test run https://app.autify.com/projects/0000/scenarios/0000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"web test run https://app.autify.com/projects/0000/scenarios/0000 --wait --autify-connect-client"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"web test run https://app.autify.com/projects/0000/test_plans/0000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"web test run https://app.autify.com/projects/0000/test_plans/0000 --wait --autify-connect-client"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"web test run https://app.autify.com/projects/0000/test_plans/0000 --wait"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
'web test run https://app.autify.com/projects/0000/scenarios/0000 -r "https://example.com https://example.net?foo=bar"'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
'web test run https://app.autify.com/projects/0000/scenarios/0000 -r "https://example.com=https://example.net?foo=bar"'
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/golden/webTestRunWait.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot";
import { testAutifyCliSnapshot } from "../helpers/testAutifyCliSnapshot.js";

testAutifyCliSnapshot(
"web test run https://app.autify.com/projects/0000/scenarios/0000 --wait"
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/helpers/testAutifyCliSnapshot.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/filename-case */
import { execAutifyCli } from "../helpers/execAutifyCli";
import { execAutifyCli } from "../helpers/execAutifyCli.js";

export const testAutifyCliSnapshot = (command: string): void => {
test(`autify ${command}`, async () => {
Expand Down
8 changes: 6 additions & 2 deletions integration-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
"compilerOptions": {
"declaration": true,
"importHelpers": true,
"module": "commonjs",
"module": "ESNext",
"moduleResolution": "node",
"outDir": "dist",
"rootDir": "src",
"strict": true,
"target": "es2019",
"esModuleInterop": true,
"types": ["express", "jest", "node", "which"]
},
"include": ["src/**/*"]
"include": ["src/**/*"],
"ts-node": {
"esm": true
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "Autify Command Line Interface (CLI)",
"author": "Autify",
"bin": {
"autify": "./bin/run"
"autify": "./bin/run.js"
},
"type": "module",
"homepage": "https://github.com/autifyhq/autify-cli",
"license": "MIT",
"main": "dist/index.js",
Expand Down Expand Up @@ -152,13 +153,13 @@
"prepack": "npm run build && oclif manifest && oclif readme",
"release": "ts-node ./scripts/release.ts",
"test:integration": "npm run build -w integration-test && autify-cli-integration-test",
"test:integration:dev": "npm run build -w integration-test && cross-env AUTIFY_CLI_PATH=../bin/dev autify-cli-integration-test",
"test:integration:dev": "npm run build -w integration-test && cross-env AUTIFY_CLI_PATH=../bin/dev.js autify-cli-integration-test",
"test:integration:record": "npm run build -w integration-test && cross-env AUTIFY_CLI_INTEGRATION_TEST_RECORD=1 AUTIFY_CONNECT_CLIENT_MODE=real autify-cli-integration-test",
"test:integration:dev:record": "npm run build -w integration-test && cross-env AUTIFY_CLI_PATH=../bin/dev AUTIFY_CLI_INTEGRATION_TEST_RECORD=1 AUTIFY_CONNECT_CLIENT_MODE=real autify-cli-integration-test",
"test:integration:dev:record": "npm run build -w integration-test && cross-env AUTIFY_CLI_PATH=../bin/dev.js AUTIFY_CLI_INTEGRATION_TEST_RECORD=1 AUTIFY_CONNECT_CLIENT_MODE=real autify-cli-integration-test",
"test:integration:connect": "AUTIFY_CONNECT_CLIENT_MODE=fake autify connect client install && npm run test:integration AutifyConnectClient",
"test:integration:connect:dev": "AUTIFY_CONNECT_CLIENT_MODE=fake ./bin/dev connect client install && npm run test:integration:dev AutifyConnectClient",
"test:integration:connect:dev": "AUTIFY_CONNECT_CLIENT_MODE=fake ./bin/dev.js connect client install && npm run test:integration:dev AutifyConnectClient",
"test:integration:connect:record": "autify connect client install && npm run test:integration:record AutifyConnectClient",
"test:integration:connect:dev:record": "./bin/dev connect client install && npm run test:integration:dev:record AutifyConnectClient",
"test:integration:connect:dev:record": "./bin/dev.js connect client install && npm run test:integration:dev:record AutifyConnectClient",
"version": "oclif readme && git add README.md",
"prepare": "per-env || true",
"prepare:development": "husky install",
Expand Down
2 changes: 1 addition & 1 deletion scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "node:fs";
import { homedir, tmpdir } from "node:os";
import { join } from "node:path";
import pkg from "../package.json";
import pkg from "../package.json" assert { type: "json" };

const { version, oclif: oclifConfig } = pkg;

Expand Down
2 changes: 1 addition & 1 deletion src/autify/connect/accessPointConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable unicorn/filename-case */
import { CLIError } from "@oclif/errors";
import inquirer from "inquirer";
import { get, set } from "../../config";
import { get, set } from "../../config.js";

export const confirmOverwriteAccessPoint = async (
configDir: string
Expand Down
Loading