diff options
Diffstat (limited to 'lib/compilers/fake-for-test.js')
-rw-r--r-- | lib/compilers/fake-for-test.js | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/lib/compilers/fake-for-test.js b/lib/compilers/fake-for-test.js index e698a9366..4ac03c4b1 100644 --- a/lib/compilers/fake-for-test.js +++ b/lib/compilers/fake-for-test.js @@ -24,22 +24,36 @@ const _ = require('underscore-node'); -module.exports = (info, env) => { - return { - compiler: { +class FakeCompiler { + constructor(info) { + this.compiler = { id: info.id || 'fake-for-test', - lang: info.lang || 'fake-lang' - }, - getInfo: () => null, - getDefaultFilters: () => [], - getRemote: () => null, - compile: (source, options, backendOptions, filters) => Promise.resolve(_.extend(info.fakeResult || {}, { + lang: info.lang || 'fake-lang', + options: info.options || '' + }; + this.info = info; + } + + getInfo() { + return null; + } + getDefaultFilters() { + return []; + } + getRemote() { + return null; + } + compile(source, options, backendOptions, filters) { + return Promise.resolve(_.extend(this.info.fakeResult || {}, { input: { source: source, options: options, backendOptions: backendOptions, filters: filters } - })) - }; -};
\ No newline at end of file + })); + } +} + + +module.exports = FakeCompiler;
\ No newline at end of file |