Commit Graph

117 Commits

Author SHA1 Message Date
Pagan Gazzard
82e17cea6a Update dependencies to pick up performance improvements
Change-type: patch
2020-04-21 15:42:56 +01:00
Scott Lowe
bbcb3a702f Add test coverage for validation module
Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
2020-04-21 09:23:55 +02:00
Scott Lowe
be82bcfa63 convert commands key, keys, key add, key rm to oclif.
Also:
 - Display keys with `name` instead of `title`.
 - Check for empty key before calling API.

Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
2020-04-20 16:07:39 +02:00
Scott Lowe
3aa72dde4c Convert commands join, leave to oclif.
Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
2020-04-09 20:50:42 +02:00
Pagan Gazzard
b3b22d6399 Use balena-lint for javascript linting and add javascript type-checking
Change-type: patch
2020-03-25 12:12:03 +00:00
Pagan Gazzard
1ee74df67e Add type checking for tests
Change-type: patch
2020-03-24 16:42:18 +00:00
Pagan Gazzard
3d2e109e7f Update dependencies
Update balena-sdk from 12.26.7 to 12.29.1

Change-type: minor
2020-03-12 18:03:10 +00:00
Paulo Castro
daa34feeda Add test case for build --emulated
Connects-to: #1649
Change-type: patch
2020-03-11 22:02:01 +00:00
Pagan Gazzard
235c13bea9 Switch to object spreading in favor of _.assign
Change-type: patch
2020-02-29 22:08:10 +00:00
Pagan Gazzard
eac6bb5e5c Simplify lazy-loading of balena-sdk by utilizing a shared function
This also avoids instantiating multiple balena-sdk

Change-type: patch
2020-02-27 17:17:36 +00:00
Paulo Castro
9e870b08a7 Add tests for project directory validation
Change-type: patch
2020-02-17 15:19:07 +00:00
Paulo Castro
671dca8287 Add project directory validation for balena push / build / deploy commands
Change-type: minor
2020-02-17 15:19:07 +00:00
Paulo Castro
0738dd1520 Add and refactor tests for push/build/deploy commands (docker-compose)
Change-type: patch
2020-02-17 15:19:07 +00:00
Paulo Castro
88a1e413a3 Fix balena push "Segmentation fault" on Windows (replace 'mmmagic' with 'isBinaryFile')
Connects-to: #1611
Change-type: patch
2020-02-13 15:51:45 +00:00
Paulo Castro
1a74dcf4cf Re-add windows-crlf.sh to git index (fix git warnings) 2020-02-12 17:34:17 +00:00
Pagan Gazzard
93ba5832d8 Convert lib/auth/server to typescript
Change-type: patch
2020-02-12 12:10:12 +00:00
Paulo Castro
4502f2a203 Avoid loading 'mmmagic' on Linux (fix "could not load any valid magic files")
Resolves: #1596
Change-type: patch
2020-02-05 23:59:11 +00:00
Paulo Castro
f9743b269a Add more tests for push/build/deploy commands (--convert-eol)
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2020-02-02 20:16:57 +00:00
Paulo Castro
0f5f65e0d3 Add more tests for push/build/deploy commands (--dockerfile)
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2020-02-02 20:16:43 +00:00
Paulo Castro
1e37c97ffb Fix proxy support and add proxy exclusion feature (Node.js >= 10.16.0 only)
See README for more details on proxy configuration and Node.js compatibility.

Resolves: #1579
Resolves: #1335
Connects-to: #1580
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2020-01-27 12:11:11 +00:00
Pagan Gazzard
77931b314a Update dependencies
Change-type: minor
2020-01-24 23:28:15 +00:00
Paulo Castro
b978230f9e Update resin-lint and prettier, and re-prettify
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2020-01-20 22:46:32 +00:00
Paulo Castro
cc5fe60a15 Add tests for push, deploy and build commands
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2020-01-20 13:27:52 +00:00
Matthew McGinn
046743071d meta: Americanize all spellings
Connects-to: https://github.com/balena-io/docs/issues/1300
Change-type: patch
Signed-off-by: Matthew McGinn <matthew@balena.io>
2020-01-03 13:42:34 -05:00
Paulo Castro
323c9191b6 Add --verbose and --json options to the 'devices supported' command
The command was also converted to oclif.

Resolves: #467
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-12-27 11:54:27 +00:00
Scott Lowe
33552724a1 Fix issues with devices associated with inaccessible applications.
Change-type: patch
Resolves: #1530
Signed-off-by: Scott Lowe <scott@balena.io>
2019-12-13 09:33:59 +01:00
Paulo Castro
7fd436cd91 Add multicontainer (microservices) support for 'balena env rename'
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-12-12 13:39:26 +00:00
Paulo Castro
7c1faa6de0 Add multicontainer (microservices) support for 'balena env rm'
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-12-12 13:39:26 +00:00
Paulo Castro
90e184ea1f Add multicontainer (microservices) support for 'balena env add'
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-12-11 17:50:08 +00:00
Paulo Castro
38920a1c59 Add multicontainer (microservices) support for 'balena envs'
Connects-to: #1153
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-12-11 17:50:08 +00:00
Paulo Castro
df58ac7673 Add balena envs '-j' option to produce JSON output
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-12-06 15:51:09 +00:00
Paulo Castro
630d53311a Add logged-in check for balena 'env' commands
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-12-06 15:51:09 +00:00
Scott Lowe
bb19903826 Update app/create and device/supported tests to use new api-mock.
Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
2019-12-05 15:10:44 +01:00
Scott Lowe
33210b896b Introduce balena-api-mock module to simplify api mocking.
Upgrade nock to latest.

Change-type: minor
Signed-off-by: Scott Lowe <scott@balena.io>
2019-12-05 15:10:34 +01:00
Scott Lowe
1325fb8c9a Use helpers version of cleanOutput in tests.
Simplify expect semantics in tests.

Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
2019-11-15 12:01:56 +01:00
Scott Lowe
cf42dca777 Hide discontinued device types in balena app create.
Add basic tests for `balena app create`

Connects-to: #1485
Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
2019-11-15 12:01:56 +01:00
Scott Lowe
afd97bd304 Hide discontinued device types in balena devices supported.
Add tests for action.
Convert action to TypeScript.

Connects-to: #1485
Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
2019-11-15 12:01:55 +01:00
Paulo Castro
d94a74dfee Fix 'os configure --config', and migrate it to oclif + TypeScript
Also add more non-interactive configuration options:
--config-network, --config-wifi-*, --config-app-update-poll-interval

Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-11-12 21:09:18 +00:00
Paulo Castro
b69ba0b617 Improve command usage format consistency in 'balena help' output
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-11-10 00:54:22 +00:00
Paulo Castro
2222a90884 Enable debug-mode "long stack traces" for Bluebird promises (async code)
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-11-10 00:54:22 +00:00
Scott Lowe
4a967b126b Fix warnings when executing CLI without arguments.
Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
2019-11-01 16:21:36 +01:00
Paulo Castro
cc45d872c7 Update CLI tests to pass with Node 12
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-10-14 01:27:34 +01:00
Paulo Castro
c07b28e694 Migrate 'envs' and 'env rename' commands to oclif
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-09-18 12:54:31 +01:00
Paulo Castro
19c3178062 Enable emulated builds on remote devices running a different OS as the CLI
E.g. "balena build -e -h <IP> -p 2375" with the CLI running on a Mac laptop,
using balenaEngine on an Intel NUC device, building an image for the RPi (ARM
image arch). Previously, QEMU setup by the CLI assumed that docker ran on the
same OS as the CLI (Docker for Mac has built-in binfmt_misc support and does
not require additional setup, but balenaEngine on Linux requires explicit QEMU
setup.)

Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
2019-08-22 13:37:07 +01:00
Lucian
730c09989d Fix incorrect arguments passed to oclif bootstrap function
Adds tests for existing oclif commands to avoid regressions

Change-type: patch
Signed-off-by: Lucian <lucian.buzzo@gmail.com>
2019-08-15 18:26:42 +01:00
Lucian
4d389bb6cc Implement full command testing, beginning with "balena version"
This also modifies the core CLI to be fed command programatically, which
is useful for being able to do thing like mock endpoints with tools like
"nock", and provide an easier debugging experience.
The tests utilise a "runCommand" helper that intercepts and captures
stdout/stderr writes and returns them once the command has finished
running. At this point the test implementation can parse the
stdout/stderr logs and assess nock interceptions to determine if the
command ran correctly.
This change also homogenises debug messages to start with `[debug]`,
however this is not strictly enforced by linting rules.

Change-type: minor
Signed-off-by: Lucian <lucian.buzzo@gmail.com>
2019-08-12 14:50:41 +01:00
Lucian
13610ef814 Convert test files to Typescript
Change-type: patch
Signed-off-by: Lucian <lucian.buzzo@gmail.com>
2019-08-08 16:50:50 +01:00
Lucian
ebd8f348ca Decaffeinate test files
Change-type: patch
Signed-off-by: Lucian <lucian.buzzo@gmail.com>
2019-08-08 13:53:00 +01:00
Lucian
15dfdc2229 Remove mochainon dependency and replace with direct testing dependencies
Change-type: patch
Signed-off-by: Lucian <lucian.buzzo@gmail.com>
2019-08-08 10:04:32 +01:00
Tim Perry
4907fccf48 Rename everything from 'resin' to 'balena'
Change-type: major
2018-10-29 22:29:02 +01:00
Cameron Diver
88e11347bc tests: Add tests for ignore files
Signed-off-by: Cameron Diver <cameron@resin.io>
2018-10-19 16:43:28 +02:00
Tim Perry
ce64889b04 Clarify isTokenValid logic 2018-03-29 11:11:25 +02:00
Tim Perry
d3a0bfc5f6 Fix auth utils tests to work with new SDK 2018-03-29 11:11:25 +02:00
Tim Perry
0e2fb8c96c Promisify auth utils tests 2018-03-29 11:11:25 +02:00
Tim Perry
001c8f9601 Inline the entire resin-cli-auth module
This is part of a general push to demodularize any code that isn't
realistically reusable outside resin-cli, to make the codebase easier to
manage and understand. Once this is done, we'll deprecate the original
module itself.

Change-Type: patch
2017-11-27 12:02:57 +02:00
Juan Cruz Viotti
904b9f07fb Highlight errors in red
- Move error translation logic to resin-io/resin-cli-errors.
- Force `process.exit()`.
2015-09-11 14:47:38 +03:00
Juan Cruz Viotti
f712064ab4 Move tests to tests/ and flatten errors/ module directory 2015-02-10 11:38:19 -04:00
Juan Cruz Viotti
043a34cc7c Decouple permissions from http mocks and fixtures 2015-01-13 08:51:02 -03:00
Juan Cruz Viotti
f000509995 Get rid of utils/mock 2015-01-08 09:43:50 -03:00
Juan Cruz Viotti
12f46be691 Partially get rid of nested sdk 2015-01-08 09:39:38 -03:00
Juan Cruz Viotti
8ac36ced4d Decouple resin sdk from it's surroundings 2015-01-06 15:02:03 -03:00
Juan Cruz Viotti
08e8cfbb09 Fix settings get bug in mocks 2014-12-05 11:49:00 -04:00
Juan Cruz Viotti
511e753256 Support user defined configuration file 2014-12-03 12:03:54 -04:00
Juan Cruz Viotti
9529e6c335 Move config to resin module 2014-11-26 13:42:05 -04:00
Juan Cruz Viotti
a6099b227b Require internet connection before attempting to use server module 2014-11-25 09:02:50 -04:00
Juan Cruz Viotti
58cc0be0c9 Cleanup tests 2014-11-14 15:48:37 -04:00
Juan Cruz Viotti
41d73eaf98 Implement precarious token persistence mechanism 2014-10-31 15:19:16 -04:00