|
1 | 1 | require 'rubygems' |
2 | 2 |
|
3 | 3 | RUNNER_DIR = Dir.pwd.gsub(/\/tests$/,"") + "/" |
| 4 | + |
4 | 5 | def execute(cmd) |
5 | 6 | `#{cmd}` |
6 | 7 | end |
@@ -31,55 +32,34 @@ def runBg(cmd, linestomatch, genre, test_strings) |
31 | 32 | end |
32 | 33 |
|
33 | 34 | class Test |
34 | | - def run_project |
35 | | - end |
36 | | - |
37 | | - def qunit |
| 35 | + def run_project(reponame, test_framework, passed_array, browser_url) |
38 | 36 | repo_path = "#{RUNNER_DIR}tests/external-repos/" |
39 | 37 | conf_path = "#{RUNNER_DIR}tests/conf/" |
40 | | - execute("cd #{repo_path}underscorejs && npm install") |
41 | | - execute("cd #{repo_path}underscorejs && cp #{conf_path}underscorejs.json #{repo_path}underscorejs/browserstack.json") |
42 | | - pid = runBg("cd #{repo_path}underscorejs && ../../../bin/cli.js", 1, "qunit-underscorejs", ["631 of 631 passed"]) |
43 | | - execute("open http://localhost:8888/test/index.html") |
| 38 | + |
| 39 | + execute("cd #{repo_path}#{reponame} && npm install") |
| 40 | + execute("cd #{repo_path}#{reponame} && cp #{conf_path}#{reponame}.json #{repo_path}#{reponame}/browserstack.json") |
| 41 | + pid = runBg("cd #{repo_path}#{reponame} && ../../../bin/cli.js", 1, "#{test_framework}-#{reponame}", passed_array) |
| 42 | + execute("open http://localhost:8888/#{browser_url}") |
44 | 43 | Process.wait(pid) |
45 | 44 | sleep(1) |
46 | | - |
47 | | - execute("cd #{repo_path}Modernizr && npm install") |
48 | | - execute("cd #{repo_path}Modernizr && cp #{conf_path}Modernizr.json #{repo_path}Modernizr/browserstack.json") |
49 | | - pid2 = runBg("cd #{repo_path}Modernizr && ../../../bin/cli.js", 1, "qunit-Modernizr", ["20 of 41 passed"]) |
50 | | - execute("open http://localhost:8888/test/index.html") |
51 | | - Process.wait(pid2) |
52 | | - |
| 45 | + end |
| 46 | + |
| 47 | + def qunit |
| 48 | + run_project("underscorejs", "qunit", ["631 of 631 passed"], "test/index.html") |
| 49 | + run_project("Modernizr", "qunit", ["20 of 41 passed"], "test/index.html") |
53 | 50 | # https://github.com/bitovi/funcunit/ |
54 | 51 | # https://github.com/twbs/bootstrap |
55 | 52 | end |
56 | 53 |
|
57 | 54 | def mocha |
58 | | - repo_path = "#{RUNNER_DIR}tests/external-repos/" |
59 | | - conf_path = "#{RUNNER_DIR}tests/conf/" |
60 | | - |
61 | | - execute("cd #{repo_path}url.js && npm install") |
62 | | - execute("cd #{repo_path}url.js && cp #{conf_path}url.js.json #{repo_path}url.js/browserstack.json") |
63 | | - pid = runBg("cd #{repo_path}url.js && ../../../bin/cli.js", 1, "mocha-urlJs", ["35 of 35 passed"]) |
64 | | - execute("open http://localhost:8888/test.html") |
65 | | - Process.wait(pid) |
66 | | - sleep(1) |
67 | | - |
| 55 | + run_project("url.js", "mocha", ["35 of 35 passed"], "test.html") |
68 | 56 | # https://github.com/browserstack/microjungle |
69 | 57 | # https://github.com/dhimil/mocha |
70 | 58 | # https://github.com/auth0/auth0.js |
71 | 59 | end |
72 | 60 |
|
73 | 61 | def jasmine |
74 | | - repo_path = "#{RUNNER_DIR}tests/external-repos/" |
75 | | - conf_path = "#{RUNNER_DIR}tests/conf/" |
76 | | - |
77 | | - execute("cd #{repo_path}mout && npm install") |
78 | | - execute("cd #{repo_path}mout && cp #{conf_path}mout.json #{repo_path}mout/browserstack.json") |
79 | | - pid = runBg("cd #{repo_path}mout && ../../../bin/cli.js", 1, "jasmine-mout", ["978 of 978 passed"]) |
80 | | - execute("open http://localhost:8888/tests/runner.html") |
81 | | - Process.wait(pid) |
82 | | - sleep(1) |
| 62 | + run_project("mout", "jasmine", ["978 of 978 passed"], "tests/runner.html") |
83 | 63 | end |
84 | 64 |
|
85 | 65 | def run |
|
0 commit comments