File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : e2e
2+ on : [push, pull_request]
3+
4+ permissions :
5+ contents : read
6+
7+ jobs :
8+ e2e :
9+ runs-on : ubuntu-latest
10+ strategy :
11+ matrix :
12+ browser : [chromium, firefox, webkit]
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v6
17+
18+ - name : Use Node.js
19+ uses : actions/setup-node@v6
20+ with :
21+ cache : npm
22+ node-version-file : .nvmrc
23+
24+ - name : Install dependencies
25+ run : npm ci --prefer-offline
26+
27+ - name : Install Playwright browsers
28+ run : npx playwright install ${{ matrix.browser }}
29+
30+ - name : Run browser tests on Chrome
31+ run : npm run test:browser -- --browser=${{ matrix.browser }}
Original file line number Diff line number Diff line change 3030
3131 - name : Run module tests
3232 run : npm run test:esm
33-
34- - name : Install Playwright browsers
35- run : npx playwright install chromium
36-
37- - name : Run browser tests
38- run : npm run test:browser
Original file line number Diff line number Diff line change 1+ import { isNode } from '../helpers' ;
2+
13export default [
24 // html tags
35 {
@@ -225,7 +227,7 @@ export default [
225227 data : '<noscript><p>JS is disabled</p></noscript>' ,
226228 get skip ( ) {
227229 // jsdom template renders noscript children as text instead of nodes
228- return typeof process !== 'undefined' ;
230+ return isNode ( ) ;
229231 } ,
230232 } ,
231233
Original file line number Diff line number Diff line change 22import htmlToDOM from '../../src/client/html-to-dom' ;
33import htmlCases from '../cases/html' ;
44import {
5+ isBrowser ,
56 parseDOM ,
67 runTests ,
78 testCaseSensitiveTags ,
@@ -15,16 +16,18 @@ describe('client parser', () => {
1516 runTests ( htmlToDOM , parseDOM , htmlCases ) ;
1617 testCaseSensitiveTags ( htmlToDOM ) ;
1718
18- describe ( 'performance' , ( ) => {
19- it ( 'executes 1000 times in less than 50ms' , ( ) => {
20- let times = 1000 ;
21- const start = performance . now ( ) ;
22- while ( -- times ) {
23- htmlToDOM ( '<div>test</div>' ) ;
24- }
25- const end = performance . now ( ) ;
26- const elapsed = end - start ;
27- expect ( elapsed ) . below ( 50 ) ;
19+ if ( isBrowser ( ) ) {
20+ describe ( 'performance' , ( ) => {
21+ it ( 'executes 1000 times in less than 50ms' , ( ) => {
22+ let times = 1000 ;
23+ const start = performance . now ( ) ;
24+ while ( -- times ) {
25+ htmlToDOM ( '<div>test</div>' ) ;
26+ }
27+ const end = performance . now ( ) ;
28+ const elapsed = end - start ;
29+ expect ( elapsed ) . below ( 50 ) ;
30+ } ) ;
2831 } ) ;
29- } ) ;
32+ }
3033} ) ;
Original file line number Diff line number Diff line change 1+ export const isBrowser = ( ) => typeof window === 'object' && ! isNode ( ) ;
2+
3+ export const isNode = ( ) => typeof process === 'object' ;
Original file line number Diff line number Diff line change 1+ export { isBrowser , isNode } from './environment' ;
12export { parseDOM } from './parse-dom' ;
23export { runTests } from './run-tests' ;
34export { testCaseSensitiveTags } from './test-case-sensitive-tags' ;
You can’t perform that action at this time.
0 commit comments