File tree Expand file tree Collapse file tree 6 files changed +134
-0
lines changed Expand file tree Collapse file tree 6 files changed +134
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < html >
3
+
4
+ < head >
5
+ < meta charset ="utf-8 ">
6
+ < title > basis.js base environment</ title >
7
+ </ head >
8
+
9
+ < body >
10
+ < script src ="../src/basis.js " data-basis-config =""> </ script >
11
+ </ body >
12
+
13
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < html >
3
+
4
+ < head >
5
+ < meta charset ="utf-8 ">
6
+ < title > Test runner setup example (for basis.js-based apps)</ title >
7
+ </ head >
8
+
9
+ < body >
10
+ < script src ="path/to/src/basis.js " basis-config > </ script >
11
+ < script >
12
+ if ( this . top === this )
13
+ location . href = 'runner/reporter.html?page=../index.html' ; // page parameter value should contain relative path
14
+ // from reporter.html to this page
15
+
16
+ ( function ( ) {
17
+ var originalJsWrapper = basis . resource . extensions [ '.js' ] ;
18
+ basis . resource . extensions [ '.js' ] = function ( content , url ) {
19
+ var exports = originalJsWrapper ( content , url ) ;
20
+ if ( exports )
21
+ exports . filename_ = url ;
22
+ return exports ;
23
+ } ;
24
+
25
+ // page reload on spec files update
26
+ // run in next tick, because at code run basisjs-tools file sync
27
+ // script is not loaded yet
28
+ basis . ready ( function ( ) {
29
+ if ( typeof basisjsToolsFileSync != 'undefined' )
30
+ basisjsToolsFileSync . notifications . attach ( function ( type , filename ) {
31
+ if ( type == 'update' &&
32
+ basis . resource . exists ( filename ) &&
33
+ ! / ^ \. \. / . test ( basis . path . relative ( filename ) ) )
34
+ location . reload ( ) ;
35
+ } ) ;
36
+ } ) ;
37
+ } ) ( ) ;
38
+
39
+ function loadTests ( loadTestsToReporter ) {
40
+ loadTestsToReporter ( basis . require ( './index.js' ) ) ; // path to test suite index file
41
+ }
42
+ </ script >
43
+ </ body >
44
+
45
+ </ html >
Original file line number Diff line number Diff line change
1
+ // example test suite
2
+ module . exports = {
3
+ name : 'Example test suite' ,
4
+ html : __dirname + 'env.html' , // base env
5
+ test : [
6
+ require ( './spec/suite1.js' )
7
+ ]
8
+ } ;
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ name : 'Test suite 1' ,
3
+ test : [
4
+ {
5
+ name : 'Test #1' ,
6
+ test : function ( ) {
7
+ // test code
8
+ }
9
+ } ,
10
+ {
11
+ name : 'Test #2' ,
12
+ test : function ( ) {
13
+ // test code
14
+ }
15
+ }
16
+ ]
17
+ } ;
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < html >
3
+
4
+ < head >
5
+ < meta charset ="utf-8 ">
6
+ < title > basis.js base environment</ title >
7
+ </ head >
8
+
9
+ < body >
10
+ < script src ="../src/basis.js " data-basis-config =""> </ script >
11
+ </ body >
12
+
13
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < html >
3
+
4
+ < head >
5
+ < meta charset ="utf-8 ">
6
+ < title > Test runner setup example (for non-basis.js-based apps)</ title >
7
+ </ head >
8
+
9
+ < body >
10
+ < script src ="path/to/src/basis.js " basis-config > </ script >
11
+ < script >
12
+ if ( this . top === this )
13
+ location . href = 'runner/reporter.html?page=../index.html' ; // page parameter value should contain relative path
14
+ // from reporter.html to this page
15
+
16
+ function loadTests ( loadTestsToReporter ) {
17
+ loadTestsToReporter ( {
18
+ name : 'Test suite' ,
19
+ test : [
20
+ {
21
+ name : 'Test #1' ,
22
+ test : function ( ) {
23
+ // test code
24
+ }
25
+ } ,
26
+ {
27
+ name : 'Test #2' ,
28
+ test : function ( ) {
29
+ // test code
30
+ }
31
+ }
32
+ ]
33
+ } ) ;
34
+ }
35
+ </ script >
36
+ </ body >
37
+
38
+ </ html >
You can’t perform that action at this time.
0 commit comments