CucumberJS未在Gitlab CI的typescript中编译
NPM脚本:CucumberJS未在Gitlab CI的typescript中编译,typescript,gitlab-ci,cucumberjs,Typescript,Gitlab Ci,Cucumberjs,NPM脚本:“cumber”:“cumber js——需要特性/tests.setup.js——需要特性/***.ts” tests.setup.js: > cucumber-js --require features/tests.setup.js --require features/**/*.ts Error: Parse error in 'features/step-definitions/steps.calculus-triangle.ts': (1:1): expected:
“cumber”:“cumber js——需要特性/tests.setup.js——需要特性/***.ts”
tests.setup.js:
> cucumber-js --require features/tests.setup.js --require features/**/*.ts
Error: Parse error in 'features/step-definitions/steps.calculus-triangle.ts': (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'import {Then} from 'cucumber''
at events.forEach.event (/builds/Ambroise-Rabier/mandala-vibratoire/node_modules/cucumber/lib/cli/helpers.js:110:13)
at Array.forEach (<anonymous>)
at getTestCases (/builds/Ambroise-Rabier/mandala-vibratoire/node_modules/cucumber/lib/cli/helpers.js:81:10)
at _bluebird.default.each (/builds/Ambroise-Rabier/mandala-vibratoire/node_modules/cucumber/lib/cli/helpers.js:58:35)
require('ts-node')。寄存器({
transpileOnly:是的,
编译器选项:{
“模块”:“commonjs”,
},
});
Gitlab CI错误:
> cucumber-js --require features/tests.setup.js --require features/**/*.ts
Error: Parse error in 'features/step-definitions/steps.calculus-triangle.ts': (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'import {Then} from 'cucumber''
at events.forEach.event (/builds/Ambroise-Rabier/mandala-vibratoire/node_modules/cucumber/lib/cli/helpers.js:110:13)
at Array.forEach (<anonymous>)
at getTestCases (/builds/Ambroise-Rabier/mandala-vibratoire/node_modules/cucumber/lib/cli/helpers.js:81:10)
at _bluebird.default.each (/builds/Ambroise-Rabier/mandala-vibratoire/node_modules/cucumber/lib/cli/helpers.js:58:35)
黄瓜js——需要特性/tests.setup.js——需要特性/***.ts
错误:“features/step definitions/steps.calculation triangle.ts”中的分析错误:(1:1):应为:#EOF、#语言、#标记行、#FeatureLine、#注释、#空,从“cumber”中获取“import{Then}”
在events.forEach.event(/builds/Ambroise-Rabier/mandala-可控震源/node_-modules/cucumber/lib/cli/helpers.js:110:13)
在Array.forEach()处
在getTestCases(/builds/Ambroise-Rabier/mandala-可控震源/node_-modules/cucumber/lib/cli/helpers.js:81:10)
在_bluebird.default.each(/builds/Ambroise-Rabier/mandala-可控震源/node_-modules/cucumber/lib/cli/helpers.js:58:35)
它在本地(win 10)运行,但在Gitlab CI上它似乎忽略了typescript编译。我在的帮助下找到了一些工作,但是我没有使用
nyc
,所以这里的解决方案只使用cucumberjs
NPM脚本:“cucumber”:“cucumber js——配置文件默认值”
在项目根目录下创建cucumber.js文件,内容如下:
let common=[
“--需要特性/测试。setup.js”,
“--需要功能/***.ts”,
].加入(“”);
module.exports={
默认值:普通,
};
相关文档:我在的帮助下发现了一些有用的东西,但是我没有使用
nyc
,因此这里的解决方案仅使用cucumberjs
NPM脚本:“cucumber”:“cucumber js——配置文件默认值”
在项目根目录下创建cucumber.js文件,内容如下:
let common=[
“--需要特性/测试。setup.js”,
“--需要功能/***.ts”,
].加入(“”);
module.exports={
默认值:普通,
};
相关文件: