- Notifications
You must be signed in to change notification settings - Fork8
Plugin for using Jasmine with Web Test Runner
License
blueprintui/web-test-runner-jasmine
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
AWeb Test Runner plugin for running Jasmine.
ImportjasmineTestRunnerConfig and add too yourweb-test-runner.config.mjs.If using TypeScript you can addesbuildPlugin.
import{playwrightLauncher}from'@web/test-runner-playwright';import{esbuildPlugin}from'@web/dev-server-esbuild';import{jasmineTestRunnerConfig}from'web-test-runner-jasmine';exportdefault/**@type {import("@web/test-runner").TestRunnerConfig} */({ ...jasmineTestRunnerConfig(),testFramework:{config:{defaultTimeoutInterval:5000},},nodeResolve:true,files:['./src/*.spec.js'],browsers:[playwrightLauncher({product:'chromium'})],plugins:[esbuildPlugin({target:'auto',sourceMap:true})]});
Once added you can use Jasmine within your tests.
describe('a test suite',()=>{ letelement:HTMLElement;beforeEach(()=>{element=document.createElement('p');element.innerHTML='hello there';});afterEach(()=>{element.remove();});it('should create element',()=>{expect(element.innerHTML).toBe('hello there');});});
To run your tests runweb-test-runner in the terminal.
web-test-runner
If you use TypeScript you will need to add some additional configuiration. Update yourconfig to read.ts extentions and add thets: true flag to theesBuildPlugin.
import{playwrightLauncher}from'@web/test-runner-playwright';import{esbuildPlugin}from'@web/dev-server-esbuild';import{jasmineTestRunnerConfig}from'web-test-runner-jasmine';exportdefault/**@type {import("@web/test-runner").TestRunnerConfig} */({ ...files:['./src/*.spec.ts'],plugins:[esbuildPlugin({ts:true,json:true,target:'auto',sourceMap:true})]...});
Ensure you have the@types/jasmine package installed and addjasmine to thetypesin yourtsconfig.json.
{"compilerOptions": {..."types": ["jasmine"],... }}Learn more aboutWeb Test Runner.
About
Plugin for using Jasmine with Web Test Runner
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.