Giter Club home page Giter Club logo

testify's People

Contributors

allcontributors[bot] avatar calebboyd avatar dependabot[bot] avatar felipecrs avatar felixjb avatar lovesponge avatar nkreshchenko avatar ooga avatar roggenbrot avatar silvawillian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

testify's Issues

Path is not used

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

Screenshots/GIFs
image
Platform:

ZorinOS 16.2
[email protected]

Test Framework:
[email protected]
[email protected]
[email protected]

"Run Test" codelens runs all tests in the repository with same test description

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:

  1. Go to a test which has a duplicate description
  2. Click on the "Run test" codelens
  3. Check the results on the terminal
  4. See that all duplicates were executed

Expected behavior
I want only the test right below the codelens to be executed.

Desktop (please complete the following information):

  • OS: Windows 10 Home, Ubuntu 18.04
  • Version: 1.1.0

Additional context
Files of Javascript and Typescript languages

Add support for Lab test framework

Is your feature request related to a problem? Please describe.
Run and debug tests using codelens in VSCode.

Additional context
This issue was first opened at the original repo.
Also, there's a PR related to issue.

Support playwright test runner

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

Playwright test debug fails with error

The simplest playwright test from Getting Started manual fails on debugging

Steps to reproduce the behavior:
Setup the simplest playwright test as described in https://playwright.dev/docs/intro#first-test

  1. Create new folder
  2. Run npm init -y
  3. Run npm i -D @playwright/test
  4. Create file 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");
});
  1. Press 'Run Test' button in code lens - test passed successfully.
  2. Press 'Debug test' button in code lens - test failed to execute
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
  • OS: Windows 10
  • Node v14.15.5

Issue is not reproduced on Ubuntu 20.04/Node v14.15.0 configuration

Allow specify path to test runner

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.

Add codelens near context keyword

Is your feature request related to a problem? Please describe.
I can't run tests grouped by the keyword context in mocha.

Describe the solution you'd like
I would like to have the same codelens near the context keyword.

Additional context
image

Specify files to skip when debugging

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.

No test runner in your project. Please install one.

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:

  1. Click on the "Run test" codelens
  2. See a snack bar with the error pop up to the right

Expected behavior
It should find the installed and adequate test runner for the project.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10 Home, Ubuntu 18.04
  • Version 1.1.0

Additional context
This issue was first opened at the original repo.

Double quotes should be escaped from the command

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:

  1. Make a test with " in description
  2. Click on run test
  3. See terminal command
  4. See all tests running or command failing

Expected behavior
" should be transormed into \" in command

Screenshots
Captura de tela de 2021-08-04 11-29-57

Desktop (please complete the following information):

  • OS: Ubuntu 21.04
  • Version 1.9.0

there is a undefined in grep

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):

  • OS: OS X

Support for jest-each

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

Add support for Jasmine/Karma

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.

Fix Enzyme Internal Error

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:

  1. Go to a test.jsx that uses enzyme.
  2. Try to run a test
  3. See error

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.
image

Desktop (please complete the following information):

  • OS: Ubuntu 18.04

Monorepo support

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

Test file watchers that triggers edited tests

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 :-)

Incorrectly identifies identifier with name "it" as a test

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

System Info
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%
A/B Experiments
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

Babel's typescript transpilation options

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

eg. babel's configuration

Specifically, support for:
--emitDecoratorMetadata
--experimentalDecorators

Desktop (please complete the following information):

  • OS: macOS
  • Version 1.6.1

Add conditional code snippet/completion for mocha/jest

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.

Recognize test tokens without requiring a string literal

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.

Screen Shot 2022-04-14 at 3 15 02 PM

Add support for Typescript and Mocha

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.

Keybindings to run tests

I would like to make actions using keybindings in VSCode with this extension. Actions like:

  • rerun the last executed test
  • run the current suite of tests
  • run all tests in the file
  • and so on...

The automated release is failing 🚨

🚨 The automated release from the 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.


No vsce personal access token specified (set the 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 📦🚀

"No test runner in your project. Please install one." error

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:

  1. Create new JavaScript/Mocha project in Codespaces
  2. Install this extension.
  3. Click on codelens to run test

Expected behavior
Test should run

Screenshots/GIFs
error displayed No test runner in your project. Please install one.

Image

Platform:

  • OS: Codespaces

Test Framework:

  • Mocha, 10.2.0

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.

Add support for Jest config

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.

Backslashes used for path to jest bin. Causes bad path when using Git Bash terminal on Windows

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):

  • OS: Windows 10 Home

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.