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

ng test fails, is unable to compile TypeScript #4568

Closed
catull opened this issue Feb 9, 2017 · 5 comments · Fixed by #4997
Closed

ng test fails, is unable to compile TypeScript #4568

catull opened this issue Feb 9, 2017 · 5 comments · Fixed by #4997

Comments

@catull
Copy link
Contributor

catull commented Feb 9, 2017

OS?

macOS Sierra (10.12.3)

Versions.

@angular/cli: 1.0.0-beta.30
node: 7.5.0
os: darwin x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7

Repro steps.

ng new cool-app
cd cool-app
ng test

The log given by the failure.

➜ cool-app git:(master) ng test
09 02 2017 19:33:49.134:ERROR [config]: Error in config file!
{ TSError: ⨯ Unable to compile TypeScript
../../../workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (48,25): Cannot find name 'Promise'. (2304)
../../../workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (148,43): Property 'assign' does not exist on type 'ObjectConstructor'. (2339)
../../../workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (349,25): Cannot find name 'Promise'. (2304)
at getOutput (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:258:17)
at /private/tmp/cool-app/node_modules/ts-node/src/index.ts:267:16
at Object.compile (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:403:17)
at loader (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:289:33)
at Object.require.extensions.(anonymous function) [as .ts] (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:306:14)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Function.Module._load (workspace/js/ng/angular-cli.git/lib/bootstrap-local.js:69:24)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/index.ts:1:1)
at Module._compile (module.js:571:32)
at loader (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:289:14)
at Object.require.extensions.(anonymous function) [as .ts] (/private/tmp/cool-app/node_modules/ts-node/src/index.ts:306:14)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Function.Module._load (workspace/js/ng/angular-cli.git/lib/bootstrap-local.js:56:22)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (workspace/js/ng/angular-cli.git/packages/@angular/cli/models/webpack-configs/test.js:5:17)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Function.Module._load (workspace/js/ng/angular-cli.git/lib/bootstrap-local.js:69:24)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (workspace/js/ng/angular-cli.git/packages/@angular/cli/plugins/karma.js:4:23)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Function.Module._load (workspace/js/ng/angular-cli.git/lib/bootstrap-local.js:62:22)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at module.exports (/private/tmp/cool-app/karma.conf.js:12:7)
at Object.parseConfig (/private/tmp/cool-app/node_modules/karma/lib/config.js:342:5)
at new Server (/private/tmp/cool-app/node_modules/karma/lib/server.js:56:20)
at /private/tmp/cool-app/node_modules/@angular/cli/tasks/test.js:26:31
at Class.run (/private/tmp/cool-app/node_modules/@angular/cli/tasks/test.js:10:16)
at Class.run (/private/tmp/cool-app/node_modules/@angular/cli/commands/test.js:29:25)
at Class. (/private/tmp/cool-app/node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:103:7)
diagnostics:
[ '../../../workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (48,25): Cannot find name 'Promise'. (2304)',
'../../../workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (148,43): Property 'assign' does not exist on type 'ObjectConstructor'. (2339)',
'../../../workspace/js/ng/angular-cli.git/packages/@ngtools/webpack/src/plugin.ts (349,25): Cannot find name 'Promise'. (2304)' ] }

Mention any other details that might be useful.

Project is located at /tmp/cool-app
Angular CLI is from master, npm link'd

@filipesilva
Copy link
Contributor

This is an unfortunate side effect of Karma auto-loading ts-node. It should only happen on dev setups that have a linked CLI.

Current workaround is to do rm -rf node_modules/ts-node on the generated project. This will break ng e2e until ts-node is reinstalled locally.

@catull
Copy link
Contributor Author

catull commented Feb 10, 2017

@filipesilva I can live with this limitation, thanks.

@xe4me
Copy link

xe4me commented Feb 21, 2017

same problem here

@ORESoftware
Copy link

How can I tell ng test to ignore TypeScript compile errors?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants