forked from nodejs/node-addon-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
52 lines (46 loc) · 1.3 KB
/
index.js
File metadata and controls
52 lines (46 loc) · 1.3 KB
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
48
49
50
51
52
'use strict';
process.config.target_defaults.default_configuration =
require('fs')
.readdirSync(require('path').join(__dirname, 'build'))
.filter((item) => (item === 'Debug' || item === 'Release'))[0];
// FIXME: We might need a way to load test modules automatically without
// explicit declaration as follows.
let testModules = [
'arraybuffer',
'asyncworker',
'buffer',
'error',
'external',
'function',
'name',
'object/delete_property',
'object/get_property',
'object/has_own_property',
'object/has_property',
'object/object',
'object/set_property',
'promise',
'typedarray',
'objectwrap'
];
if (typeof global.gc === 'function') {
console.log('Starting test suite\n');
// Requiring each module runs tests in the module.
testModules.forEach(name => {
console.log(`Running test '${name}'`);
require('./' + name);
});
console.log('\nAll tests passed!');
} else {
// Make it easier to run with the correct (version-dependent) command-line args.
const child = require('./napi_child').spawnSync(process.argv[0], [ '--expose-gc', __filename ], {
stdio: 'inherit',
});
if (child.signal) {
console.error(`Tests aborted with ${child.signal}`);
process.exitCode = 1;
} else {
process.exitCode = child.status;
}
process.exit(process.exitCode);
}