electron / node-abi

:turtle: :rocket: Get the Node.js and Electron ABI for a given target and runtime
https://www.npmjs.com/node-abi
MIT License
164 stars 58 forks source link

node@12, incorrect abi #90

Closed magicdawn closed 3 years ago

magicdawn commented 4 years ago

image

image

https://nodejs.org/en/download/releases/ https://github.com/lgeiger/node-abi/pull/62/files#diff-168726dbe96b3ce427e7fedce31bb0bcR59

magicdawn commented 4 years ago

AND node@14

{
    "runtime": "node",
    "target": "14.0.0",
    "lts": [
      "2020-10-20",
      "2021-10-19"
    ],
    "future": true,
    "abi": "81"
  },

81 is wrong, 83 is correct.

image

magicdawn commented 4 years ago

the -pre logic make these incorrect https://github.com/lgeiger/node-abi/blob/master/scripts/update-abi-registry.js#L58

https://cdn.jsdelivr.net/gh/nodejs/node/doc/abi_version_registry.json image

malept commented 4 years ago

Can you make a PR (with tests, so this doesn't happen again) to fix this?

todbot commented 4 years ago

A test fails even a clean checkout from main branch, but also for Node v12, v14 and Electron 10. I've made a PR #94 with tests demonstrating this.

% git clone https://github.com/lgeiger/node-abi && cd node-abi
% npm install

> core-js@2.6.11 postinstall /Users/tod/projects/node/node-abi-todbot/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

added 1043 packages from 1077 contributors and audited 1043 packages in 11.085s

39 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

% npm run test

> node-abi@0.0.0-development test /Users/tod/projects/node/node-abi-todbot
> tape test/index.js

TAP version 13
# getNextTarget gets the next unsupported target
ok 1 should be equal
ok 2 should be equal
# getTarget calculates correct Node target
ok 3 should be equal
ok 4 should be equal
ok 5 should be equal
ok 6 should be equal
ok 7 should be equal
ok 8 should be equal
ok 9 should be equal
ok 10 should be equal
# getTarget calculates correct Electron target
ok 11 should throw
ok 12 should be equal
ok 13 should be equal
ok 14 should be equal
ok 15 should be equal
ok 16 should be equal
# getTarget calculates correct Node-Webkit target
ok 17 should throw
ok 18 should be equal
ok 19 should be equal
ok 20 should be equal
ok 21 should be equal
ok 22 should be equal
# getAbi calculates correct Node ABI
ok 23 should be equal
ok 24 should be equal
ok 25 should throw
ok 26 should throw
ok 27 should be equal
ok 28 should be equal
ok 29 should be equal
ok 30 should be equal
ok 31 should be equal
ok 32 should be equal
ok 33 should be equal
ok 34 should be equal
ok 35 should be equal
ok 36 should be equal
ok 37 should be equal
ok 38 should be equal
ok 39 should be equal
ok 40 should be equal
ok 41 should be equal
ok 42 should be equal
ok 43 should be equal
ok 44 should be equal
ok 45 should be equal
ok 46 should be equal
ok 47 should be equal
ok 48 should be equal
ok 49 should be equal
ok 50 should be equal
ok 51 should be equal
ok 52 should be equal
ok 53 should be equal
ok 54 should be equal
ok 55 should be equal
ok 56 should be equal
# getAbi calculates correct Electron ABI
ok 57 should throw
ok 58 should throw
not ok 59 should be equal
  ---
    operator: equal
    expected: '82'
    actual:   '80'
    at: Test.<anonymous> (/Users/tod/projects/node/node-abi-todbot/test/index.js:93:5)
    stack: |-
      Error: should be equal
          at Test.assert [as _assert] (/Users/tod/projects/node/node-abi-todbot/node_modules/tape/lib/test.js:228:54)
          at Test.bound [as _assert] (/Users/tod/projects/node/node-abi-todbot/node_modules/tape/lib/test.js:80:32)
          at Test.equal (/Users/tod/projects/node/node-abi-todbot/node_modules/tape/lib/test.js:389:10)
          at Test.bound [as equal] (/Users/tod/projects/node/node-abi-todbot/node_modules/tape/lib/test.js:80:32)
          at Test.<anonymous> (/Users/tod/projects/node/node-abi-todbot/test/index.js:93:5)
          at Test.bound [as _cb] (/Users/tod/projects/node/node-abi-todbot/node_modules/tape/lib/test.js:80:32)
          at Test.run (/Users/tod/projects/node/node-abi-todbot/node_modules/tape/lib/test.js:96:10)
          at Test.bound [as run] (/Users/tod/projects/node/node-abi-todbot/node_modules/tape/lib/test.js:80:32)
          at Immediate.next [as _onImmediate] (/Users/tod/projects/node/node-abi-todbot/node_modules/tape/lib/results.js:83:19)
          at processImmediate (internal/timers.js:456:21)
  ...
ok 60 should be equal
ok 61 should be equal
ok 62 should be equal
ok 63 should be equal
ok 64 should be equal
ok 65 should be equal
ok 66 should be equal
ok 67 should be equal
ok 68 should be equal
ok 69 should be equal
ok 70 should be equal
ok 71 should be equal
ok 72 should be equal
ok 73 should be equal
ok 74 should be equal
ok 75 should be equal
ok 76 should be equal
ok 77 should be equal
ok 78 should be equal
ok 79 should be equal
ok 80 should be equal
ok 81 should be equal
ok 82 should be equal
# getAbi calculates correct Node-Webkit ABI
ok 83 should throw
ok 84 should throw
ok 85 should be equal
ok 86 should be equal
ok 87 should be equal
ok 88 should be equal
ok 89 should be equal
ok 90 should be equal
ok 91 should be equal
ok 92 should be equal
ok 93 should be equal
ok 94 should be equal
ok 95 should be equal
ok 96 should be equal
ok 97 should be equal
ok 98 should be equal
ok 99 should be equal
ok 100 should be equal
# getAbi supports leading v
ok 101 should be equal
# getAbi returns abi if passed as target
ok 102 should be equal
# allTargets are sorted
ok 103 electron targets are sorted
ok 104 node targets are sorted
ok 105 node-webkit targets are sorted

1..105
# tests 105
# pass  104
# fail  1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-abi@0.0.0-development test: `tape test/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-abi@0.0.0-development test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tod/.npm/_logs/2020-09-11T02_33_36_421Z-debug.log

Adding test for Node v12 (ABI 72) with t.equal(getTarget('72'), '12.0.0') produces:

Error: Could not detect target for abi 72 and runtime node 

Adding test for Node v14 (ABI 83) with t.equal(getTarget('83'), '14.0.0') produces:

Error: Could not detect target for abi 83 and runtime node

Adding test for Electron v10 (AB 82) with t.equal(getTarget('82', 'electron'), '10.0.0') produces:

not ok 60 should be equal
  ---
    operator: equal
    expected: '82'
    actual:   '80'
    at: Test.<anonymous> (/Users/tod/projects/node/node-abi-todbot/test/index.js:95:5)