GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaScriptKit/Examples/Testing at main · tayloraswift/JavaScriptKit

Expand file tree

/

Testing

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

Testing

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sources/Counter
Sources/Counter
 
 
Tests/CounterTests
Tests/CounterTests
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 
package.json
package.json
 
 
run-tests-with-browser-options.mjs
run-tests-with-browser-options.mjs
 
 

README.md

Outline

Testing example

This example demonstrates how to write and run tests for Swift code compiled to WebAssembly using JavaScriptKit.

Running Tests

To run the tests, use the following command:

swift package --disable-sandbox --swift-sdk wasm32-unknown-wasi js test

Code Coverage

To generate and view code coverage reports:

  1. Run tests with code coverage enabled:
swift package --disable-sandbox --swift-sdk wasm32-unknown-wasi js test --enable-code-coverage
  1. Generate HTML coverage report:
llvm-cov show -instr-profile=.build/plugins/PackageToJS/outputs/PackageTests/default.profdata --format=html .build/plugins/PackageToJS/outputs/PackageTests/main.wasm -o .build/coverage/html Sources
  1. Serve and view the coverage report:
npx serve .build/coverage/html

Customize test harness

See ./run-tests-with-browser-options.mjs for an example of customizing the test harness to run tests with specific browser options.

node run-tests-with-browser-options.mjs
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.