Commit Graph

75 Commits

Author SHA1 Message Date
omochimetaru 305c204495
Check the output of wasm in dev subcommand test (#473) 2024-05-28 22:08:39 +09:00
omochimetaru f7d0b5640f
Combine the WebDriver setup process into WebDriverService and make it easier to reuse (#474) 2024-05-28 10:12:51 +09:00
omochimetaru 6cc68d3ba8
Show stdout/stderr from Wasm in terminal (#472) 2024-05-25 09:06:24 +09:00
omochimetaru 3cb3877d98
Send stdout/stderr from WasmRunner to dev server without decoding as UTF-8 (#471)
* Enable WasmRunner to handle stdout as raw binary

* catch other errors

* move devDeps

* use browser exception handling

* comment out
2024-05-25 01:33:13 +09:00
omochimetaru 59730f982f
Add granular configuration for retrying wait time in test (#470)
* kick CI

* improve withRetry utility
2024-05-23 14:37:20 +09:00
omochimetaru b26110bfa2
Remove test utility `ls` (#469)
* remove ls

* kick CI
2024-05-23 00:53:38 +09:00
omochimetaru a599a50532 remove AbsolutePath.exists 2024-05-22 22:06:55 +09:00
omochimetaru 9c89fe7847 remove AbsolutePath.url 2024-05-22 22:00:52 +09:00
omochimetaru cd9ead1398 Merge remote-tracking branch 'origin/main' into reduce-test-utils 2024-05-22 21:55:37 +09:00
omochimetaru c678563026 remove AbsolutePath.url 2024-05-22 21:55:16 +09:00
Yuta Saito 5959492410 Fix `checkCartonTestFail` to ensure the process terminated with non-zero code 2024-05-22 12:51:51 +09:00
Yuta Saito d5b873145a Revert "Skips browser testing due to freezing"
This reverts commit f6f1712733.
2024-05-22 12:21:30 +09:00
omochimetaru eba0fdb76c
Add unit test for dev server (#466)
* make CartonCore module and move Environment

* refactor DevCommandTests.checkForExpectedContent

* add DevServerTestApp Fixture

* add FrontendDevServerTests
2024-05-22 11:31:19 +09:00
omochimetaru 6f4c5302f8
Stream command outputs while capturing them for testing (#461)
* Stream and capture both from swift-run in testcase

* kick ci
2024-05-20 22:55:34 +09:00
omochimetaru 27fcd29a1a
Stop defining test utilities under XCTest (#456) 2024-05-20 00:27:32 +09:00
omochimetaru e7e0d1174c
Re-organize the naming convention of module, type, product, and file to have consistent project structure (#450)
* rename modules

* rename to CartonReleaseCommand

* call async overload

* fix commandName

* frontend name
2024-05-19 15:51:10 +09:00
omochimetaru 20cc436894 fix test failure 2024-05-19 07:31:08 +09:00
omochimetaru f6f1712733 Skips browser testing due to freezing 2024-05-19 07:31:08 +09:00
omochimetaru 848ae5aec4 fix process env 2024-05-18 04:38:06 +09:00
omochimetaru c7cad4967e fix double negative logic 2024-05-17 14:04:38 +09:00
omochimetaru 6ebc4798dd generalize findExecutable 2024-05-17 14:04:38 +09:00
Yuta Saito e4ea08a05b Add `--no-content-hash` flag to avoid using hashes in the output file names 2024-02-27 02:23:12 +09:00
Yuta Saito 993983ff98 Remove development files from the repository 2024-02-26 18:48:01 +09:00
Yuta Saito 4535b3a1fc Skip test product build if prebuilt test bundle is specified 2024-02-26 18:48:01 +09:00
Yuta Saito 2e62088305 Version 1.0.0: SwiftPM Plugin Support
See CHANGELOG.md
2024-02-26 18:48:01 +09:00
Yuta Saito a19e1ac541
Update default toolchain version to 5.8 channel snapshot (#398) 2023-05-08 21:00:19 +09:00
Yuta Saito b79fe9a260
Update SwiftPM branch to 5.8 and fix build errors (#395)
* Update SwiftPM branch to 5.8 and fix build errors

* Make swift-format 5.8 happy :)

* Make swift-format 5.8 happy for Tests

* Fix wrong formatting

* Resolve AbsolutePath(validating:) rename warnings

* Fix wrong formatting

* Resolve remaining deprecation warnings

* Fix Linux build failure
2023-05-04 18:40:16 +09:00
Yuta Saito 2fe7118e51
Update default toolchain version to 5.7.1 (#383) 2022-09-29 23:31:48 +08:00
Yuta Saito daf152d93d
Update SwiftPM library version to 5.7 (#381) 2022-09-25 20:52:39 +09:00
noppefoxwolf bdb5d5944a
Use @main attributes (#378) 2022-09-14 19:38:59 +09:00
Yuta Saito 2fa2568a16
Exit non-zero status when test fail on browser (#370)
* Add crash test case

* Exit non-zero status when test fail

also handle JS exception
2022-07-19 01:28:40 +09:00
Yuta Saito 646f1aef85
Headless test runner (#362)
* Add WebDriverClient for headless testing

* Launch new session with headless arg by default

* Add --headless option in carton test

* Improve logging message

* Apply formatter for WebDriverClient module

* Support MS Edge

* Add headless testing test

* Explicitly depend on NIOFoundationCompat

* Avoid public actor field as a 5.5 compiler crash workaround

* Add --headless description in README.md

* Update Sources/CartonCLI/Commands/Test.swift

Co-authored-by: Max Desiatov <max@desiatov.com>

* Apply suggestions from code review for wording

Co-authored-by: Max Desiatov <max@desiatov.com>

* Rename failedToFindDriver -> failedToFindWebDriver

* Rephrase diagnostic message

* Omit explicit internal keyword

* Remove unused goto.Response struct

* Add license header to Tests/WebDriverClientTests/WebDriverClientTests.swift

Co-authored-by: Max Desiatov <max@desiatov.com>

Co-authored-by: Max Desiatov <max@desiatov.com>
2022-06-10 16:42:20 +00:00
Geordie J eef2825f78
Add option to disable wasm optimizations (#359)
I am trying to implement an `esbuild` plugin that calls into `carton`. My plan was to call `carton bundle --debug` to get a quick development build and then extract that command's output for use in our esbuild project.

Unfortunately, `carton bundle` still runs `wasm-opt` even on a debug build, which takes 5-10s for our project. The only alternative I can see is `carton dev`, but that runs the dev server / watcher, which we don't want either for a one-off build.

Since changing the behaviour of `carton bundle --debug` to _not_ run `wasm-opt` may cause issues with backwards compatibility, @MaxDesiatov suggested we add a command line option `--wasm-optimizations {size, none}` instead, allowing users to specifically opt out of this behaviour.
2022-06-02 18:40:00 +01:00
Yuta Saito 820c2afab7
Add --bundle-path option to `carton test` (#358)
* Add --skip-build option to carton test to delegate building to users

* Add test case for --skip-build

* Rename --skip-build to --bundle-path to allow specifying binary path

* Update Sources/CartonCLI/Commands/Test.swift

Co-authored-by: Max Desiatov <max@desiatov.com>

* Rename --bundle-path to --prebuilt-test-bundle-path

* Update Sources/CartonCLI/Commands/Test.swift

Co-authored-by: Max Desiatov <max@desiatov.com>

Co-authored-by: Max Desiatov <max@desiatov.com>
2022-05-30 16:04:03 +00:00
Yuta Saito 154149b6ea
Clean up integration tests and fixtures (#355) 2022-05-28 09:33:27 +00:00
Carson Katri 7b4c35fc6a
Use standards mode in default index page (#351) 2022-05-23 16:08:47 +00:00
Max Desiatov 683e3e0759
Bump version to 0.15.0, update `CHANGELOG.md` (#348) 2022-05-20 15:27:53 +01:00
Max Desiatov 53bc06c23d
Fix watcher breakage on failed builds (#347)
After switching to `async`/`await` the value of `isBuildCurrentlyRunning` wasn't correctly reset, which led to issues. By resetting the variable in `defer` we guarantee that it will be reset even when errors are thrown.

Resolves #339.
2022-05-20 13:03:34 +00:00
Max Desiatov 1ba7dd5d82
Use JSKit runtime from SwiftPM resources (#335)
* Use JSKit runtime from SwiftPM resources

* Fix Node.js test runner

* Remove unused webpack npm packages

* Update Swift version in `.swiftformat`

* Fix browser and Node.js CJS/ESM handling

* Fix one of the tests, add CI time limit

* Use Tokamak `update-jskit` branch to fix tests

* Use latest Vapor with `.mjs` content-type fix

* Use dynamic import to detect JSKit presence

* Fix missing `runtimeConstructor` reference

* Update `StaticArchive.swift`

* Reduce the diff

* Address PR feedback

* Fix Node.js <-> JSKit integration test

* Update SwiftPM dependencies

* Fix comment typo in `testNode.js`

* Reuse `__stack_sanitizer` across entrypoints
2022-05-20 13:12:45 +01:00
Antonio Candinho 505a9b81a2
Add support for running tests using NodeJS (#328)
### 🎩 What is the goal?

Implement NodeJS as another test runner. 

### 📄 How is it being implemented?

In this PR, I include the following changes:

 - Create an abstraction for the different Test Runners (Wasmer, browser and now Node)
 - Implement the new Node test runner (quite similar to the Wasmer one)
 - Unify Javascript client code, so we can make sure we apply the same patches and load in the same way all the different targets
 - Create a new entry point for testing with node
 - Add that new entry point to the static bundle
 
### 👀 Any consideration?

The Node test runner does not use the TestsParser as it heavily impacts execution time. I will try to figure out what's going on later.
 
###  How can it be tested?

Testing is automated 🤖 . You can also check this in your own project by running:

```bash
carton test --environment node
```
2022-05-11 13:52:44 +00:00
Yuta Saito 1f2aeffcc8
Enable reactor model only when not building as a command (#314) 2022-04-11 10:20:21 +01:00
Yuta Saito 9c4021d262
Several fixes for 5.6 toolchain (#310)
- Reactor model support
- Update sanitizer support object

This is required to resolve https://github.com/TokamakUI/Tokamak/pull/475
2022-04-09 13:37:34 +00:00
Max Desiatov 35043d7053
Add macOS 12 and Xcode 13.3 to CI matrix (#303)
There are issues with binding 0.0.0.0 address on macOS 12, I'm dropping the corresponding argument from tests in f24d39e8f8. Also seeing issues with Ubuntu 18.04, even though all tests seem to be passing. Dropping it as an old version from CI as well.
2022-03-31 10:48:53 +01:00
Yuta Saito 70081be442
Add --debug-info flag to carton bundle (#301) 2022-03-30 19:31:57 +09:00
Yuta Saito 4ca0cdf939
Add -Xswiftc option for each build commands (#300) 2022-03-20 12:14:35 +09:00
Max Desiatov 74a49c1aa8
Use `async`/`await` and actors instead of Combine (#283)
This makes our codebase smaller by ~80 lines and arguably more readable. Also removes OpenCombine dependency.

* Use `async`/`await` and actors instead of Combine

* Remove OpenCombine dependency

* Fix progress animation not updated

* Stop building with Swift 5.4, clean up terminal output

* Update requirements in `README.md`

* Add `description` to `InvalidResponseCode`

* Fix Linux build error

* Rename `main.swift` to `Main.swift`

* Work around IR/TDB warnings

* Pass IR/TDB arguments correctly to `swift build`

* Support `async` process runner in `carton-release`

* Use Xcode 13.2.1 on macOS

* Pass TDB/IR flags to `swift test` as well

* Make `Install` command async

* Add doc comments, handle subsequent rebuilds
2022-01-17 09:04:44 +00:00
Max Desiatov 30a80d0db1
Update `CHANGELOG.md` for 0.12.0, bump Tokamak (#267)
* Update `CHANGELOG.md` for 0.12.0, bump Tokamak

* Bump Tokamak to 0.9.0 in Milk fixture

* Update CHANGELOG.md

Co-authored-by: yonihemi <jonathan@hemi.dev>
2021-11-27 22:52:42 +01:00
Max Desiatov 0e163ec9aa
Use SwiftWasm 5.5.0, bump version to 0.12.0 (#266)
`async-http-client` package is now pinned to 1.6.4, as 1.7.0 and later versions caused issues with toolchain downloads (see https://github.com/swift-server/async-http-client/issues/488 for more details).

I've also updated toolchain downloader code to bubble up download errors, which previously were hidden and made it very hard to diagnose these issues.

* Use SwiftWasm 5.5.0, bump version to 0.12.0

* Pin AHC to 1.8.0

* Pin AHC to 1.6.4, always remove downloaded archives

* Fix `defer` build issue
2021-11-24 17:14:42 +01:00
Max Desiatov 596730b005
Update dependencies, add support for SwiftWasm 5.5 (#263)
I've dropped support for Swift 5.2, and SwiftLint now requires Xcode 12.5.1, which is unavailable on macOS 10.15 with GitHub Actions. This makes it impossible to test with Swift 5.3 on CI, so I'm bumping the required version to Swift 5.4.

Resolves https://github.com/swiftwasm/carton/issues/262.

* Update dependencies, add support for SwiftWasm 5.5

* Bump dependencies in `.github/workflows/swift.yml`

* Add explicit dependency on `NIOFoundationCompat`

* Lower Splash version to 0.15 for Swift 5.3 compat

* Update DefaultToolchain.swift

* Update swift.yml

* Revert "Lower Splash version to 0.15 for Swift 5.3 compat"

This reverts commit 6e04a7f158.

* Require Swift 5.4 in `Package.swift`

* Update README.md

* Use older 5.5 snapshot, unblock tests on failure

* Update DefaultToolchain.swift

* Select correct CPU architecture when downloading

* Disable hanging test

* Use latest 5.5 toolchain

* Use 2021-11-16 snapshot of SwiftWasm 5.5

* Add missing linker flags, re-enable browser test

* Address PR feedback
2021-11-18 13:59:32 +01:00
Michael Schwarz 2c1ec6ff04
Fix environment detection from User-Agent header (#249)
The `DestinationEnvironment` was not correctly detected from the `User-Agent` header of a WebSocket connection, always resulted in `.other`. This disabled any stack trace demangling.

Fixes #248.

* Add failing test for DestinationEnvironment.init?()

* Fix environment detection from User-Agent header
2021-10-07 22:10:11 +01:00