File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 33
33
run : |
34
34
npm run test-browser
35
35
node test/builds/browser_build_as_commonjs.js
36
+ # CDN build should be easily importable
37
+ - if : contains(matrix.build-how, 'cdn')
38
+ name : Test: Can import CDN esm build
39
+ run : |
40
+ node test/builds/cdn_build_as_esm.mjs
36
41
37
42
- if : contains(matrix.build-how, 'node')
38
43
name : Test Node.js build
Original file line number Diff line number Diff line change
1
+ import hljs from "../../build/es/highlight.js" ;
2
+
3
+ const API = [
4
+ "getLanguage" ,
5
+ "registerLanguage" ,
6
+ "highlight" ,
7
+ "highlightAuto" ,
8
+ "highlightAll" ,
9
+ "highlightElement"
10
+ ] ;
11
+
12
+ const assert = ( f , msg ) => {
13
+ if ( ! f ( ) ) {
14
+ console . error ( msg ) ;
15
+ process . exit ( 1 ) ;
16
+ }
17
+ } ;
18
+ const keys = Object . keys ( hljs ) ;
19
+
20
+ API . forEach ( n => {
21
+ assert ( _ => keys . includes ( n ) , `API should include ${ n } ` ) ;
22
+ } ) ;
23
+
24
+ console . log ( "Pass: browser build works with Node.js just fine." )
You can’t perform that action at this time.
0 commit comments