Add wasm leak detector & fix leak
This commit is contained in:
parent
776571bc5e
commit
3abc45cb86
1 changed files with 88 additions and 5 deletions
|
|
@ -1,10 +1,22 @@
|
|||
import { reconcile, reconcileWithHistory, diff, undiff } from './index';
|
||||
import { installWasmLeakDetector, checkForWasmLeaks } from './wasm-leak-detector';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
installWasmLeakDetector();
|
||||
|
||||
afterEach(() => {
|
||||
const leaks = checkForWasmLeaks();
|
||||
if (leaks.length > 0) {
|
||||
throw new Error(
|
||||
`WASM memory leak: ${leaks.length} object(s) not freed:\n ${leaks.join('\n ')}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
describe('reconcile', () => {
|
||||
it('call reconcile without cursors', () => {
|
||||
expect(reconcile('Hello', 'Hello world', 'Hi world').text).toEqual('Hi world');
|
||||
|
|
|
|||
Loading…
Reference in a new issue