Can't require Underscore with CasperJS

前端 未结 1 1649
清歌不尽
清歌不尽 2021-01-13 17:55

I\'m using CasperJS to run automated frontend tests but have run in to an issue with using other npm modules in my tests. I\'m aware of patchRequire

相关标签:
1条回答
  • 2021-01-13 18:42

    So solution I eventually found was to create proxy modules that import the npm module and export it out to the casper script.

    ./proxies/underscore.js:

    module.exports = require('underscore');
    

    ./tests/test.js

    var _ = require('../proxies/underscore');
    
    0 讨论(0)
提交回复
热议问题