felixjb / testify Goto Github PK
View Code? Open in Web Editor NEWRun JavaScript & TypeScript tests easily using CodeLens
Home Page: https://marketplace.visualstudio.com/items?itemName=felixjb.testify
License: MIT License
Run JavaScript & TypeScript tests easily using CodeLens
Home Page: https://marketplace.visualstudio.com/items?itemName=felixjb.testify
License: MIT License
Describe the bug
The path is not used when it is set.
To Reproduce
Steps to reproduce the behavior:
In the VScode config, change the extension configuration testify.testRunnerPath
to ./node_modules/mocha/bin/mocha.js
It still runs the tests with node_modules/.bin/mocha
Expected behavior
To run with the said file
ZorinOS 16.2
[email protected]
Test Framework:
[email protected]
[email protected]
[email protected]
Describe the bug
When I click in the "Run Test" codelens, all tests with the same description in the repository are run.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I want only the test right below the codelens to be executed.
Desktop (please complete the following information):
Additional context
Files of Javascript and Typescript languages
Microsoft released a new test runner for e2e playwright tests.
Syntax of the tests is identical to jest tests. The only difference is the cli command.
I'm working on a pull request
Steps to reproduce the behavior:
Setup the simplest playwright test as described in https://playwright.dev/docs/intro#first-test
npm init -y
npm i -D @playwright/test
test.spec.ts
with following content:import { test, expect } from "@playwright/test";
test("basic test", async ({ page }) => {
await page.goto("https://playwright.dev/");
const name = await page.innerText(".navbar__title");
expect(name).toBe("Playwright");
});
PS C:\dev\js\js-salesforce-playwright-test-runner-testify> ${env:PLAYWRIGHT_CHROMIUM_DEBUG_PORT}='9222'; ${env:PWDEBUG}='true'; ${env:NODE_ENV}='test'; ${env:NODE_OPTIONS}='--require "c:/Users/user/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" --inspect-publish-uid=http'; ${env:VSCODE_INSPECTOR_OPTIONS}='{"inspectorIpc":"\\\\.\\pipe\\node-cdp.9104-2.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\Program Files\\nodejs\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\\Users\\user\\AppData\\Local\\Temp\\node-debug-callback-409a480ccf67db31"}'; & 'C:\Program Files\nodejs\node.exe' '.\node_modules\.bin\playwright' 'test' '-g' 'basic test' '' 'test.spec.ts'
Debugger attached.
Waiting for the debugger to disconnect...
C:\dev\js\js-salesforce-playwright-test-runner-testify\node_modules\.bin\playwright:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at wrapSafe (internal/modules/cjs/loader.js:988:16)
at Module._compile (internal/modules/cjs/loader.js:1036:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
Issue is not reproduced on Ubuntu 20.04/Node v14.15.0 configuration
Is your feature request related to a problem? Please describe.
Allow overriding the test runner path so it's possible to use a different test runner than the detected one.
Describe the solution you'd like
Add an extension configuration option:
{ "javascript-test-runner.testRunnerPath": "yarn test" }
Additional context
This issue was first opened at the original repo.
at /.vscode-insiders/extensions/felixjb.testify-1.4.0/node_modules/@babel/parser/lib/index.js:6344:17) ... .vscode-insiders/extensions/felixjb.testify-1.4.0/out/parser/codeParser.js:11:26)
Is your feature request related to a problem? Please describe.
Specify files to skip when debugging to avoid entering node internals and node modules files code.
Describe the solution you'd like
An extension configuration to specify files to skip when debugging:
"javascript-test-runner.skipFiles": [
"<node_internals>/**/*.js",
"${workspaceFolder}/node_modules/**/*.js"
]
Describe alternatives you've considered
This configuration can be done in the launch profiles but it doesn't seem to work when using this extension.
Additional context
This issue was first opened at the original repo.
Describe the bug
Sometimes the extension can't find the test runner in the project. Usually it happens when VSCode is not opened through the project's directory.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should find the installed and adequate test runner for the project.
Desktop (please complete the following information):
Additional context
This issue was first opened at the original repo.
Describe the bug
If there is a test with "
character, it will not be escaped and the command will be wrong, potentially running every tests
To Reproduce
Steps to reproduce the behavior:
"
in descriptionExpected behavior
"
should be transormed into \"
in command
Desktop (please complete the following information):
Describe the bug
node_modules/.bin/mocha packages/ticket-backend/tests/services/Desk+Service.test.ts --grep="undefined" --require ts-node/register --exit
Screenshots
luxuze@luxuzes-MacBook-Pro ~/agora/web-monorepo master node_modules/.bin/mocha packages/ticket-backend/tests/services/Desk+Service.test.ts --grep="undefined" --require ts-node/register --exit
0 passing (1ms)
luxuze@luxuzes-MacBook-Pro ~/agora/web-monorepo master node_modules/.bin/mocha packages/ticket-backend/tests/services/Desk+Service.test.ts --grep="Show Desks" --require ts-node/register --exit
Test Desk+Service
✓ Show Desks (324ms)
1 passing (335ms)
Desktop (please complete the following information):
Current testify implementation does not support parametrized test with jest-each.
Since jest-each
is changing the test name on runtime based on the import parameters, running the test will fail since jest will not find a valid test based on the test name pattern at runtime.
Example:
each`
folder | name
${undefined} | ${"New Name"}
${1} | ${undefined}
${1} | ${"New Name"}
`.test(
"assert edit of $folder and $name",
async (folder, name) => {
...
});
In the example the following jest cli command is executed and will not find any test
node_modules/.bin/jest src/...........spec.tsx --testNamePattern="assert edit of $folder and $name" --coverage=false
Test Suites: 1 skipped, 0 of 1 total
Tests: 3 skipped, 3 total
Snapshots: 0 total
Time: 3.795 s, estimated 20 s
Since parsing of the test parameters with babel is impossible (There are multiple ways parameters can be defined and they can also contain logic like functions, variables ....) the best way to support such test would replacing the parameter placeholder in the test name with a regex.
node_modules/.bin/jest src/...........spec.tsx --testNamePattern="assert edit of .* and .*" --coverage=false
Is your feature request related to a problem? Please describe.
Currently, it's not possible to run Karma Jasmine tests.
Describe the solution you'd like
Make the extension compatible with Karma Jasmine tests.
Describe alternatives you've considered
Another extension was considered: Jasmine Test Adapter for the VS Code Test Explorer
Additional context
This issue was first opened at the original repo.
Describe the bug
When using enzyme lib at jsx files, I'm not able to sucessfuly run the tests.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none.
To configure an adapter, you should call `Enzyme.configure({ adapter: new Adapter() })`
before using any of Enzyme's top level APIs, where `Adapter` is the adapter
corresponding to the library currently being tested. For example:
import Adapter from 'enzyme-adapter-react-15';
To find out more about this, see http://airbnb.io/enzyme/docs/installation/index.html
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Neat plugin, running tests from codelens is super useful! -- Maybe this is already possible, but I'm not sure how
Is your feature request related to a problem? Please describe.
Test runner not detected in monorepo
For example
project
- modules
- moduleA
- node_modules
- testA.spec.ts
- moduleB
- node_modules
- testB.spec.ts
Describe the solution you'd like
I'd like to use run testA.spec.ts
with a test runner from moduleA/node_modules
I wish testify was able to watch the test files and after editing one of these, it ran automatically after a short time.
This is kind of what WallabyJs achieves and it's pretty awesome :-)
Issue Type: Bug
Declare a variable with the name "it" and access a property on it using bracket notation. In my case, I use "it" as short for "item" and i'm accessing a symbol on it named "KEY", so it[KEY]
, and testify shows a codeLens above that property access. when i click it, it runs a test for the testName "KEY"
I found this using the new vscode extension bisect tool; looking at your currently open issues, it's probably part of #32 - however, it doesn't look like #61 would fix it.
A setting to disable the codelens for this extension would also be nice.
Extension version: 1.7.0
VS Code version: Code 1.52.0 (940b5f4bb5fa47866a54529ed759d95d09ee80be, 2020-12-10T22:46:53.673Z)
OS version: Darwin x64 19.6.0
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2300) |
GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on protected_video_decode: unavailable_off rasterization: enabled skia_renderer: disabled_off_ok video_decode: enabled webgl: enabled webgl2: enabled |
Load (avg) | 11, 19, 14 |
Memory (System) | 16.00GB (0.51GB free) |
Process Argv | --crash-reporter-id 8fe9c0a9-e20f-435b-9c29-daef6bc63196 |
Screen Reader | no |
VM | 0% |
vsliv368:30146709
vsreu685:30147344
openlogontheside:30221877
python763:30178808
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
python504:30227505
vswsl492:30211401
wsl2prompt:30224612
unusedpromptcf:30224611
folderexplorer:30224614
openfilemenucf:30224648
pythonvsded773:30236629
Describe the bug
Decorators and metadata are unsupported and cause the extension to break
[2020-08-16 07:22:56.183] [exthost] [error] SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): 'decorators-legacy, decorators' (31:4)
To Reproduce
Steps to reproduce the behavior:
Create a file with the following contents
function noop(target: any) {
void 0
}
describe('something', () => {
it('should work', () => {
@noop
class Test {}
})
})
Expected behavior
Expected transpilation to occur according to tsconfig.json
Specifically, support for:
--emitDecoratorMetadata
--experimentalDecorators
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
It would be great if this feature could be used to add conditional code snippet/completion for mocha/jest functions on test files. Also, it should have a config option to enable this feature.
Additional context
This issue was first opened at the original repo.
Thanks for this nice extension! I've used others in the past, and just discovered testify today. It seems to work great for our TypeScript project (using the additional args setting for esbuild-register) and feels lightweight and snappy.
Is your feature request related to a problem? Please describe.
My team at Paceline uses __filename
and functionToTest.name
in mocha's describe
. For example, most of our test files look like:
import { describe, it } from 'mocha'
import { functionToTest } from './moduleToTest'
describe(__filename, () => {
describe(functionToTest.name, () => {
it('given x, returns y', () => {
// ...
})
// more it()s ...
})
})
We find that this reduces the burden of thinking of names, and reduces test maintenance since it works well with automatic refactorings in many IDEs (moving files, renaming functions, etc.).
Describe the solution you'd like
It'd be great if testify could recognize test tokens that don't include a string literal. If that would cause a problem with testify having false positives--thinking things are tests when they aren't--then, maybe allowing a template string literal in addition to a string literal is a viable alternative.
That would allow wrapping in a template string literal:
describe(`${__filename}`, () => {
describe(`${functionToTest.name}`, () => {
it('given x, returns y', () => {
Describe alternatives you've considered
It'd be totally fine if this was opt-in via settings, if that would also help reduce false positives for folks who prefer using string literals.
Additional context
Example of testify recignizing the it()
s with string literals, but not recognizing describe()
s without string literals.
Describe the solution you'd like
Add native support for typescript tests.
Describe alternatives you've considered
It was considered to use extension's additional configuration:
"javascript-test-runner.additionalArgs": "-r ts-node/register"
Additional context
This issue was first opened at the original repo.
I would like to make actions using keybindings in VSCode with this extension. Actions like:
main
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here are some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
VSCE_PAT
environment variable).Unfortunately this error doesn't have any additional information. Feel free to kindly ask the author of the semantic-release-vsce
plugin to add more helpful information.
Good luck with your project ✨
Your semantic-release bot 📦🚀
Describe the bug
After installing the extension in a javascript based codespace project, I get the error No test runner in your project. Please install one.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Test should run
Screenshots/GIFs
error displayed No test runner in your project. Please install one.
Platform:
Test Framework:
Additional context
Can't find anything in the docs about how to resolve this. I'm essentially a JavaScript noob, so it's likely I've missed something, or a big assumption was made. Either way, would be nice to support new users/common troubleshooting issues somewhere.
Describe the solution you'd like
Add support for jest.config.js
or jest
field in package.json
Additional context
This issue was first opened at the original repo.
Describe the bug
The path to my test runner, jest in this case, gets written like this to my terminal when I click the 'Run Test' text inserted by Testify into my code:
node_modules.bin\jest
I am using the git bash terminal on Windows 10
Windows interprets the string as:
node_modules.binjest
which of course isn't the correct path to Jest.
However, the path to the file to test is provided correctly with forward slashes.
Expected behavior
It would be nice if the path to the executable is also written using forward slashes.
Desktop (please complete the following information):
Additional context
Possible related to this pull request? Where the slashes were addressed for the file path
https://github.com/felixjb/testify/pull/33/files
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.