ddd icon indicating copy to clipboard operation
ddd copied to clipboard

Supported node.js version is not specified as prerequisite in README.

Open happy-nut opened this issue 5 years ago • 0 comments

I have 2 versions of node.js in my local.

❯ nvm ls
       v10.21.0
->     v14.15.0
         system

But in both versions, yarn test failed in ddd/packages/ddd with same error below:

yarn run v1.22.4
$ jest "(src\/.+\.|/)spec\.ts$"
 FAIL  src/infrastructure/read-repository.spec.ts
  ● Test suite failed to run

    SyntaxError: /Users/poqw/github/ddd/packages/ddd/src/infrastructure/read-repository.spec.ts: Unexpected token, expected "{" (12:47)

      10 | }
      11 |
    > 12 | class UserReadRepository extends ReadRepository<UserModel> {
         |                                                ^
      13 |   constructor (connection: Connection) {
      14 |     super(
      15 |       connection,

      at Parser._raise (../../node_modules/jest/node_modules/@babel/parser/src/parser/error.js:60:45)

 FAIL  src/infrastructure/write-repository.spec.ts
  ● Test suite failed to run

    SyntaxError: /Users/poqw/github/ddd/packages/ddd/src/infrastructure/write-repository.spec.ts: Unexpected reserved word 'interface' (13:0)

      11 | import { Bus } from '@node-ts/bus-core'
      12 |
    > 13 | interface UserProperties extends AggregateRootProperties {
         | ^
      14 |   name: string
      15 |   email: string
      16 | }

      at Parser._raise (../../node_modules/jest/node_modules/@babel/parser/src/parser/error.js:60:45)

 FAIL  src/domain/aggregate-root.spec.ts
  ● Test suite failed to run

    SyntaxError: /Users/poqw/github/ddd/packages/ddd/src/domain/aggregate-root.spec.ts: Support for the experimental syntax 'classProperties' isn't currently enabled (7:9):

       5 |
       6 | class SomethingHappens extends Event {
    >  7 |   $name = 'node-ts/ddd/something-happens'
         |         ^
       8 |   $version = 0
       9 |
      10 |   example = 2

    Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
    If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.

      at Parser._raise (../../node_modules/jest/node_modules/@babel/parser/src/parser/error.js:60:45)

Test Suites: 3 failed, 3 total
Tests:       0 total
Snapshots:   0 total
Time:        6.884s
Ran all test suites matching /(src\/.+\.|\/)spec\.ts$/i.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I think it is related to the version of node(Or not, let me know it first). What version should I use? and Is there any plan to support node v14 LTE?

happy-nut avatar Jan 05 '21 15:01 happy-nut