lukeed / uvu

uvu is an extremely fast and lightweight test runner for Node.js and the browser
MIT License
2.98k stars 99 forks source link

uvu does not like inifinite linked lists #203

Open Hexagon opened 2 years ago

Hexagon commented 2 years ago
import { test } from 'uvu';
import * as assert from 'uvu/assert';

test('Circular reference', () => {

    const obj1 = {}, obj2 = {};

    // Very compact infinite linked list
    obj1.next = obj2;
    obj2.next = obj1;

    /*
        PASS
    */
    assert.equal(obj1.next, obj2);

    /*
        FAIL  "Circular reference"
        Maximum call stack size exceeded

        at dequal (file:///.../node_modules/dequal/dist/index.mjs:11:2)
        at dequal (file:///.../node_modules/dequal/dist/index.mjs:77:28)
    */
    assert.not.equal(obj1, obj2);

});

test.run();