node-addon-api icon indicating copy to clipboard operation
node-addon-api copied to clipboard

Testing broken on Node.js main branch

Open mhdawson opened this issue 3 years ago • 7 comments

Fails with:

/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/debian10-x64/node-addon-api/test/index.js:93
process.config.target_defaults.default_configuration =
                                                     ^

TypeError: Cannot assign to read only property 'default_configuration' of object '#<Object>'
    at Object.<anonymous> (/home/iojs/build/workspace/node-test-node-addon-api-new/nodes/debian10-x64/node-addon-api/test/index.js:93:54)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
    at node:internal/main/run_main_module:23:47

mhdawson avatar Sep 20 '22 20:09 mhdawson

Likely related to https://github.com/nodejs/node/commit/e0ab8dd63731d8eb92053776c5160fb190d5aea5

mhdawson avatar Sep 20 '22 20:09 mhdawson

This is the code in the test script

process.config.target_defaults.default_configuration =
  fs
    .readdirSync(path.join(__dirname, process.env.REL_BUILD_PATH || '', 'build'))
    .filter((item) => (item === 'Debug' || item === 'Release'))[0];

mhdawson avatar Sep 20 '22 20:09 mhdawson

I'm going to remove that code so that the ci tests start running again, that will break the ability to run in debug I think, so I'll leave this issue open until we figure that out.

mhdawson avatar Sep 20 '22 20:09 mhdawson

PR https://github.com/nodejs/node-addon-api/pull/1208 to remove and get ci working again.

mhdawson avatar Sep 20 '22 22:09 mhdawson

CI is green again.

mhdawson avatar Sep 23 '22 15:09 mhdawson

Places where we read default_configuration

https://github.com/nodejs/node-addon-api/search?q=default_configuration

mhdawson avatar Sep 23 '22 15:09 mhdawson

@NickNaso is going to work on doing updates the replace the usage of default_configuration in the existing test files.

Discussion around how to choose.

  • Command line flag (preferred, by default use Release by default)
  • File system check

mhdawson avatar Sep 23 '22 15:09 mhdawson

I'm closing the issue because the PR https://github.com/nodejs/node-addon-api/pull/1226 has been merged.

NickNaso avatar Dec 09 '22 13:12 NickNaso