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

CRASH: Cannot find module 'typescript' #882

Open
zburke opened this issue Mar 3, 2021 · 3 comments
Open

CRASH: Cannot find module 'typescript' #882

zburke opened this issue Mar 3, 2021 · 3 comments
Assignees

Comments

@zburke
Copy link

zburke commented Mar 3, 2021

Error Report

Following the instructions at https://frontside.com/bigtest/docs/platform:

$ npm init
[...]
$ npm install bigtest --save-dev
$ npx bigtest init 
[...]
⌾ Do you want to write your tests in TypeScript? (yes/no)
   > no
$ cat bigtest.json 
{
  "port": 28000,
  "launch": [
    "default"
  ],
  "app": {
    "command": "npm start",
    "env": {
      "PORT": 28001
    },
    "url": "http://localhost:28001"
  },
  "testFiles": [
    "test/**/*.test.{ts,js}"
  ]
}
$ npx bigtest server --launch=chrome
[orchestrator] starting
😱😱😱 OH NO! UNEXPECTED ERROR! 😱😱😱
It looks like you've encountered a bug in BigTest that triggered an unexpected
shutdown. And yes, in case you're wondering, this is definitely on us. It would
help us a lot to improve BigTest if you'd take the time to report the problem.
[...]

This can be resolved by

npm i typescript --save-dev

but since I answered "no" to "Do you want to write your tests in TypeScript?" that seems odd.

NB: The helpful-looking "Copy" button next to all the console instructions is slightly less helpful than it could be because it copies the leading $ , which you have to remove.

diagnostics

Argv

server,--launch=chrome

Stack

Error: Cannot find module 'typescript'
Require stack:

  • /Users/zburke/temp/e2e/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/bundler/dist/bundler.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/bundler/dist/index.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/server/dist/src/manifest-builder.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/server/dist/src/orchestrator.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/server/dist/src/index.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/cli/dist/start-server.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/cli/dist/cli.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/cli/dist/index.js
  • /Users/zburke/temp/e2e/node_modules/@bigtest/cli/bin/bigtest.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.typescript [as default] (/Users/zburke/temp/e2e/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:29168:36)
    at prepareInputOptions (/Users/zburke/temp/e2e/node_modules/@bigtest/bundler/dist/bundler.js:51:48)
    at prepareWatchOptions (/Users/zburke/temp/e2e/node_modules/@bigtest/bundler/dist/bundler.js:86:12)
    at Bundler.watch (/Users/zburke/temp/e2e/node_modules/@bigtest/bundler/dist/bundler.js:113:37)
    at watch.next ()
    at /Users/zburke/temp/e2e/node_modules/effection/dist/effection.js:1:7739
@cowboyd
Copy link
Member

cowboyd commented Mar 4, 2021

Hey @zburke, Thank you soooo much for taking the time to report this!

@jnicklas @dagda1 Not gracefully handling the options when users do not select typescript is something that keeps coming up again and again. It seems we should have a separate integration test where we set up and run a TS project and also setup and run a JS project to make sure both pathways are secured.

@jenweber
Copy link
Collaborator

jenweber commented Mar 4, 2021

I can reproduce this when working with a freshly generated sample app as well, after upgrading the bigtest version. The sample app workaround is to install typescript. I'll open a PR as a stopgap.

jenweber added a commit that referenced this issue Mar 4, 2021
Add typescript and pin bigtest version.

Partially addresses #882
@dagda1
Copy link
Contributor

dagda1 commented Mar 4, 2021

Oh yes, definitely shoddy that we have not crossed this off. I have known about it.

#679 is one issue also where we either include the rollup typescript plugin when there is no typescript or we suppress that particular error message.

You could suppress it potentially through a custom rollup plugin which are pretty lightweight to create.

jenweber added a commit that referenced this issue Mar 8, 2021
Add typescript and pin bigtest version.

Partially addresses #882
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

5 participants