diff --git a/test/function/cycles-pathological/A.js b/test/function/cycles-pathological/A.js new file mode 100644 index 0000000..9e0fd2e --- /dev/null +++ b/test/function/cycles-pathological/A.js @@ -0,0 +1,11 @@ +import B from './B'; + +export default class A { + constructor () { + this.isA = true; + } + + b () { + return new B(); + } +} diff --git a/test/function/cycles-pathological/B.js b/test/function/cycles-pathological/B.js new file mode 100644 index 0000000..1c8e9b4 --- /dev/null +++ b/test/function/cycles-pathological/B.js @@ -0,0 +1,8 @@ +import A from './A'; + +export default class B extends A { + constructor () { + super(); + this.isB = true; + } +} diff --git a/test/function/cycles-pathological/C.js b/test/function/cycles-pathological/C.js new file mode 100644 index 0000000..313bba7 --- /dev/null +++ b/test/function/cycles-pathological/C.js @@ -0,0 +1,8 @@ +import D from './D'; + +export default class C extends D { + constructor () { + super(); + this.isC = true; + } +} diff --git a/test/function/cycles-pathological/D.js b/test/function/cycles-pathological/D.js new file mode 100644 index 0000000..2d8a405 --- /dev/null +++ b/test/function/cycles-pathological/D.js @@ -0,0 +1,11 @@ +import C from './C'; + +export default class D { + constructor () { + this.isD = true; + } + + c () { + return new C(); + } +} diff --git a/test/function/cycles-pathological/_config.js b/test/function/cycles-pathological/_config.js new file mode 100644 index 0000000..801659f --- /dev/null +++ b/test/function/cycles-pathological/_config.js @@ -0,0 +1,19 @@ +var assert = require( 'assert' ); + +module.exports = { + description: 'resolves pathological cyclical dependencies gracefully', + babel: true, + exports: function ( exports ) { + assert.ok( exports.a.isA ); + assert.ok( exports.b1.isA ); + assert.ok( exports.b1.isB ); + assert.ok( exports.b2.isA ); + assert.ok( exports.b2.isB ); + assert.ok( exports.c1.isC ); + assert.ok( exports.c1.isD ); + assert.ok( exports.c2.isC ); + assert.ok( exports.c2.isD ); + assert.ok( exports.d.isD ); + }, + solo: true +}; diff --git a/test/function/cycles-pathological/main.js b/test/function/cycles-pathological/main.js new file mode 100644 index 0000000..f4c19db --- /dev/null +++ b/test/function/cycles-pathological/main.js @@ -0,0 +1,12 @@ +import A from './A'; +import B from './B'; + +import C from './C'; +import D from './D'; + +export const a = new A(); +export const b1 = a.b(); +export const b2 = new B(); +export const c1 = new C(); +export const d = new D(); +export const c2 = d.c();