Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Plugin for using Jasmine with Web Test Runner

License

NotificationsYou must be signed in to change notification settings

blueprintui/web-test-runner-jasmine

Repository files navigation

npm versionCI Build

AWeb Test Runner plugin for running Jasmine.

Setup

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

TypeScript

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

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp