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

core_1.experimental.workspace.Workspace.fromPath is not a function #345

Closed
tobang opened this issue Jun 18, 2019 · 12 comments
Closed

core_1.experimental.workspace.Workspace.fromPath is not a function #345

tobang opened this issue Jun 18, 2019 · 12 comments

Comments

@tobang
Copy link

tobang commented Jun 18, 2019

When I run ng test I get

core_1.experimental.workspace.Workspace.fromPath is not a function
TypeError: core_1.experimental.workspace.Workspace.fromPath is not a function
at C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:26:73
at Generator.next ()
at C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:7:71
at new Promise ()
at __awaiter (C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:3:12)
at getRoots (C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:22:12)
at C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:48:58
at Generator.next ()
at C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:7:71
at new Promise ()
at __awaiter (C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:3:12)
at buildArgv (C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:46:16)
at C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:59:32
at Generator.next ()
at C:\Users\00torben\code\DGI_Tilmeldingsportal\Frontend\node_modules@angular-builders\jest\dist\index.js:7:71
at new Promise ()

@just-jeb
Copy link
Owner

Versions, angular.json, package.json?

@tobang
Copy link
Author

tobang commented Jun 18, 2019

Sorry,

Angular 8.0.1

angular.json:

{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"Tilmeldingsportal": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "dgi",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js"
},
"outputPath": "dist/Tilmeldingsportal",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": ["src/favicon.ico", "src/web.config", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": [],
"es5BrowserSupport": true
},
"configurations": {
"live": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.live.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"test": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"development": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"local": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.local.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "Tilmeldingsportal:build"
},
"configurations": {
"live": {
"browserTarget": "Tilmeldingsportal:build:live"
},
"test": {
"browserTarget": "Tilmeldingsportal:build:test"
},
"development": {
"browserTarget": "Tilmeldingsportal:build:development"
},
"local": {
"browserTarget": "Tilmeldingsportal:build:local"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "Tilmeldingsportal:build"
}
},
"test": {
"builder": "@angular-builders/jest:run",
"options": {
"configPath": "jest.config.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
"exclude": ["/node_modules/"]
}
}
}
},
"Tilmeldingsportal-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "Tilmeldingsportal:serve"
},
"configurations": {
"production": {
"devServerTarget": "Tilmeldingsportal:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": ["/node_modules/"]
}
}
}
}
},
"defaultProject": "Tilmeldingsportal"
}

package.json

{
"name": "Tilmeldingsportal",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve -o",
"build": "ng build",
"build:development": "ng build --configuration=development",
"build:test": "ng build --configuration=test",
"build:live": "ng build --configuration=live",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.0.1",
"@angular/cdk": "~8.0.1",
"@angular/common": "~8.0.1",
"@angular/compiler": "~8.0.1",
"@angular/core": "~8.0.1",
"@angular/forms": "~8.0.1",
"@angular/material": "~8.0.1",
"@angular/material-moment-adapter": "^8.0.1",
"@angular/platform-browser": "~8.0.1",
"@angular/platform-browser-dynamic": "~8.0.1",
"@angular/router": "~8.0.1",
"@datorama/akita": "^3.10.1",
"bootstrap": "^4.3.1",
"core-js": "^2.5.4",
"hammerjs": "^2.0.8",
"moment": "^2.24.0",
"ngx-take-until-destroy": "^5.4.0",
"rxjs": "~6.5.2",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^8.0.1",
"@angular-builders/jest": "^8.0.3",
"@angular-devkit/build-angular": "~0.800.3",
"@angular/cli": "~8.0.3",
"@angular/compiler-cli": "~8.0.1",
"@angular/language-service": "~8.0.1",
"@datorama/akita-ng-router-store": "^3.0.0",
"@datorama/akita-ngdevtools": "^1.0.2",
"@netbasal/spectator": "^3.7.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"jest": "^24.8.0",
"jest-preset-angular": "^7.1.1",
"moment-locales-webpack-plugin": "^1.0.7",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.4.5"
}
}

@just-jeb
Copy link
Owner

Everything seems alright but I'm unable to reproduce it. Would you mind creating a minimal reproduction repo?
Also you don't have to install jest-preset-angular explicitly, the builder does that for you.

@tobang tobang closed this as completed Jun 19, 2019
@tobang tobang reopened this Jun 19, 2019
@tobang
Copy link
Author

tobang commented Jun 19, 2019

This issue is resolved. It was at strange problem with the node_modules. After moving all my code to a brand new directory and doing an npm install, it suddenly started working. I must admit, I have no idea why, but it works now.

@tobang tobang closed this as completed Jun 19, 2019
@JWTappert
Copy link

I am still running into this issue. I cleared out my node_modules and reinstalled them and that didn't fix it.

@just-jeb
Copy link
Owner

Can you please share your angular.json, package.json and yarn.lock (package-lock.json)?

@JWTappert
Copy link

angular.json

	"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
	"version": 1,
	"newProjectRoot": "projects",
	"projects": {
		"backend": {
			"root": "",
			"sourceRoot": ".",
			"projectType": "application",
			"architect": {
				"test": {
					"builder": "@angular-builders/jest:run",
					"options": {
						"watch": true
					}
				}
			}
		}
	}
}

package.json

{
  "name": "test",
  "sideEffects": true,
  "version": "0.0.0",
  "license": "MIT",
  "jest": {
    "automock": false,
    "browser": false,
    "cache": true,
    "clearMocks": false,
    "coveragePathIgnorePatterns": [
      "\\\\node_modules\\\\"
    ],
    "errorOnDeprecated": false,
    "filter": null,
    "forceCoverageMatch": [],
    "globals": {
      "__TRANSFORM_HTML__": true,
      "ts-jest": {
        "tsConfigFile": "<rootDir>\\tsconfig.spec.json"
      }
    },
    "haste": {
      "providesModuleNodeModules": []
    },
    "moduleDirectories": [
      "shared",
      "node_modules"
    ],
    "moduleFileExtensions": [
      "ts",
      "js",
      "html",
      "json"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png)$": "<rootDir>\\node_modules\\@angular-builders\\jest\\src\\jest-config\\mock-module.js",
      "^src/(.*)": "<rootDir>\\$1",
      "^app/(.*)": "<rootDir>\\app\\$1",
      "^assets/(.*)": "<rootDir>\\assets\\$1",
      "^environments/(.*)": "<rootDir>\\environments\\$1",
      "^shared/(.*)": "<rootDir>\\shared\\$1",
      "^types/(.*)": "<rootDir>\\types\\$1",
      "^backend/(.*)": "<rootDir>\\backend\\$1"
    },
    "modulePathIgnorePatterns": [],
    "prettierPath": null,
    "resetMocks": false,
    "resetModules": false,
    "resolver": null,
    "restoreMocks": false,
    "rootDir": ".",
    "roots": [
      "<rootDir>"
    ],
    "runner": "jest-runner",
    "setupFiles": [],
    "setupFilesAfterEnv": [
      "<rootDir>\\node_modules\\jest-extended\\dist\\index.js"
    ],
    "skipFilter": false,
    "snapshotSerializers": [
      "<rootDir>\\node_modules\\jest-preset-angular\\AngularSnapshotSerializer.js",
      "<rootDir>\\node_modules\\jest-preset-angular\\HTMLCommentSerializer.js"
    ],
    "testEnvironment": "jest-environment-jsdom",
    "testEnvironmentOptions": {},
    "testLocationInResults": false,
    "testMatch": [
      "**/?(*.)+(spec|test).+(ts|js)?(x)"
    ],
    "testPathIgnorePatterns": [
      "\\\\legacylib\\\\",
      "\\\\dev\\\\"
    ],
    "testRegex": "",
    "testRunner": "<rootDir>\\node_modules\\jest-jasmine2\\build\\index.js",
    "testURL": "https://github.com/@angular-cli-builders",
    "timers": "real",
    "transform": {
      "^.+\\.(ts|js|html)$": "<rootDir>\\node_modules\\jest-preset-angular\\preprocessor.js"
    },
    "transformIgnorePatterns": [
      "node_modules\\\\(?!@ngrx)"
    ],
    "watchPathIgnorePatterns": []
  },
  "scripts": {
    "test": "jest",
    "ng": "ng",
    "devtest": "rimraf ../dist/test && webpack --watch --config ./dev/webpack.devtest",
    "prodtest": "rimraf ../dist/test && webpack --config ./dev/webpack.prod"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.5",
    "@angular/animations": "^8.1.1",
    "@angular/common": "^8.1.1",
    "@angular/compiler": "^8.1.1",
    "@angular/core": "^8.1.1",
    "@angular/elements": "^8.1.1",
    "@angular/forms": "^8.1.1",
    "@angular/platform-browser": "^8.1.1",
    "@angular/platform-browser-dynamic": "^8.1.1",
    "@angular/router": "^8.1.1",
    "@angular/upgrade": "^8.1.1",
    "@ngui/auto-complete": "^1.0.2",
    "@types/daterangepicker": "^2.1.19",
    "@types/qtip2": "^2.2.29",
    "@types/ua-parser-js": "^0.7.32",
    "angular2-color-picker": "^1.3.1",
    "angular2-prettyjson": "^3.0.1",
    "bootstrap": "^3.3.7",
    "chart.js": "2.6.0",
    "core-js": "^2.4.1",
    "font-awesome": "4.7.0",
    "fullcalendar-scheduler": "^1.9.2",
    "introjs": "^0.2.2",
    "jQuery.print": "^1.4.1",
    "jquery": "2.1.4",
    "jquery-ui": "^1.12.1",
    "moment": "2.10.6",
    "moment-timezone": "0.4.0",
    "ng2-ckeditor": "1.2.0",
    "ng2-dnd": "^5.0.2",
    "ng2-scroll-to-el": "^1.2.1",
    "ngmap": "^1.18.4",
    "ngx-color-picker": "^6.5.0",
    "parallelshell": "^3.0.2",
    "promise-polyfill": "8.0.0",
    "qtip2": "^3.0.3",
    "rxjs": "^6.5.2",
    "rxjs-compat": "^6.4.0",
    "script-loader": "^0.7.2",
    "tslib": "^1.9.0",
    "ua-parser-js": "^0.7.18",
    "underscore": "^1.8.3",
    "web-animations-js": "^2.3.2",
    "webpack-run-loader": "0.1.0-beta.7",
    "webpack-utf8-bom": "^1.1.3",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-builders/jest": "^8.0.4",
    "@angular-devkit/build-angular": "~0.801.1",
    "@angular-devkit/build-optimizer": "^0.8.3",
    "@angular/cli": "^8.1.1",
    "@angular/compiler-cli": "^8.2.0-next.1",
    "@angular/language-service": "^8.1.1",
    "@ngtools/webpack": "^6.2.3",
    "@types/bootstrap": "^3.3.38",
    "@types/core-js": "^0.9.44",
    "@types/intro.js": "^2.4.3",
    "@types/jquery": "^3.3.29",
    "@types/jqueryui": "^1.12.3",
    "@types/lodash": "^4.14.106",
    "@types/moment-timezone": "^0.5.4",
    "@types/node": "^8.10.0",
    "@webcomponents/webcomponentsjs": "^2.2.5",
    "angular-ui-calendar": "1.0.2",
    "angular2-template-loader": "^0.6.2",
    "autoprefixer": "^7.2.3",
    "awesome-typescript-loader": "^5.2.1",
    "bootstrap-daterangepicker": "2.1.25",
    "circular-dependency-plugin": "^5.0.2",
    "clean-webpack-plugin": "^0.1.19",
    "codelyzer": "^5.0.1",
    "concurrently": "^3.5.1",
    "copy-webpack-plugin": "^4.5.1",
    "css-loader": "^1.0.0",
    "daterangepicker": "^2.1.25",
    "es6-string-polyfills": "^1.0.0",
    "exports-loader": "^0.7.0",
    "expose-loader": "^0.7.5",
    "file-loader": "^2.0.0",
    "fullcalendar": "^3.8.2",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.1.0",
    "intro.js": "^2.9.3",
    "jest": "^24.8.0",
    "jest-cli": "^24.8.0",
    "jest-extended": "^0.11.2",
    "lodash": "^4.17.14",
    "mini-css-extract-plugin": "^0.4.3",
    "mousetrap": "^1.6.1",
    "multiple-date-picker": "2.1.1",
    "ng-table": "0.5.4",
    "ng2-file-upload": "^1.3.0",
    "node-sass": "^4.12.0",
    "precss": "^3.1.2",
    "raw-loader": "^0.5.1",
    "rimraf": "^2.6.2",
    "sass-loader": "^7.1.0",
    "speed-measure-webpack-plugin": "^1.2.3",
    "style-loader": "^0.23.0",
    "terser-webpack-plugin": "^1.2.1",
    "to-string-loader": "^1.1.5",
    "typescript": "~3.4",
    "uglifyjs-webpack-plugin": "^2.0.1",
    "url-loader": "^1.1.1",
    "webpack": "^4.19.1",
    "webpack-build-notifier": "^0.1.23",
    "webpack-bundle-analyzer": "^3.3.2",
    "webpack-cli": "^3.1.0",
    "webpack-merge": "^4.1.4"
  }
}

@JWTappert
Copy link

My package-loc.json is massive (exceeds the limit)

@just-jeb
Copy link
Owner

@JWTappert Well I need it to understand what's wrong. Any chance for minimal reproduction repo?

@peturh
Copy link

peturh commented Jul 25, 2019

I solved this issue by after my upgrade delete the node_modules/ folder and ran yarn again. Started working after that.

@agerbig
Copy link

agerbig commented Jul 26, 2019

Hello,
I have the same error when I execute the command ng test. I created a new angular 8 project with jest as test framework. The project is here:

https://github.com/agerbig/angular8-jest-devextreme

When I add the dependency devextreme-angular, remove the folder node_modules and the file package-lock.json the error occurs after npm install and ng test. After removing the dependency again and deleting the node_modules folder and package-lock.json file the command ng test works again.

What may be the cause?

@johannestretton37
Copy link

Installing @angular-devkit/core solved the problem for me. See #426

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

No branches or pull requests

6 participants