(implementation)
| 134 | * @returns {EXPECTED_ANY} spies bag |
| 135 | */ |
| 136 | const spyOnCompiler = (implementation) => { |
| 137 | const actualFn = implementation.initAsyncCompiler.bind(implementation); |
| 138 | |
| 139 | const initSpy = mock.method(implementation, "initAsyncCompiler", async () => { |
| 140 | const compiler = await actualFn(); |
| 141 | // eslint-disable-next-line no-use-before-define |
| 142 | spies.compileStringSpy = mock.method(compiler, "compileStringAsync"); |
| 143 | return compiler; |
| 144 | }); |
| 145 | |
| 146 | const spies = { |
| 147 | initSpy, |
| 148 | mockClear() { |
| 149 | if (this.compileStringSpy) { |
| 150 | this.compileStringSpy.mock.resetCalls(); |
| 151 | } |
| 152 | }, |
| 153 | mockRestore() { |
| 154 | initSpy.mock.restore(); |
| 155 | delete this.compileStringSpy; |
| 156 | }, |
| 157 | }; |
| 158 | |
| 159 | return spies; |
| 160 | }; |
| 161 | |
| 162 | describe("implementation option", () => { |
| 163 | const dartSassSpyModernAPI = mock.method(sass, "compileStringAsync"); |
no outgoing calls
no test coverage detected
searching dependent graphs…