2017-09-29 5 views
0

私は、私はその後、参照スクリプトを"test:integration": "./node_modules/typescript/bin/tsc && mocha test/integration/** --recursive"typescriptで出力されたマップファイルで予期しないトークンが発生する原因は何ですか?

を実行していますtsconfig.json

{ 
    "compilerOptions": { 
    "target": "es6", 
    "module": "commonjs", 
    "sourceMap": true, 
    "inlineSources": true, 
    "lib": [ 
     "es6", 
     "dom" 
    ], 
    "types": [ 
     "node" 
    ], 
    "moduleResolution": "node", 
    "experimentalDecorators": true, 
    "emitDecoratorMetadata": true 
    } 
} 

とtypescriptですプロジェクトを持っている:

/Users/mm81509/projects/coverpath-producer-management/test/integration /Example.js.map:1 
(function (exports, require, module, __filename, __dirname) { {"version":3,"file":"Example.js","sourceRoot":"","sources":["Example.ts"],"names":[],"mappings":"","sourcesContent":[""]} 
                     ^
SyntaxError: Unexpected token : 
... 

typescriptですコンパイラが中に構文エラーが原因だろうかmap.js?私はこのエラーをプロジェクト内の1つのファイルにしか見ていません。

答えて

1

.mapファイルでエラーが発生しています。これらのファイルは、ソース行をコンパイルされた行にマッピングするためのものです。 Mochaに渡すグロブパターンを調整して、.mapファイルをテストファイルとして読み込まないようにします。以下のような何か:

mocha 'test/integration/**/*.js' --recursive 

それだけ.jsファイルやない.mapファイルをロードします。そしてあなたのシェルによってパターンが拡張されるのを防ぐために、一重引用符を付けることをお勧めします。シェルによって解釈されるのではなく、パターンがそのままモカに渡されるようにします。

関連する問題