bigtest icon indicating copy to clipboard operation
bigtest copied to clipboard

CRASH: Cannot find module 'typescript'

Open zburke opened this issue 4 years ago • 3 comments
trafficstars

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

zburke avatar Mar 03 '21 19:03 zburke

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.

cowboyd avatar Mar 04 '21 03:03 cowboyd

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 avatar Mar 04 '21 05:03 jenweber

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.

dagda1 avatar Mar 04 '21 07:03 dagda1