wallabyjs / console-ninja

Repository for Console Ninja questions and issues
https://console-ninja.com
Other
384 stars 21 forks source link

Path in bin/jest.js file crash when there's a single "Single quote" in the path #310

Closed gorritocodes closed 5 months ago

gorritocodes commented 5 months ago

There's a problem/bug with the paths of the tests because I have an edge case to the function making the paths.

I'm using Jest to run some tests for my project. I've built my project and tests on my main PC and they run perfectly, but now I'm trying to run the same code on my laptop and it isn't working. The reason is that my admin user in my notebook is " user's laptop".

Jest Version 29.7.0

Steps to reproduce when I run npm jest, in node_modules/jest/bin/ the file jest.js is generated.

the file in my case is located in :C:\UsersGorrito's Laptop\Documents\Development\Jest Tutorials\JavaScript Testing with Jest - Crash Course\node_modules\jest\bin\jest.js

but as my user has a single quote it crashes.

The file looks like this:

#!/usr/bin/env node
/* build-hook-start *//*00001*/try { require('c:\\Users\\Gorrito's Laptop\\.vscode\\extensions\\wallabyjs.console-ninja-1.0.324\\out\\buildHook\\index.js').default({tool: 'jest'}); } catch(cjsError) { try { import('file:///c:/Users/Gorrito's%20Laptop/.vscode/extensions/wallabyjs.console-ninja-1.0.324/out/buildHook/index.js').then(m => m.default.default({tool: 'jest'})).catch(esmError => {}) } catch(esmError) {}}/* build-hook-end */

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

const importLocal = require('import-local');

if (!importLocal(__filename)) {
  require('jest-cli/bin/jest');
}

I have tried to use template strings and double quotes to escape the bug manually, but it leads to a waterfall of crashing systems.

Expected behavior I expected to execute as it does on my other machine. The problem isn't in my repo, but in the relationship the repo has with my computer's name.

Actual behavior My computer name happens to be an edge case in the ways the routes are set in Wallaby.js, and prevents the normal execution of the software

Environment

No "jest." preset found.
PS C:\Users\Gorrito's Laptop\Documents\Development\Jest Tutorials\JavaScript Testing with Jest - Crash Course>

Processor   Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz   2.90 GHz
Installed RAM   12.0 GB
System type 64-bit operating system, x64-based processor
smcenlly commented 5 months ago

Thanks for reporting the problem.

Please update to the latest version of Console Ninja, v1.0.325 and then re-open your project. If you still have the problem at that point, please pause and then restart Console Ninja.