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

​​[Error] Failed to set up project file system #1988

Closed
unstubbable opened this issue Jan 31, 2019 · 21 comments
Closed

​​[Error] Failed to set up project file system #1988

unstubbable opened this issue Jan 31, 2019 · 21 comments

Comments

@unstubbable
Copy link

Issue description or question

Since today wallaby fails to start for sinnerschrader/feature-hub with errors like this (on varying files):

​​[Error] Failed to set up project file system: Error: Failed to parse packages/demos/src/watch-demo.ts, SyntaxError: Unexpected token (24:10)​​
​​[Error]     at process.emit (events.js:182:13)​​
​​[Error]     at emit (internal/child_process.js:812:12)​​
​​[Error]     at process._tickCallback (internal/process/next_tick.js:63:19)​​
​​[Error]     at process._tickCallback (internal/process/next_tick.js:61:11)​​

We didn't do any changes to the wallaby config, jest or babel (with a lock file), and it worked just fine until yesterday.

Wallaby.js configuration file

// @ts-check

function setup({projectCacheDir, testFramework}) {
  const jestConfig = require('./jest.config');

  delete jestConfig.globalSetup;
  delete jestConfig.globalTeardown;

  jestConfig.moduleNameMapper = {
    '^@feature-hub/([^/]+)$': projectCacheDir + '/packages/$1/src'
  };

  testFramework.configure(jestConfig);
}

module.exports = wallaby => ({
  files: [
    'jest.config.js',
    'scripts/setup-test-framework.js',
    'packages/*/src/**/*.{ts,tsx,snap}',
    '!packages/*/src/**/*.test.{ts,tsx}'
  ],
  tests: [
    'packages/*/src/**/*.test.{ts,tsx}',
    '!packages/demos/src/**/*.test.{ts,tsx}'
  ],
  env: {type: 'node', runner: 'node'},
  setup,
  testFramework: 'jest',
  compilers: {
    '**/*.ts?(x)': wallaby.compilers.babel()
  }
});

Code editor or IDE name and version

Visual Studio Code v1.30.2

OS name and version

macOS 10.14.2 (18C54)

@ArtemGovorov
Copy link
Member

We can't reproduce the issue with the same editor and OS version. Just cloned the repo, ran yarn, started Wallaby and here is the result I'm getting:

​​​​​0 failing tests, 187 passing​​​​​

screen shot 2019-01-31 at 7 33 25 pm

Also we haven't changed Wallaby core for about 3 days, the latest extension release was targeting a very small Windows specific change.

Maybe it's some caching issue - try touching your Wallaby config (adding a line break will do), saving it, and restarting Wallaby to see if it helps.

@unstubbable
Copy link
Author

Thanks for the quick check! Your guess was probably right, since restarting VSCode fixed the issue. Before, I only tried the "Reload Window" command, which did not have an effect.

@unstubbable
Copy link
Author

unstubbable commented Feb 4, 2019

The issue re-appeared and now restarting VSCode does not fix it anymore. Do you have a hint, what cache files I would need to delete manually?

EDIT: Deleting the extension ~/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.109 also had no effect.

@smcenlly
Copy link
Member

smcenlly commented Feb 4, 2019

If you have deleted the extension directory, you will have deleted Wallaby's cache. The problem may be that you are using jest and the jest cache is corrupted. From your project directory, try running jest --showConfig. The config will include an entry, cacheDirectory. Once you have identified the cacheDirectory, delete all files/folders in that directory and restart Wallaby.

@unstubbable
Copy link
Author

Unfortunately that didn't fix the issue. Any other ideas? (For what it's worth, wallaby still works on my colleague's machine in the same repo.)

@ArtemGovorov
Copy link
Member

Try touching your Wallaby config (adding a line break will do), saving it, and restarting Wallaby to see if it helps.

@unstubbable
Copy link
Author

That did not help.

@ArtemGovorov
Copy link
Member

Just to double check if it is a caching issue or not, could you please try cloning the repo to a different folder, installing project dependencies and running Wallaby?

@unstubbable
Copy link
Author

Same error in the new clone.

@ArtemGovorov
Copy link
Member

Just tried the latest version of the repo, and I can't reproduce the issue unfortunately, 200 tests are passing.

Please do the following:

  • stop Wallaby,
  • delete the ~/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.109/projects folder,
  • start Wallaby,
  • share the full output from the Wallaby Console output channel when after you start Wallaby,
  • zip the ~/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.109/projects folder and attach the archive.

@unstubbable
Copy link
Author

Wallaby.js Console:

​​​​​[Info]​​​​​ Started Wallaby.js Core v1.0.651
​​​​​[Info]​​​​​ Wallaby App (realtime reports) is available at: http://localhost:51245

Wallaby.js Tests:

[Error] ​​Failed to parse packages/demos/src/watch-demo.ts, SyntaxError: Unexpected token (24:10)​​
[Error] ​​    at process.emit (events.js:182:13)​​
[Error] ​​    at emit (internal/child_process.js:812:12)​​
[Error] ​​    at process._tickCallback (internal/process/next_tick.js:63:19)​​

projects.zip

@unstubbable
Copy link
Author

If I restart wallaby (after initial start), the Wallaby.js Console has this output:

​​​​​[Info]​​​​​ Started Wallaby.js Core v1.0.651
​​[Error] Failed to set up project file system: Error: Failed to parse packages/demos/src/watch-demo.ts, SyntaxError: Unexpected token (24:10)​​
​​[Error]     at process.emit (events.js:182:13)​​
​​[Error]     at emit (internal/child_process.js:812:12)​​
​​[Error]     at process._tickCallback (internal/process/next_tick.js:63:19)​​
​​[Error]     at process._tickCallback (internal/process/next_tick.js:61:11)​​

@ArtemGovorov
Copy link
Member

ArtemGovorov commented Feb 5, 2019

Thanks. Try checking if any of the following folders exist:

  • ~/.vscode/extensions/node_modules
  • ~/.vscode/node_modules
  • ~/node_modules

and if it does, try deleting it, touching Wallaby config and restarting it.

@ArtemGovorov
Copy link
Member

Also

@ArtemGovorov
Copy link
Member

EDIT (had it wrong in my previous comment):

Also try modifying your Wallaby config as follows:

  files: [
+   {pattern: 'packages/demos/src/**/*.{ts,tsx}', instrument: false},
    'jest.config.js',
    'scripts/setup-test-framework.js',
    'packages/*/src/**/*.{ts,tsx,snap}',
    '!packages/*/src/**/*.test.{ts,tsx}'
  ],

and if the error changes after it, please share the new error.

@unstubbable
Copy link
Author

  • The three node_modules folders do not exist.

  • Changing the Wallaby config as suggested in ​​[Error] Failed to set up project file system #1988 (comment) leads to a similar error on another file:

    [Error] ​​Failed to parse packages/core/src/__tests__/feature-app-manager.test.ts, SyntaxError: Unexpected token (147:16)​​
    [Error] ​​    at process.emit (events.js:182:13)​​
    [Error] ​​    at emit (internal/child_process.js:812:12)​​
    [Error] ​​    at process._tickCallback (internal/process/next_tick.js:63:19)​​
    
  • I sometimes switch between Node 8 and 10 using nvm. Currently I use v10.14.1 (not changed in the last few days!).

  • wallaby.node is not set in my settings.

@unstubbable
Copy link
Author

I just noticed, if I remove the compilers config, wallaby can start successfully, and only the tests fail that rely on the jest.mock hoisting.

@ArtemGovorov
Copy link
Member

Could you please try

@unstubbable
Copy link
Author

unstubbable commented Feb 5, 2019

This fixed it! 🎉

What does this mean in general regarding the compatibility of Wallaby and Node 10?
EDIT: Maybe only with ['@babel/preset-env', {targets: {node: 'current'}}]!?

@ArtemGovorov
Copy link
Member

The issue is that try {} catch {} (optional catch binding) is supported since node 10, and Wallaby parser doesn't yet support it. So when you are using node 10 to run Wallaby (and compile TS code with ['@babel/preset-env', {targets: {node: 'current'}}]), it fails to parse try {} catch {}.

We'll be looking into adding the support shortly. In meantime you may:

  • keep having node 8 in your VS Code settings,
  • or replace all try {} catch {} blocks (you only have 3 of them), with try {} catch (e) {}.

@unstubbable
Copy link
Author

Thanks a lot for investigating this and explaining the cause of the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants