Vue + jest debug - vue.js

i'm trying to debug in vs code my vue project which uses jest for testing.
jest.config.js:
module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue'
],
transform: {
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest'
},
transformIgnorePatterns: [
'/node_modules/',
'/node_modules/(?!#babel)'
],
moduleNameMapper: {
'^#/(.*)$': '<rootDir>/src/$1'
},
snapshotSerializers: [
'jest-serializer-vue'
],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
],
testURL: 'http://localhost/',
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname'
]
}
launch.json :
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Unit Tests",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"test:debug",
"${file}"
],
"port": 9229
}
]
}
I've tried almost every tutorial online like :
https://medium.com/#sarngru/debug-vuejs-jest-tests-in-vscode-63e2ed45e503
when tried to run debugging got :
node_modules\.bin\vue-cli-service:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at new Script (vm.js:83:7)
at createScript (vm.js:267:10)
at Object.runInThisContext (vm.js:319:10)
at Module._compile (internal/modules/cjs/loader.js:684:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
Waiting for the debugger to disconnect...
tried npm install -g #vue/cli-service-global but it doesnt work as well.. plese help! thanks!

This works for me
launch.json :
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": ["-i"],
"skipFiles": ["<node_internals>/**/*.js", "node_modules"]
}
]
}

Related

Vue Jest Invalid or unexpected token

I'm new to Jest and Vue, but I'm getting an error in one of my tests.
The error is:
Test suite failed to run
/...../node_modules/element-ui/lib/theme-chalk/table-column.css:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){#charset "UTF-8";.el-checkbox,.el-checkbox__input{white-space:nowrap;display:inline-block;position:relative}.el-checkbox{color:#606266;font-weight:500;font-size:14px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:30px}.el-checkbox.is-bordered{padding:9px 20px 9px 10px;border-radius:4px;border:1px solid #DCDFE6;-webkit-box-sizing:border-box;box-sizing:border-box;line-height:normal;height:40px}.el-checkbox.is-bordered.is-checked{border-color:#409EFF}.el-checkbox.is-bordered.is-disabled{border-color:#EBEEF5;cursor:not-allowed}.el-checkbox.is-bordered+.el-checkbox.is-bordered{margin-left:10px}.el-checkbox.is-bordered.el-checkbox--medium{padding:7px 20px 7px 10px;border-radius:4px;height:36px}.el-checkbox.is-bordered.el-checkbox--medium .el-checkbox__l
SyntaxError: Invalid or unexpected token
Here's my package.json file:
"jest": {
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
".*\\.(vue)$": "vue-jest",
".*\\.(js)$": "babel-jest"
},
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"^#/(.*)$": "<rootDir>/src/$1"
},
"testPathIgnorePatterns": [
"<rootDir>/(build|docs|node_modules)/*"
],
"testEnvironment": "node"
},
"babel": {
"presets": [
[
"#babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
},
I don't understand why node_modules isn't being excluded, but even if they aren't excluded why isn't the .css file being mocked?
I suspected the issue was jest was not reading my config from package.json.
To verify this I used the jest --showConfig. Indeed, it was different from package.json.
I then created a new config file, jest.json and I changed the test script in package.json to be "test": "jest --config jest.json"
This is the contents of my config:
{
"verbose": true,
"automock": false,
"globals": {
"_Table": {"name": "el-table"},
"_TableColumn": {"name": "el-table-column"}},
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
".*\\.(vue)$": "vue-jest",
".*\\.(js)$": "babel-jest"
},
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"^#/(.*)$": "<rootDir>/src/$1"
},
"testPathIgnorePatterns": [
"<rootDir>/(build|docs|node_modules)/"
]
}
There are a few more issues, but this was the main one.

Angular build failed wtih

When I am trying to ng build the angular project, it failed generating ES5 bundle. But ng serve is working well.
Generating ES5 bundles for differential loading...
An unhandled exception occurred: Call retries were exceeded
See "C:\Users\Users\AppData\Local\Temp\ng-NswrgZ\angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! initial-angular-project#0.0.0 build: `ng build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the initial-angular-project#0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Users\AppData\Roaming\npm-cache\_logs\2020-10-29T10_43_34_845Z-debug.log
angular-errors.log file message error:
[error] Error: Call retries were exceeded
at ChildProcessWorker.initialize (E:\Work_Cord\InitialAngularProject\node_modules\jest-worker\build\workers\ChildProcessWorker.js:193:21)
at ChildProcessWorker._onExit (E:\Work_Cord\InitialAngularProject\node_modules\jest-worker\build\workers\ChildProcessWorker.js:274:12)
at ChildProcess.emit (events.js:315:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
angular.json file
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"InitialAngularProject": {
"projectType": "application",
"schematics": {
"#schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/InitialAngularProject/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"allowedCommonJsDependencies": [
"file-saver",
"rxjs/internal/Observable",
"js-sha256",
"devextreme",
"devextreme-angular"
],
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/devextreme/dist/css/dx.common.css",
"node_modules/devextreme/dist/css/dx.light.css",
"./node_modules/#angular/material/prebuilt-themes/purple-green.css",
"./node_modules/bootstrap/dist/css/bootstrap.css",
"src/styles.scss"
],
"scripts": [
"./node_modules/jquery/dist/jquery.js",
"./node_modules/bootstrap/dist/js/bootstrap.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "10mb",
"maximumError": "10mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "InitialAngularProject:build",
"port": 4201
},
"configurations": {
"production": {
"browserTarget": "InitialAngularProject:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "InitialAngularProject:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/#angular/material/prebuilt-themes/purple-green.css",
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json",
"tsconfig.server.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "InitialAngularProject:serve"
},
"configurations": {
"production": {
"devServerTarget": "InitialAngularProject:serve:production"
}
}
},
"server": {
"builder": "#angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/InitialAngularProject/server",
"main": "src/main.server.ts",
"tsConfig": "tsconfig.server.json"
},
"configurations": {
"production": {
"outputHashing": "media",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"sourceMap": false,
"optimization": true
}
}
},
"app-shell": {
"builder": "#angular-devkit/build-angular:app-shell",
"options": {
"browserTarget": "InitialAngularProject:build",
"serverTarget": "InitialAngularProject:server",
"route": "app-shell-path"
},
"configurations": {
"production": {
"browserTarget": "InitialAngularProject:build:production",
"serverTarget": "InitialAngularProject:server:production"
}
}
}
}
}
},
"defaultProject": "InitialAngularProject",
"cli": {
"analytics": "05fad134-b906-4d6c-81e2-8fd3f3ad3a2e"
}
}
I have tried a few method but it kept failing. Please refer to the link below.
https://javascriptforwp.com/forums/topic/npm-err-code-elifecycle-on-terminal/
https://github.com/Autodesk-Forge/forge-boilers.nodejs/issues/7
How to solve npm error "npm ERR! code ELIFECYCLE"

Configuration for Debugging Mocha Unit Tests in Vue.js with VSCode

I am currently facing some problems getting my tests to debug properly with VSCode in Vue.js (I am using Mocha and Webpack)
The first configuration I found which got me a bit closer was this one.
Configuration in .vscode/launch.json
{
"type": "node",
"request": "launch",
"name": "Unit Tests",
"program": "${workspaceFolder}/node_modules/#vue/cli-service/bin/vue-cli-service.js",
"args": [
"test:unit"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
Now this solution did attach but the problem is it was only debuggin inside of the vue-cli-service.js (node_modules/#vue/cli-service/bin/vue-cli-service.js). I tries alot around here but did not came alot closer. So I thought I'd just write a Configuration myself as Vue is just using Webpack and Mocha and this should be possible. Now I got closer but still not to a version that is actually usable. Right now this is the configuration that I have
Configuration in .vscode/launch.json
{
"name": "Run mocha-webpack",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha-webpack/bin/mocha-webpack",
"args": [
"--debug-brk", "5858",
"--timeout", "120000",
"--require", "node_modules/#vue/cli-plugin-unit-mocha/setup.js",
"--webpack-config", "node_modules/#vue/cli-service/webpack.config.js",
"tests"
],
"sourceMapPathOverrides": {
"webpack:///./~/*": "${workspaceRoot}/node_modules/*",
"webpack:///./*": "${workspaceRoot}/*",
"webpack:///*": "*"
},
"stopOnEntry": false,
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
],
"env": { "NODE_ENV": "test"},
"console": "integratedTerminal",
"outFiles": []
}
Now this got me one step closer. I can now at least set a debugger statement in my code and the debugger will stop there. However it will still not react to Breakpoints I have set using VSCode. I guess this must have to do something with the compilation of the code and the sourceMapping but I am so far unable to make this work.
Alright so TLDR
vue.config.js
module.exports = {
"transpileDependencies": [
"vuetify"
],
chainWebpack: config => {
if (process.env.NODE_ENV === 'test') {
config.merge({
devtool: 'cheap-module-eval-source-map',
});
}
}
}
launch.json
{
"type": "node",
"request": "launch",
"name": "Run Unit Tests",
"program": "${workspaceFolder}/node_modules/#vue/cli-service/bin/vue-cli-service.js",
"args": ["test:unit", "--inspect-brk", "--watch", "--timeout", "999999"],
"port": 9229
}
What you want to do is to chain the webpack config so that if you are in testing you change your devtool to one that does not transpile your code like "cheap-module-eval-source".
Thanks to rustyx for pointing that out on GitHub.
Configure webpack to conditional behaviour depending on the environment. This is described in the documentation Working with Webpack and Modes and Environment Variables
of Vue CLI.
For the test-mode, which is used by vue-cli-service test:unit, mutate the devtool to not transpile the code e.g. cheap-module-eval-source or eval-source-map.
vue.config.js
module.exports = {
configureWebpack: config => {
if ((process.env.NODE_ENV === 'development') || (process.env.NODE_ENV === 'production')) {
config.devtool = 'source-map'
}
else if (process.env.NODE_ENV === 'test') {
config.devtool = 'cheap-module-eval-source-map'
}
}
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "test:unit debug",
"program": "${workspaceFolder}/node_modules/#vue/cli-service/bin/vue-cli-service.js",
"args": ["test:unit", "--inspect-brk", "--timeout", "900000"],
"port": 9229
}
]
}

jest config hanging when getting coverage

I have a vue application that has got jest installed as the testing framework. The jest config is in the package.json file. It looks like:
"jest": {
"moduleFileExtensions": [
"js",
"jsx",
"json",
"vue"
],
"transform": {
"^.+\\.vue$": "vue-jest",
".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
"^.+\\.jsx?$": "babel-jest"
},
"moduleNameMapper": {
"^#/(.*)$": "<rootDir>/src/$1"
},
"snapshotSerializers": [
"jest-serializer-vue"
],
"testMatch": [
"**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)",
"**/tests/unit/**/*.test.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
],
"testURL": "http://localhost",
"collectCoverage": true,
"collectCoverageFrom": [
"!**/node_modules/**",
"**/*.{js,vue}"
],
"coverageDirectory": "../coverage",
"coverageReporters": [
"html",
"text-summary"
]
}
These are i think the default setting when i installed the vue application using the vue cli.
I am experiencing issues after my tests run the terminal says Running coverage on untested files... and then it just hangs there forever.
If i remove the js bit from "**/*.{js,vue}" in the collectCoverageFrom so that it is "**/*.{vue}" then the problem doesn't occur and the coverage report completes.
Does anyone have experience of this problem? are there any config settings needed to prevent this issue?

Aurelia build for production creates bundles with "undefined" as content

Hi I have a web app built over the Aurelia CLI. To fix a performance problem (that I addressed here) I updated to the latest version of Aurelia (0.30.1, which fixed the performance issue). To do so, I had to update other npm packages, forcing the semver to the latest versions available using the npm-check-updates package first
npm install -g npm-check-updates
ncu --upgrade
npm update
npm install babel-runtime --save-dev
npm install timers-ext --save-dev
npm install gulp-sourcemaps --save-dev
npm install aurelia-pal --save-dev
npm install aurelia-binding --save-dev
npm install aurelia-templating --save-dev
this is my aurelia.json file
{
"name": "XX.YY.Web",
"type": "project:application",
"platform": {
"id": "web",
"displayName": "Web",
"output": "scripts",
"index": "index.html"
},
"transpiler": {
"id": "babel",
"displayName": "Babel",
"fileExtension": ".js",
"options": {
"plugins": [
"transform-es2015-modules-amd"
]
},
"source": "src\\**\\*.js"
},
"markupProcessor": {
"id": "none",
"displayName": "None",
"fileExtension": ".html",
"source": "src\\**\\*.html"
},
"cssProcessor": {
"id": "none",
"displayName": "None",
"fileExtension": ".css",
"source": "src\\**\\*.css"
},
"editor": {
"id": "vscode",
"displayName": "Visual Studio Code"
},
"unitTestRunner": {
"id": "karma",
"displayName": "Karma",
"source": "test\\unit\\**\\*.js"
},
"paths": {
"root": "src"
},
"testFramework": {
"id": "jasmine",
"displayName": "Jasmine"
},
"build": {
"targets": [
{
"id": "web",
"displayName": "Web",
"output": "scripts",
"index": "scripts/index.html",
"useAbsolutePath": true
}
],
"loader": {
"type": "require",
"configTarget": "vendor-bundle.js",
"includeBundleMetadataInConfig": "auto",
"config": {
"waitSeconds": 0,
"paths": {
"jquery": "../scripts/lib/cdn/jquery-3.1.0.min",
"breeze-client": "../node_modules/breeze-client/breeze.debug"
}
},
"plugins": [
{
"name": "text",
"extensions": [
".html",
".css"
],
"stub": true
}
]
},
"options": {
"minify": "stage & prod",
"sourcemaps": "dev & stage",
"rev": "stage & prod"
},
"bundles": [
{
"name": "app-bundle.js",
"source": [
"[**/*.js]",
"**/*.{css,html}"
]
},
{
"name": "vendor-bundle.js",
"prepend": [
"node_modules/bluebird/js/browser/bluebird.core.js",
"scripts/lib/require.js"
],
"dependencies": [
"aurelia-binding",
"aurelia-bootstrapper",
"aurelia-dependency-injection",
"aurelia-event-aggregator",
"aurelia-fetch-client",
"aurelia-framework",
"aurelia-history",
"aurelia-history-browser",
"aurelia-loader",
"aurelia-loader-default",
"aurelia-logging",
"aurelia-logging-console",
"aurelia-metadata",
"aurelia-pal",
"aurelia-pal-browser",
"aurelia-path",
"aurelia-polyfills",
"aurelia-route-recognizer",
"aurelia-router",
"aurelia-task-queue",
"aurelia-templating",
"aurelia-templating-binding",
{
"name": "text",
"path": "../scripts/lib/text",
"packageRoot": "../scripts/lib"
},
{
"name": "aurelia-templating-resources",
"path": "../node_modules/aurelia-templating-resources/dist/amd",
"main": "aurelia-templating-resources"
},
{
"name": "aurelia-templating-router",
"path": "../node_modules/aurelia-templating-router/dist/amd",
"main": "aurelia-templating-router"
},
{
"name": "aurelia-breeze",
"path": "../node_modules/aurelia-breeze/dist/amd",
"main": "aurelia-breeze"
},
{
"name": "breeze-client",
"path": "../node_modules/breeze-client",
"main": "breeze.debug"
},
{
"name": "whatwg-fetch",
"path": "../node_modules/whatwg-fetch",
"main": "fetch"
},
{
"name": "aurelia-testing",
"path": "../node_modules/aurelia-testing/dist/amd",
"main": "aurelia-testing",
"env": "dev"
},
{
"name": "icheck",
"path": "../node_modules/icheck",
"main": "icheck.min"
},
{
"name": "filesaver.js",
"path": "../node_modules/filesaver.js",
"main": "FileSaver.min"
}
]
}
]
}
}
I have now a problem. If I run
au build
or
au run –watch
I have no problem.
If I run
au build –env prod
to create the app- and vendor-bundle-[identifier].js, I don’t get any errors, but both files end up created empty, or rather just with “undefined” in them.
Node.js version: 6.11.2 (current latest stable)
NPM version: 3.10.10
Does anyone have an idea? Does it have to do with the minification mechanism (which in dev does not happen)
How can I debug / log what is going wrong?
UPDATE:
I have activated minifying also for the dev environment in the aurelia.json file, this is what I got
Failed to write the bundle
SyntaxError: Unexpected token u in JSON at position 0
at Object.parse (native)
at new Converter (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:42:48)
at Object.exports.fromJSON (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:96:10)
at work.then (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\bundle.js:259:48)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
{ uid: 8,
name: 'writeBundles',
branch: false,
error:
SyntaxError: Unexpected token u in JSON at position 0
at Object.parse (native)
at new Converter (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:42:48)
at Object.exports.fromJSON (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:96:10)
at work.then (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\bundle.js:259:48)
at process._tickDomainCallback (internal/process/next_tick.js:135:7),
duration: [ 5, 639721541 ],
time: 1502969144275 }
{ uid: 0,
name: '<series>',
branch: true,
error:
SyntaxError: Unexpected token u in JSON at position 0
at Object.parse (native)
at new Converter (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:42:48)
at Object.exports.fromJSON (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:96:10)
at work.then (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\bundle.js:259:48)
at process._tickDomainCallback (internal/process/next_tick.js:135:7),
duration: [ 47, 444524559 ],
time: 1502969144277 }
SyntaxError: Unexpected token u in JSON at position 0
at Object.parse (native)
at new Converter (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:42:48)
at Object.exports.fromJSON (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:96:10)
at work.then (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\bundle.js:259:48)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
If I activate minification for dev, it doesn't work either, giving the error I pasted above. If I also remove sourcemaps, it doesn't work (undefined by both bundles) but no error message.
Upgrading to the latest version of the aurelia-cli npm module (0.31.3) and all other modules to their latest versions fixed the issue.
I think you can now just do au build (without the --env prod flags.