help icon indicating copy to clipboard operation
help copied to clipboard

Running Unit Test with tools/tes.py failed

Open b-sia opened this issue 3 years ago • 0 comments

Details

Modified a feature and added supporting unit tests. To run only the unit test that I have implemented, I ran tools/test.py test/parallel/end-of-stream-finished.js. However, I got the following error.

Traceback (most recent call last):
  File "tools/test.py", line 1784, in <module>
    sys.exit(Main())
  File "tools/test.py", line 1657, in Main
    vm = context.GetVm(arch, mode)
  File "tools/test.py", line 954, in GetVm
    raise ValueError('Could not find executable. Should be ' + name)
ValueError: Could not find executable. Should be out/Release/node

GetVM accepts arch=none and mode=release.

Node.js version

v14.15.4

Example code

// test/parallel/test-end-of-stream-finished.js
'use strict';

const end_of_stream = require("end-of-stream");

console.log("running eos unit test")
# tools/test.py
def GetVm(self, arch, mode):
    if self.vm is not None:
      return self.vm
    if arch == 'none':
      name = 'out/Debug/node' if mode == 'debug' else 'out/Release/node'
    else:
      name = 'out/%s.%s/node' % (arch, mode)
    print(arch)
    print(mode)
    # Currently GYP does not support output_dir for MSVS.
    # http://code.google.com/p/gyp/issues/detail?id=40
    # It will put the builds into Release/node.exe or Debug/node.exe
    if utils.IsWindows():
      if not exists(name + '.exe'):
        name = name.replace('out/', '')
      name = os.path.abspath(name + '.exe')

    if not exists(name):
      raise ValueError('Could not find executable. Should be ' + name)

    return name

Operating system

Ubuntu 22.04

Scope

Unit Testing

Module and version

tools/test.py, trying to run a unit test implemented for lib/internal/streams/end-of-stream.js

b-sia avatar Oct 15 '22 05:10 b-sia