The latest XCTest bundled in Swift SDK for Wasm requires `Bundle.main` access to
minimize behavior difference from other platforms. `Bundle.main`
requires `argv[0]` and file system access to get the main bundle path.
* 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
### 🎩 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
```
Ideally we'd like to include new JSKit and SwiftWasm releases, but I think it makes more sense to wait for new JSKit release a bit more and to test things more thoroughly. Also, the watcher bug is still not fixed.
On the other hand, `--debug-info` has been highly requested by our users, so nothing prevents us from releasing 0.13.0 right now, and 0.14.0 with new JSKit/Tokamak and SwiftWasm 5.6 later.
`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
* Bump version to 0.11.0, update dependencies
* Test on Big Sur with Xcode 12.5
* Update test fixture dependencies
* Remove `LinuxMain.swift` expectations
* Test with `wasm-5.4-SNAPSHOT-2021-08-26-a`
* Remove expectations for `XCTestManifests.swift`
* Enable debugging output
* Try the latest 5.4 toolchain
* print debug output
* More debug output
* Test on macOS 11 with Xcode 13
* Pipe errors to stdout
* Update DefaultToolchain.swift
* Revert "Update DefaultToolchain.swift"
This reverts commit 4ff15f938a.
* Remove Xcode 13 from the CI matrix
* Update DefaultToolchain.swift
* Reduce the diff
Resolves https://github.com/swiftwasm/carton/issues/42.
Also updates JavaScriptKit dependency to 0.9.0.
* Demangle and print Firefox stacktraces in terminal
* Update the entrypoints archive URL, rename file
* Add missing newline to `ProcessRunner.swift`
* Remove redundant `console.log` call from `dev.js`
* Detect destination env from `User-Agent` header
* Silence linter in tests where it can't be avoided
* Add support for basic testing in browsers
* Add a browser message on finish, shut down server
* Update JavaScriptKit to 0.9.0
Other than a simple bump, we shouldn't check for the revision anymore. Now the recommended way to specify this dependency is only with a semantic version constraint.
TTY terminal output is unavailable on CI, or when users redirect output to a file or a pipe. In those cases `TerminalController` initializer returns `nil`. SwiftPM has a wrapper `InteractiveWriter` class for it, which writes output to stdout directly in that case. I've copied that, and replaced all uses of `TerminalController` with it. A VSCode task is added to test that.
In my testing it looks like download progress reporting is quite spammy, so it now has `removeDuplicates` Combine operator added to make it output only when values differ significantly from each other.
Additionally, SDK installs can hit GitHub API rate limit on CI nodes, so `carton` now reads `GITHUB_TOKEN` environment variable, which gives much higher limits to authenticated API users.
We can now also run various `carton` commands on CI for basic end-to-end testing.
Resolves#112.
Handling of the `static.zip` archive has changed slightly, where now the archive no longer has a nested `static` directory in it, which makes packaging slightly more predictable. For some reason passing wildcards to `zip` no longer works for me.
New `bundle.js` entrypoint is added, which only differs from `dev.js` in the lack of the WebSocket hot reloading bit.
`wabt` and `binaryen` Homebrew dependencies are added as required for `wasm-strip` and `wasm-opt` respectively that reduce the resulting bundle binary size.
All resulting bundle files except `index.html` are named by their content hashes to enable [cache busting](https://www.keycdn.com/support/what-is-cache-busting).
Resolves#16.