emacs 为 Javascript 测试编译
emacs compile for Javascript tests
我正在使用 emacs 开发 javascript (Node.js)。用于测试的摩卡咖啡。我 运行 mocha 和 make 这是我的 Makefile:
REPORTER=spec
MOCHA_OPTS=--ui bdd --timeout 2000 --colors
test:
@NODE_ENV=test \
./node_modules/mocha/bin/mocha \
--reporter $(REPORTER) \
$(MOCHA_OPTS) \
test/*.js
用 emacs 编译它 运行测试很好,但这是输出:
#Category API
[0G ✓ should create a category (378ms)
[0G ✓ should get category list (282ms)
[0G ✓ should get category (213ms)
[0G ✓ should verify category permissions (211ms)
[0G ✓ should edit category (454ms)
[0G ✓ should verify category (218ms)
[0G ✓ should remove category (242ms)
有没有办法从输出中删除那些丑陋的 [0G]?
Mocha 尝试检测它是否是 运行 tty,如果是,它将允许记者输出 ANSI 序列。将 --colors
更改为 --no-colors
会有所帮助,但只是部分帮助。事实上,有些记者试图四处移动 tty 光标,即使颜色已关闭,仍会输出 ANSI 序列。没有标志强制 Mocha 将其输出视为非 tty。但是,您可以通过以下方式获得相同的结果:
$ mocha | cat
如果您想要一个在 Emacs 内部调用时不输出 ANSI 序列但在外部运行 "normally" 的 Makefile,您可以这样做:
REPORTER=spec
MOCHA_OPTS=--ui bdd --timeout 2000 $(if $(INSIDE_EMACS),--no-colors,--colors)
.PHONY: test
test:
@NODE_ENV=test \
./node_modules/mocha/bin/mocha \
--reporter $(REPORTER) \
$(MOCHA_OPTS) \
test/*.js $(and $(INSIDE_EMACS),| cat)
INSIDE_EMACS
由 Emacs 定义。
我正在使用 emacs 开发 javascript (Node.js)。用于测试的摩卡咖啡。我 运行 mocha 和 make 这是我的 Makefile:
REPORTER=spec
MOCHA_OPTS=--ui bdd --timeout 2000 --colors
test:
@NODE_ENV=test \
./node_modules/mocha/bin/mocha \
--reporter $(REPORTER) \
$(MOCHA_OPTS) \
test/*.js
用 emacs 编译它 运行测试很好,但这是输出:
#Category API
[0G ✓ should create a category (378ms)
[0G ✓ should get category list (282ms)
[0G ✓ should get category (213ms)
[0G ✓ should verify category permissions (211ms)
[0G ✓ should edit category (454ms)
[0G ✓ should verify category (218ms)
[0G ✓ should remove category (242ms)
有没有办法从输出中删除那些丑陋的 [0G]?
Mocha 尝试检测它是否是 运行 tty,如果是,它将允许记者输出 ANSI 序列。将 --colors
更改为 --no-colors
会有所帮助,但只是部分帮助。事实上,有些记者试图四处移动 tty 光标,即使颜色已关闭,仍会输出 ANSI 序列。没有标志强制 Mocha 将其输出视为非 tty。但是,您可以通过以下方式获得相同的结果:
$ mocha | cat
如果您想要一个在 Emacs 内部调用时不输出 ANSI 序列但在外部运行 "normally" 的 Makefile,您可以这样做:
REPORTER=spec
MOCHA_OPTS=--ui bdd --timeout 2000 $(if $(INSIDE_EMACS),--no-colors,--colors)
.PHONY: test
test:
@NODE_ENV=test \
./node_modules/mocha/bin/mocha \
--reporter $(REPORTER) \
$(MOCHA_OPTS) \
test/*.js $(and $(INSIDE_EMACS),| cat)
INSIDE_EMACS
由 Emacs 定义。