Commit Graph

269 Commits

Author SHA1 Message Date
Joe Previte 883dd13850
refactor: move jest and add package.json to /test 2021-01-21 14:06:49 -07:00
Joe Previte 850c7e1a91
fix: add void for resolve in socket test 2021-01-21 10:11:10 -07:00
Joe Previte 0a07d67c8d
fix: prevent mocha/jest types conlict
Modify the tsconfig.json in lib/vscode/src/build.

This adds the flag skipLibCheck: true to tell TypeScript
to not type-check the declaration files at build time.

We need to add this because otherwise it checks the declaration
files and reports an error of duplicate type definitions
because we use Jest for our tests and they use Mocha and they
both use the global namespace "test" in their .d.ts files.
2021-01-21 10:11:09 -07:00
Joe Previte de7d0394ae
refactor: tests from mocha to jest 2021-01-21 10:10:32 -07:00
Joe Previte cef7d42652
feat: setup jest 2021-01-21 10:10:32 -07:00
Anmol Sethi c32d8b155f
heart.ts: Fix leak when server closes
This had me very confused for quite a while until I did a binary search
inspection on route/index.ts. Only with the heart.beat line commented
out did my tests pass without leaking.

They weren't leaking fds but just this heartbeat timer and node of
course prints just fds that are active when it detects some sort of leak
I guess and that made the whole thing very confusing. These fds are not
leaked and will close when node's event loop detects there are no more
callbacks to run.

no of handles 3

tcp stream {
  fd: 20,
  readable: false,
  writable: true,
  address: {},
  serverAddr: null
}

tcp stream {
  fd: 22,
  readable: false,
  writable: true,
  address: {},
  serverAddr: null
}

tcp stream {
  fd: 23,
  readable: true,
  writable: false,
  address: {},
  serverAddr: null
}

It kept printing the above text again and again for 60s and then the
test binary times out I think. I'm not sure if it was node printing the
stuff above or if it was a mocha thing. But it was really confusing...

cc @code-asher for thoughts on what was going on.

edit: It was the leaked-handles import in socket.test.ts!!!
Not sure if we should keep it, this was really confusing and misleading.
2021-01-20 02:06:44 -05:00
Anmol Sethi 5c06646f58
Formatting and linting fixes 2021-01-20 02:06:44 -05:00
Anmol Sethi 60233d0974
test/proxy.test.ts: Implement 2021-01-20 02:06:44 -05:00
Anmol Sethi 240c8e266e
test: Implement integration.ts for near full stack integration testing 2021-01-20 02:06:44 -05:00
Anmol Sethi 64e915de4a
test: Rename testutil.ts to httpserver.ts 2021-01-20 02:06:44 -05:00
Anmol Sethi d3074278ca
app.ts: Fix createApp to log all http server errors
cc @code-asher
2021-01-20 02:06:43 -05:00
Anmol Sethi 8acb2aec11
plugin.test.ts: Switch to testutil.HttpServer 2021-01-20 02:06:43 -05:00
Anmol Sethi ea1949e440
test: Add testutil.HttpServer
The goal is to remove supertest as it does not support typescript well
and there's really no good reason for the dependency. Also no websocket
testing support.
2021-01-20 02:06:43 -05:00
Anmol Sethi 60c270aef5
cli: hashedPassword -> hashed-password (#2454)
Capital letters in the CLI are evil.

cc @code-asher
2020-12-18 12:20:38 -05:00
Joe Previte b1282b9707
refactor: fix bug in --home test 2020-12-14 16:23:35 -07:00
Joe Previte 8daba6ca80
feat: add home as a cli option 2020-12-14 16:23:35 -07:00
SPGoding 1dd7e4b4e1
Add hashedPassword config (#2409)
Resolve #2225.
2020-12-08 14:54:17 -06:00
Anmol Sethi 9917da068a
v3.7.0 2020-11-16 11:11:50 -05:00
Asher 96995b78d1
Update cert flag test 2020-11-12 12:29:41 -06:00
Asher e1702a1d21
Merge branch master into code-asher/ch1385 2020-11-12 11:52:02 -06:00
Anmol Sethi fe399ff0fe
Fix formatting 2020-11-06 14:47:08 -05:00
Anmol Sethi 9d39c53c99
plugin: Give test-plugin some html to test overlay 2020-11-06 14:47:08 -05:00
Anmol Sethi 197a09f0c1
plugin: Test endpoints via supertest
Unfortunately we can't use node-mocks-http to test a express.Router
that has async routes. See https://github.com/howardabrams/node-mocks-http/issues/225

router will just return undefined if the executing handler is async and
so the test will have no way to wait for it to complete. Thus, we have
to use supertest which starts an actual HTTP server in the background
and uses a HTTP client to send requests.
2020-11-06 10:13:01 -05:00
Anmol Sethi 14f408a837
plugin: Plugin modules now export a single top level identifier
Makes typing much easier. Addresse's Will's last comment.
2020-11-06 10:13:01 -05:00
Anmol Sethi 2a13d003d3
plugin.ts: Add homepageURL to plugin and application 2020-11-06 10:12:47 -05:00
Anmol Sethi 687094802e
plugin.ts: Make application endpoint paths absolute 2020-11-06 10:12:46 -05:00
Anmol Sethi 139a28e0ea
plugin.ts: Describe private counterpart functions
Addresses Will's comments.
2020-11-06 10:12:46 -05:00
Anmol Sethi afff86ae9c
plugin.ts: Adjust to implement pluginapi.d.ts correctly 2020-11-06 10:12:46 -05:00
Anmol Sethi fed545e67d
plugin.d.ts -> pluginapi.d.ts
More clear.
2020-11-06 10:12:46 -05:00
Anmol Sethi 75e52a3774
plugin.ts: Fixes for @code-asher 2020-11-06 10:12:46 -05:00
Anmol Sethi ef971009d9
plugin.test.ts: Make it clear iconPath is a path 2020-11-06 10:12:46 -05:00
Anmol Sethi 30d2962e21
src/node/plugin.ts: Warn on duplicate plugin and only load first 2020-11-06 10:12:46 -05:00
Anmol Sethi 82e8a00a0d
Fix CI 2020-11-06 10:12:46 -05:00
Anmol Sethi bea185b8b2
plugin: Add basic loading test
Will work on testing overlay next.
2020-11-06 10:12:46 -05:00
Anmol Sethi bae28727bd
src/node/cli.ts: Add --cert-host to configure generated certificate hostname 2020-10-30 13:36:53 -04:00
Asher 112eda4605
Convert routes to Express 2020-10-26 17:56:13 -05:00
Asher 9f25cc6d5d
Move providers from `app` to `routes` 2020-10-20 16:18:27 -05:00
Asher 2928d362fa
Move heart and AuthType out of http
This file is going to get blasted in favor of Express.
2020-10-20 16:18:24 -05:00
Asher dcb303a437
Move argument defaults into setDefaults 2020-10-20 16:15:13 -05:00
Asher fe19391c03
Read most recent socket path from file 2020-10-09 16:57:43 -05:00
Asher 021c084e43
Move log level defaults into setDefaults
This will allow cliArgs to be only the actual arguments the user passed
which will be used for some logic around opening in existing instances.
2020-10-09 16:57:42 -05:00
Anmol Sethi 7991e09bbc
Skip update tests (#2059)
We don't use auto updating anymore and the tests are randomly failing
so just disabling for now.
2020-09-04 06:30:15 -04:00
Asher d8568ebaa9
Enforce import order 2020-08-13 17:11:35 -05:00
Asher f7790c9719
Remove unused deep merge code 2020-08-13 17:11:34 -05:00
Asher 554b6d6fcf
Remove apply portion of update endpoint
It can still be used to check for updates but will not apply them.

For now also remove the update check loop in VS Code since it's
currently unused (update check is hardcoded off right now) and won't
work anyway since it also applies the update which now won't work. In
the future we should integrate the check into the browser update
service.
2020-07-29 18:48:02 -05:00
Asher e8f6d30055
Make providers endpoint-agnostic
A provider can now be registered on multiple endpoints (or potentially
moved if needed).
2020-07-27 12:00:48 -05:00
Anmol Sethi c00f931500
Remove zip library dependency 2020-06-03 18:24:59 -04:00
Anmol Sethi 8053ec6872
Allow user-data-dir and extension-dir in config.yaml
Closes #1676
2020-05-19 00:41:27 -04:00
Anmol Sethi 5651201643
Copy old macOS data directory if applicable 2020-05-14 06:12:33 -04:00
Anmol Sethi 00d164b67f
Add default config file and improve config/data directory detection 2020-05-12 19:59:54 -04:00
Asher a2b69c8f3f
Fix inconsistencies in log flags and env var
- Fix priority to match the commented behavior.
- Ignore bogus LOG_LEVEL values.
2020-04-28 17:57:55 -05:00
Anmol Sethi af28885ea6
Deprecate --host and --port in favour of --bind-addr 2020-04-28 14:19:24 -04:00
Anmol Sethi d0d5461a67
Remove SSH server
Closes #1502
2020-04-27 09:27:45 -04:00
Asher 5aded14b87
Merge pull request #1453 from cdr/proxy
HTTP proxy
2020-04-08 12:44:29 -05:00
Asher d1445a8135
Back up code-server directory when updating 2020-04-02 16:21:48 -05:00
Asher 13534fa0c0
Add proxy-domain flag
This will be used for proxying ports.
2020-04-02 13:40:14 -05:00
Asher 0a5687bacf
Fix crash when unable to request an update 2020-03-25 15:00:35 -05:00
Asher 308a84e6ec
Fix centos image for arm64 2020-03-04 13:12:03 -06:00
Asher ccd01c49b9
Integrate update notifications into VS Code 2020-03-02 15:01:24 -06:00
Asher c870398c86
Switch to loose files
For #1306.
2020-02-25 18:23:35 -06:00
Asher e44ac0a30e
Use last positional argument as working directory
Instead of the first.
2020-02-20 18:48:17 -06:00
Asher 319cd3f7ab
Make updating work for both binary and loose releases 2020-02-20 18:48:16 -06:00
Asher 0e2eaa9b34
Add valid values for --log 2020-02-19 11:11:29 -06:00
Asher 0263188431
Handle --long=value format in the cli parser 2020-02-19 10:54:23 -06:00
Asher 46d6e17508
Prepare for release
- Add VS Code icon
- Trim dashboard to just display dedicated VS Code section
- Version was getting unset during build
- Add back nbin shim which I temporarily took out earlier
- Update tests for log level env var changes
2020-02-18 17:31:23 -06:00
Anmol Sethi 4aa15401c3
Format and lint 2020-02-14 20:00:19 -05:00
Asher 256419004d
Implement cli parser 2020-02-07 14:43:08 -06:00
Asher 8cc11d1688
Improve routing 2020-02-05 13:07:07 -06:00
Asher b29346ecdf
Implement new structure 2020-02-04 14:31:44 -06:00