Prevents Jest from completion
ArmorDarks opened this issue · comments
Hi
Thanks for great plugin!
However, it has some issues with Jest when Grunt called programmatically:
const gt = require('grunt')
const gruntfile = require('./gruntfile')
// This line will cause Jest to hang after all tests
const grunt = gruntfile.call(gt, gt)
module.exports = grunt
Whenever Gruntfile called in Jest environment, upon completing tests Jest will not exit.
It most likely caused by the fact, that time-grunt
hooks some listeners, and Jest awaits completion of them, which never happens.
Here is test example:
const grunt = require('../utils/grunt')
describe('Grunt task', () => {
it('should log config', () => {
expect(grunt.config()).toMatchSnapshot()
})
})
As can be seen here, grunt --quite
isn't solution, since actually Grunt never runs, but we merely executing Gruntfile to receive access to current Grunt instance and its configs. However, even execution of Gruntfile already kicks-in time-grunt
which binds something internally, which makes Jest endlessly await completion.
Small, but important note: to observe this happening, Jest should run in Node environment:
In package.json
should be specified
"jest": {
"testEnvironment": "node",
}
Closing as this project is deprecated because Grunt is no longer actively maintained, so it doesn't make sense for me to maintain this project either.