summaryrefslogtreecommitdiff
path: root/js/test/Common/run.js
blob: 74ef3347d5652a011b82ea414fc48c75ad6c95ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// **********************************************************************
//
// Copyright (c) 2003-present ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

require("ice");

class ControllerHelper
{
    write(msg)
    {
        process.stdout.write(msg);
    }

    writeLine(msg)
    {
        process.stdout.write(msg + "\n");
    }

    serverReady()
    {
        console.log("server ready");
    }
}

(async function()
 {
     try
     {
         const name = process.argv[2];
         const cls = module.require(name)[name];
         const test = new cls();
         test.setControllerHelper(new ControllerHelper());
         await test.run(process.argv);
     }
     catch(ex)
     {
         console.log(ex);
         /* eslint-disable no-process-exit */
         process.exit(1);
         /* eslint-enable no-process-exit */
     }
 }());