Skip to content

Error when running native node test-runner module + tap-spec + esm #86

@ErickWendel

Description

@ErickWendel

Using the Node.js v18.7 and tap-spec to pipe results from the node test runner the ntl command outputs ✖ Error building interactive interface and the nt throws an exception

Steps for reproducing the error:

// test.mjs
import {
  describe,
  it
} from 'node:test'
import {
  deepStrictEqual
} from 'node:assert'

describe('Array new features', () => {
  describe('new immutable array functions', () => {
    it('old way to change arrays (mutable)', () => {
      const items = [1, 3, 2]
      items.sort() // [1, 2, 3]

      deepStrictEqual(items, [1, 2, 3])
    });
  });
});

My script in the package.json file

//package.json
"scripts": {
    "test": "node --no-warnings mytest.mjs | tap-spec"
 },
"devDependencies": {
    "tap-spec": "^5.0.0"
 },

Using ntl

ntl
⬢  Node Task List
? Select a task to run: test

> [email protected] test
> node --no-warnings mytest.mjs | tap-spec

        # Subtest: new immutable array functions
            # Subtest: old way to change arrays (mutable)
            ok 1 - old way to change arrays (mutable)
              ---
              duration_ms: 0.000995537
              ...

  Subtest: Array new features

        ok 1 - new immutable array functions
          ---
          duration_ms: 0.003098021
          ...
    ✔ Array new features
✖  Error building interactive interface
nt 

> [email protected] test
> node --no-warnings mytest.mjs | tap-spec

        # Subtest: new immutable array functions
            # Subtest: old way to change arrays (mutable)
            ok 1 - old way to change arrays (mutable)
              ---
              duration_ms: 0.001907764
              ...

  Subtest: Array new features

        ok 1 - new immutable array functions
          ---
          duration_ms: 0.003592342
          ...
    ✔ Array new features
node:child_process:926
    throw err;
    ^

Error: Command failed: npm run test
    at checkExecSyncError (node:child_process:851:11)
    at execSync (node:child_process:923:15)
    at /Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:198:3
    at Array.forEach (<anonymous>)
    at executeCommands (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:197:7)
    at runCachedTask (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:166:3)
    at hasCachedTasks (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:170:9)
    at run (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:262:6)
    at Object.<anonymous> (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:294:2) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 33161,
  stdout: null,
  stderr: null
}

Node.js v18.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions