README · Changelog · Development
Forked version of node-ffi-generate
development
- Follow git-flow and use git-flow-avh.
- Tests are required for both bug fixes and features.
- For bugs, please first commit a test proving the bug.
git flow init -d
npm install
# NOTE: exporting for temporary use during development.
export LD_LIBRARY_PATH="$(llvm-config --libdir)"
npm run --silent test
# NOTE: when done with development.
unset LD_LIBRARY_PATH
- Using
ffi-generate
requires the path tolibclang.so
(or.dylib
,.dll
on other systems) to be set, so the dynamic linker (used viaffi-napi
) can find it.- Setting
LD_LIBRARY_PATH
(orDYLD_LIBRARY_PATH
on macOS) is required to load theffi-generate
library (fromindex.js
). - The
ffi-generate
executable (inbin/ffi-generate.js
) sets the environment variable automatically.
- Setting
- Tests are executed using
ava
.
# NOTE: run all tests in a single directory.
npm run --silent test:ava -- test/unit/struct/*.js
- Enable (some) additional debugging output to
stderr
by setting theDEBUG
environment variable toffi-generate:*
. - Uses
debug
, and can also be used to debug other packages which also usedebug
.- Enable all
debug
logging withDEBUG='*'
. Will yield a lot more output.
- Enable all
# NOTE: exporting for temporary use during development.
export DEBUG='ffi-generate:*'
./bin/ffi-generate.js --library 'mylibrary' --file ./examples/programmatic-usage/simple/mylibrary.h
# NOTE: when done with development.
unset DEBUG
- At the end of the tests, you will see a code coverage report generated by
nyc
.- The total code coverage percentages are enforced. See
.nycrc.json
.
- The total code coverage percentages are enforced. See
- If you have executed the tests locally, there should also be a code coverage report (link only works locally) in the
coverage/
directory.- Ensure that your added or changed lines of code in each commit are executed at least once.
node-ffi-generate
Copyright © 2011, 2012, 2013, 2014 Timothy J Fontaine, © 2020, 2021 Joel Purra. Released under MIT License.