InternJs,如何在命令行上设置基本路径?
InternJs, How to set base path on command line?
详情:
我有这样的目录结构。
myapp
root-one
-web
-app
-tests
root-two
-grunt
node_modules
.bin
intern-runner
selenium-standalone
intern
selenium-standalone
grunt-shell
Gruntfile.js
从我的 grunt 文件中,我使用 shell npm 来启动 selenium 独立服务器,就像这样..
shell: {
intern : {
options: { stdout: true},
command: [
"cd node_modules/.bin",
"start selenium-standalone start",
"intern-runner config=tests/intern basePath=../../../../root-one/web"
].join('&&')
}
}
}
grunt.registerTask('intern', ['shell:intern']);
在 运行 我的 grunt 命令 grunt intern 之后,selenium 启动但我从 intern-runner 收到以下错误。
Error: Failed to load module tests/intern
from C:/myapp/root-two/grunt/node_modules/.bin/tests/intern.js
现在因为我使用 basePath=../../../../root-one/web
设置了路径(或者我认为是这样)。我本以为它会尝试从 C:/myapp/root-one/web/tests/intern.js
执行,而不是留在 .bin
目录中。
问题:
真正的问题是。在命令行上为 intern-runner 设置 basePath 的正确方法是什么?因为这似乎行不通。并根据 docs...
You can also specify any valid configuration option as an argument on
the command-line.
这让我相信我可能只是语法错误。
听起来这并不像我预期的那样有效。如此处所讨论:https://github.com/theintern/intern/issues/449
因此,目前的解决方法是只在全球范围内安装 intern,而不是尝试 运行 从我的项目中本地安装它。所以我做了..
npm install intern -g
我的项目结构是这样的...
myapp
root-one
-web
-app
-tests
root-two
-grunt
node_modules
.bin
selenium-standalone
selenium-standalone
grunt-shell
Gruntfile.js
基本上只是删除了 intern,因为它现在已在全球范围内安装。位于以下 windows..
C:\Users\user\AppData\Roaming\npm\node_modules\intern
而我的 G运行t 文件也已更改如下。启动 selenium 后,我将目录更改回 运行 intern-runner
命令的适当位置。
shell: {
intern : {
options: { stdout: true},
command: [
"cd node_modules/.bin",
"start selenium-standalone start",
"cd ../../../../root-one/web",
"intern-runner config=tests/intern
].join('&&')
}
}
}
grunt.registerTask('intern', ['shell:intern']);
详情:
我有这样的目录结构。
myapp
root-one
-web
-app
-tests
root-two
-grunt
node_modules
.bin
intern-runner
selenium-standalone
intern
selenium-standalone
grunt-shell
Gruntfile.js
从我的 grunt 文件中,我使用 shell npm 来启动 selenium 独立服务器,就像这样..
shell: {
intern : {
options: { stdout: true},
command: [
"cd node_modules/.bin",
"start selenium-standalone start",
"intern-runner config=tests/intern basePath=../../../../root-one/web"
].join('&&')
}
}
}
grunt.registerTask('intern', ['shell:intern']);
在 运行 我的 grunt 命令 grunt intern 之后,selenium 启动但我从 intern-runner 收到以下错误。
Error: Failed to load module tests/intern
from C:/myapp/root-two/grunt/node_modules/.bin/tests/intern.js
现在因为我使用 basePath=../../../../root-one/web
设置了路径(或者我认为是这样)。我本以为它会尝试从 C:/myapp/root-one/web/tests/intern.js
执行,而不是留在 .bin
目录中。
问题:
真正的问题是。在命令行上为 intern-runner 设置 basePath 的正确方法是什么?因为这似乎行不通。并根据 docs...
You can also specify any valid configuration option as an argument on the command-line.
这让我相信我可能只是语法错误。
听起来这并不像我预期的那样有效。如此处所讨论:https://github.com/theintern/intern/issues/449
因此,目前的解决方法是只在全球范围内安装 intern,而不是尝试 运行 从我的项目中本地安装它。所以我做了..
npm install intern -g
我的项目结构是这样的...
myapp
root-one
-web
-app
-tests
root-two
-grunt
node_modules
.bin
selenium-standalone
selenium-standalone
grunt-shell
Gruntfile.js
基本上只是删除了 intern,因为它现在已在全球范围内安装。位于以下 windows..
C:\Users\user\AppData\Roaming\npm\node_modules\intern
而我的 G运行t 文件也已更改如下。启动 selenium 后,我将目录更改回 运行 intern-runner
命令的适当位置。
shell: {
intern : {
options: { stdout: true},
command: [
"cd node_modules/.bin",
"start selenium-standalone start",
"cd ../../../../root-one/web",
"intern-runner config=tests/intern
].join('&&')
}
}
}
grunt.registerTask('intern', ['shell:intern']);