This is to track the next release:
jest-editor-support (jest-editor-support/#9, #447)jest-editor-support dependency to pick up the latest version. (#447)Due to the scope of the changes, we created a beta branch so more people can help to address the remaining issues and speed up the release. If you are interested to help, please submit PR against beta branch or help us testing. Thank you 馃檹
In addition to testing new features listed above, would really appreciate help for regression testing:
@escaton when I was testing multiroot in beta, noticed this issue:
The test result parsing has a random race condition, and tests are not being correctly decorated, especially when the system is under a bit of stress. After taking a closer look at the console output, it seems all the jest runners output to the same tmp file!
spawning process with command=/Users/vsun/ConnectDotz/projects/dots/packages/dots-google-photos/node_modules/.bin/jest, args=--json,--useStderr,--outputFile,/var/folders/kv/r07v4crd5qx_kd6959jjdmb80000gn/T/jest_runner.json,--no-color
...
spawning process with command=/Users/vsun/ConnectDotz/projects/dots/packages/dots-message/node_modules/.bin/jest, args=--json,--useStderr,--outputFile,/var/folders/kv/r07v4crd5qx_kd6959jjdmb80000gn/T/jest_runner.json,--no-color
The output file is generated by jest-editor-support.Runner and looks like it didn't anticipate concurrent runners 馃槹. To make the matter worse, jest-editor-support has been refactored and moved out of jest repo recently but vscode-jest is still using an older version whose source code doesn't exist anymore 馃槺
This issue is a show-stopper; I think we will need to fix jest-editor-support and upgrade vscode-jest's depenency... I will add a new action item to track.
Looks like it affects not only multiroot scenario. Two separate vscode instances would share the same Runner now and so will concurrently write to that log.
Do you know what was the reason to communicate with runner through fs instead of stdOut/stdErr? Just omiting --outputFile arg should work, or am i missing something?
I am guessing a json file is easier to parse and probably with more stable format than stdin/stdout
I apologise for stupid question, but how can I run extension in beta version? couldn't find any mention in docs.
similar to how you will run a development build based on master branch... just switch to beta branch after git clone.
@kresli Check out the last section here: https://github.com/jest-community/vscode-jest/blob/master/CONTRIBUTING.md
Followed the instructions posted by @muratg and @connectdotz so I'd be able to give beta a try.
Our project structure is something like:
| + frontend
| \
| | - jest.config.js
|
|+ backend
\
| + service-a
| \
| | - jest.config.js
|
| + service-b
| \
| | - jest.config.js
.
.
.
I have tried to setup the plugin like so:
{
"jest.enabledWorkspaceFolders": [
"frontend",
"backend/service-a",
"backend/service-b"
]
}
My jest.config.jss are all an extension of:
require('dotenv').config({ path: 'tests/.env' });
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
restoreMocks: true,
clearMocks: true,
modulePaths: [
'node_modules',
'.',
]
};
Yet it seems like my configuration of using ts-jest does not apply as all I'm getting is something in the lines of:
```est suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
...
on-auth0-login.spec.ts: Unexpected token, expected "," (36:71)
34 | await Account.create({ userId });
35 | // eslint-disable-next-line @typescript-eslint/camelcase
> 36 | const response = await handler({ body: { user_id: userId } }, {} as any, null);
| ^
```
I'm assuming my config file didn't apply as it seems ts-jest preset wasn't used and jest attempted to run the .ts file, but I'm not sure what I did wrong.
Would be happy to provide you with any other details that might be useful.
Thanks.
@roni-frantchi thanks for testing the beta, the multiroot utilize vscode's multiroot-workspace framework, meaning it expects your vscode project will have this structure (in vscode's explorer, not actual file system):
| + frontend
| + service-a
| + service-b
```
so your ject config would be:
{
"jest.enabledWorkspaceFolders": [
"frontend",
"service-a",
"service-b"
]
}
```
hope this help, let us know how it goes...
Thanks @connectdotz !
Didn't realize that I need to import individual projects of my monorepo as a separate folder to the workspace - I naively checked out my monorepo and imported the root directory of it to VSCode.
I'll try it out as soon as I get a chance and report right back
@connectdotz no luck.
workspace.json:
{
"folders": [
{
"path": "/...../service-a",
"path": "/...../service-b",
"path": "/...../service-c",
}
// ...
],
"settings": {
"jest.enabledWorkspaceFolders": [
"service-a",
"service-b",
"service-c"
]
}
}
Output:
Exception raised: Process failed: spawn jest ENOENT
Finished running all tests. Starting watch mode.
Exception raised: Process failed: spawn jest ENOENT
Exception raised: Process failed: spawn jest ENOENT
Exception raised: Process failed: spawn jest ENOENT
Exception raised: Process failed: spawn jest ENOENT
Exception raised: Process failed: spawn jest ENOENT
Starting Jest in Watch mode failed too many times and has been stopped.
Consider either add this workspace folder to disabledWorkspaceFolders setting or add needed folders to enabledWorkspaceFolders
see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting
Not sure what's going on...
@roni-frantchi where do you have your jest binary installed?
@escaton the binary is in service-a/node_modules/.bin/jest while jest resides in <project-root>/node_modules - we're using Yarn Workspaces to manage our monorepo dependencies.
I was able to get the ability to debug via the spec by setting these launch.json:
{
"type": "node",
"name": "vscode-jest-tests",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--runInBand"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"runtimeVersion": "8.10.0"
}
However it seems the watch tests still fail due to wrong node version used...
@connectdotz I do use nvm, yes
I was able to get the ability to debug via the spec by setting these launch.json
which launch.json is this? is it in project root, workspace setting or the specific folder?
However it seems the watch tests still fail due to wrong node version used...
has the error changed? you were reporting errors about jest not found, is it now reporting something else ?
If you can create a sample project that will probably make it easier to diagnose...
this should relate to #254
Sorry for the very late response @connectdotz . Was on holiday.
which launch.json is this? is it in project root, workspace setting or the specific folder?
This is the launch.json workspace setting.
has the error changed? you were reporting errors about jest not found, is it now reporting something else ?
Yes, with the luanch.json shown above, Jest was found.
The watched tests now fail with an error of not being able to find proper version for some modules (in most cases, sqllite).
These errors are shown when the wrong node version is used and as such the right module can't be found.
I suspect this setting : "runtimeVersion": "8.10.0" somehow does apply when I click on the debug scope but does not apply for the watch.
Either that, or it does not apply at all, and since I'm using NVM and the debug opens a terminal, it looks for my .nvmrc and sets it properly regardless of that setting:
Found '/Users/roni/dev/env0/.nvmrc' with version <8.10.0>
Now using node v8.10.0 (npm v5.6.0)
I'll try and create sample project.
just released 3.0.0 pre-release, now you should be able to test with pre-build binary, please give it a try and let us know if there is any issue.
@escaton, @blikblum, @vdh, @qalex thanks for your contribution to this release, it won't be possible without you 馃檹 . We look forward to seeing you more in this repo!
@seanpoulter @stephtr in the process of building the vscode package, I noticed a few things:
jest-editor-support introduced jest-config dependency in the Settings.js, which we are not using in vscode-jest any more. jest-config brought in lots of jest dependencies that also increased the package size. Again, this is something we can consider optimizing if needed.BTW, if you have access to windows machines, can you try 3.0.0 pre-release with it? thanks.
Installing the extension via the store produces a node_modules folder with more than 4000 files and 35 MB. For me that would be reason enough to try switching to webpack. Its tree shaking feature maybe also solves the issue with jest-config.
If there is no one who woulds like to take a look at that, I could give it a try.
Since we are already talking about tooling, could we also talk about using semicolons? I have hardly ever seen any JS/TS project not using them as line endings.
Concerning the security alerts: If the automated pull requests pass the test and according to the changelog don't introduce any breaking changes, I would just merge them (without further manual testing, which probably is being done when releasing a new build). For the security alerts not being fixed by automated PRs we should probably take a look at whether we can manually bump the dependents within our package.json.
If there is no one who woulds like to take a look at that, I could give it a try.
that would be awesome! 馃憤
Since we are already talking about tooling, could we also talk about using semicolons?
I would definitely second that, but that will be touching every single file, learning from my past mistake, let's make sure this time we do it in a separate standalone PR.
Concerning the security alerts: If the automated pull requests pass the test and according to the changelog don't introduce any breaking changes, I would just merge them (without further manual testing, which probably is being done when releasing a new build).
as long as there is a before-release, eat-out-own-dog-food testing, I completely agree we don't need to manually test each security alert PR.
Unfortunately compilation using webpack fails due to jest-config. It seems like we first have to adapt jest-editor-support and/or jest-config for that.
I would definitely second that, but that will be touching every single file, learning from my past mistake, let's make sure this time we do it in a separate standalone PR.
...and when there are no other larger PRs around.
Unfortunately compilation using webpack fails due to jest-config. It seems like we first have to adapt jest-editor-support and/or jest-config for that.
urgh... ok, let's deprecate Settings.js in jest-editor-support and its dependencies, do you want to submit a PR (hey a good opportunity to test 3.0.0 on windows) and I will quickly review and cut a new release. Maybe once that was out the binary size will come down that we might not even need to do webpack right now.
urgh... ok, let's deprecate
Settings.jsin jest-editor-support and its dependencies, do you want to submit a PR (hey a good opportunity to test 3.0.0 on windows) and I will quickly review and cut a new release. Maybe once that was out the binary size will come down that we might not even need to do webpack right now.
Another possibility was to just exclude jest-config from compilation, webpack then works (see #471). We could still get rid of Settings.js, but that has no priority and changes hardly anything after webpacking it. I would still use webpack, since the impact on dev compilation time is small but it nevertheless decreases the final extension size.
ok, merged the webpack PR, awesome job @stephtr! 馃憤
look like you also addressed all the security alerts, are they all in beta now? If they are, I will cut a 3.0.1
look like you also addressed all the security alerts, are they all in beta now?
Yes, they should be.
ok, 3.0.1 is out.
do you guys have any objection to merge beta to master now, and if we didn't see any issue in the next few days, release it to vscode marketplace next week.
I would be fine with that.
[status update]
trying to publish to vscode marketplace but bumpped into some permission issue, working with @orta on it...
OK, but then let's wait shortly to fix the newest security issues.
hmmm... we could generate the PRs for the security fixes but I would prefer not to merge them in this release (3.0.2), otherwise, we will have to test it again and further delay the release...
However, we could release another minor release (3.0.3) soon, which could include these security fixes and potential production issue/fix.
Ok, I will prepare the security patch PR.
@connectdotz Do you know what the micromatch dependency is being used for? Is it even in use? We would at least have to update it to a more recent major version in order to get rid of one security issue (if we don't remove it at all).
looks like this dependency was introduced by #139 and is no longer used, should be safe to remove from package.json. you might also want to remove the typings/micromatch.d.ts
Most helpful comment
@escaton, @blikblum, @vdh, @qalex thanks for your contribution to this release, it won't be possible without you 馃檹 . We look forward to seeing you more in this repo!