eclipsesource / eclipsesource/jsonforms

Error in vue-vanilla when running tests

Open
#1,747 7 comments 0 reactions 0 assignees View on GitHub
dev
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

When running `npm run test`, not all tests pass, but instead fail with syntax error.

**To Reproduce**
1. Clone the repository
2. Check out `master` branch
3. `npm ci`
4. `npm run init`
5. `npm run build`
6. `npm run test`

Tests fail with error:

```
> @jsonforms/vue@2.5.1-beta.0 test /Users/nene/github/jsonforms/packages/vue/vue
> vue-cli-service test:unit

lerna ERR! npm run test exited 1 in '@jsonforms/vue-vanilla'
lerna ERR! npm run test stdout:

> @jsonforms/vue-vanilla@2.5.1-beta.0 test /Users/nene/github/jsonforms/packages/vue/vue-vanilla
> vue-cli-service test:unit

WEBPACK Compiling...

ERROR Failed to compile with 6 errors

error in ./src/styles/styles.ts

Module parse failed: Unexpected token (28:15)
File was processed with these loaders:
* ../../../node_modules/cache-loader/dist/cjs.js
* ../../../node_modules/babel-loader/lib/index.js
* ../../../node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
| const userStyles = (0, _vue.inject)('styles', _defaultStyles.defaultStyles);
|
> if (!element?.options?.styles) {
| return userStyles;
| }

@ ./src/styles/index.ts 7:14-33
@ ./src/index.ts
@ /Users/nene/github/jsonforms/node_modules/cache-loader/dist/cjs.js??ref--14-0!/Users/nene/github/jsonforms/node_modules/babel-loader/lib!/Users/nene/github/jsonforms/node_modules/ts-loader??ref--14-2!/Users/nene/github/jsonforms/node_modules/cache-loader/dist/cjs.js??ref--1-0!/Users/nene/github/jsonforms/node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./tests/unit/util/TestComponent.vue?vue&type=script&lang=ts
@ ./tests/unit/util/TestComponent.vue?vue&type=script&lang=ts
@ ./tests/unit/util/TestComponent.vue
@ ./tests/unit/util/util.ts
@ ./tests/unit/util/index.ts
@ ./tests/unit/array/ArrayListRenderer.spec.ts
@ /Users/nene/github/jsonforms/node_modules/mochapack/lib/entry.js

error in ./src/controls/NumberControlRenderer.vue?vue&type=script&lang=ts
```

there are several other errors, though I think only the first one matters, as it points to the failure of handling the optional chaining operator at line:

```js
if (!element?.options?.styles) {
```

Might be a problem with tsconfig setup. I notice that in `tsconfig.base` there's `"target": "es5"` while `vue-vanilla/tsconfig.json` has `"target": "esnext"`.

**Expected behavior**
Tests pass.

**Used Setup:**
- OS: MacOS 11.2.3
- NodeJS: 14.16.0
- npm: 6.14.11
- Framework: vue
- RendererSet: vanilla

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.