-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make tests work on all Node versions (#44)
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically. - Add missing entry for object tests in index.js. - Remove check for writable attribute on accessor property descriptors; it should not be there according to the JS spec. - Remove the explicit dependency on node-gyp in package.json. (NPM carries its own copy of node-gyp.) - Fix improper rethrow of an Error caught by reference that caused a double napi_ref delete, which failed in release builds of Node-ChakraCore.
- Loading branch information
Showing
11 changed files
with
201 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,30 @@ | ||
'use strict'; | ||
|
||
if (typeof global.gc !== 'function') { | ||
throw new Error('Tests require --expose-gc flag.') | ||
} | ||
|
||
let testModules = [ | ||
'arraybuffer', | ||
'asyncworker', | ||
'buffer', | ||
'error', | ||
'external', | ||
'function', | ||
'name', | ||
'typedarray', | ||
'arraybuffer', | ||
'asyncworker', | ||
'buffer', | ||
'error', | ||
'external', | ||
'function', | ||
'name', | ||
'object', | ||
'typedaray', | ||
]; | ||
|
||
testModules.forEach(name => { | ||
try { | ||
require('./' + name); | ||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
}); | ||
if (typeof global.gc === 'function') { | ||
// Requiring each module runs tests in the module. | ||
testModules.forEach(name => { | ||
require('./' + name); | ||
}); | ||
} else { | ||
// Make it easier to run with the correct (version-dependent) command-line args. | ||
const args = [ '--expose-gc', __filename ]; | ||
if (require('../index').isNodeApiBuiltin) { | ||
args.splice(0, 0, '--napi-modules'); | ||
} | ||
const child = require('child_process').spawnSync(process.argv[0], args, { | ||
stdio: 'inherit', | ||
}); | ||
process.exitCode = child.status; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.