Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tap command not found #1024

Open
3 tasks done
punkish opened this issue Apr 29, 2024 · 2 comments
Open
3 tasks done

tap command not found #1024

punkish opened this issue Apr 29, 2024 · 2 comments
Labels
bug something not go good

Comments

@punkish
Copy link

punkish commented Apr 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Have you read the CONTRIBUTING guide on posting bugs, and CODE_OF_CONDUCT?

  • yes I read the things

This issue exists in the latest tap version

  • I am using the latest tap

Description

this issue was reported in 2021 #774

however, I still face this problem today. I followed the directions exactly as published on the website:

  1. Installed TAP

npm install tap --save-dev

  1. wrote a test file
  2. ran tap from the commandline
→ tap  lib/zql/queryMaker/where/index.test.js
tap
zsh: command not found: tap

The solution, as suggested in the linked issue #774 is to install TAP globally with npm install -g tap. If that is true, why is that not on the website? In any case, I'd prefer not to install TAP globally.

Much appreciation in advance for any guidance.

Reproduction

see above

Environment

which tap  -→ cannot run this
npm ls tap -→ see below
tap versions -→ cannot run this
tap config list -→ cannot run this
tap plugin list -→ cannot run this
# if using typescript:
npm ls @isaacs/ts-node-temp-fork-for-pr-2009
npm ls typescript
# posix:
uname -a
# windows (in powershell)
"$([Environment]::OSVersion.VersionString) $(('x86', 'x64')[[Environment]::Is64BitOperatingSystem])"
→ npm ls tap
zenodeo3@3.4.1 /Users/punkish/Projects/zenodeo3
└── tap@18.7.2
→ node --version
v20.12.2

I want to add that I am using node with nvm. I don't know if that matters. Since I installed tap as a local dev-dependency, it is in my project's node_modules directory.

→ which node
/Users/punkish/.nvm/versions/node/v20.12.2/bin/node

I am able to run the test using node directly as well as via npx tap successfully, but when I do the following

# the following works
→ node lib/zql/queryMaker/where/index.test.js

# the following works
→ npx tap lib/zql/queryMaker/where/index.test.js

# the following does not work
→ tap lib/zql/queryMaker/where/index.test.js

Also, running the test with npx tap causes all the tests in the entire project directory structure to be run. I want to run only the test specified on the command line (just to reduce the noise in the terminal)

@punkish punkish added the bug something not go good label Apr 29, 2024
@punkish
Copy link
Author

punkish commented Apr 29, 2024

seems like npx tap path/to/test.js is the best option available to me so I don't have to install tap globally

@punkish
Copy link
Author

punkish commented May 8, 2024

I got tired of typing npx so I gave up and installed tap globally. But, faced a similar problem as above -- when running tap path/to/index.test.js, it works fine. But nothing happens when running tap "**/*.test.js". Actually, something does happen but it just takes a long time. And, again contrary to what the documentation says, tapwants to run the tests in all thenode_modules`

$ tap "**/*.test.js"
 FAIL  bin/truebug/index.test.js 0 200ms
 ✖ SIGINT
 FAIL  data-dictionary/dd-utils.test.js 0 195ms
 ✖ SIGINT
 …
 FAIL  node_modules/@fastify/ajv-compiler/test/duplicated-id-compile.test.js 0 36ms
 ✖ SIGINT
 FAIL  node_modules/@fastify/ajv-compiler/test/plugins.test.js 0 34ms
 ✖ SIGINT
 FAIL  node_modules/@fastify/ajv-compiler/test/standalone.test.js 0 36ms
 ✖ SIGINT
 FAIL  node_modules/@fastify/ajv-compiler/test/serialization.test.js 0 23ms
 ✖ SIGINT
 FAIL  node_modules/@fastify/cors/test/cors.test.js 0 38ms
 ✖ SIGINT
 FAIL  node_modules/@fastify/cors/test/hooks.test.js 0 36ms
 ✖ SIGINT
 FAIL  node_modules/@fastify/ajv-compiler/test/index.test.js 0 35ms
 ✖ SIGINT
 FAIL  node_modules/@fastify/cors/test/preflight.test.js 0 35ms
 …

When I try to edit the config file using tap config edit, I get a YAML error even though strangely I didn't even touch that line 14. I only wanted to change the exclude pattern.

YAMLParseError: A block sequence may not be used as an implicit map key at line 14, column 1:

coverage-map: map.mjs

In any case, tap should not be running tests in the node_modules directory as stated

--exclude=[#](https://node-tap.org/cli/#--exclude%3D%3Cpattern%3E)

A glob pattern indicating which filenames should NEVER be run as tests. This overrides the include option.

Defaults to excluding any folders named dist, fixture, or fixtures.

Note: folders named tap-snapshots, node_modules, or .git are ALWAYS excluded from the default test file set. If you wish to run tests in these folders, then name the test files on the command line as positional arguments.

What am I doing wrong that my experience doesn't match what the docs say?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something not go good
Projects
None yet
Development

No branches or pull requests

1 participant