|
|
@ -41,6 +41,7 @@ describe( 'generate', () => {
|
|
|
|
showCompiledCode = config.show;
|
|
|
|
showCompiledCode = config.show;
|
|
|
|
compileOptions = config.compileOptions || {};
|
|
|
|
compileOptions = config.compileOptions || {};
|
|
|
|
compileOptions.shared = shared;
|
|
|
|
compileOptions.shared = shared;
|
|
|
|
|
|
|
|
compileOptions.dev = config.dev;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const source = fs.readFileSync( `test/generator/${dir}/main.html`, 'utf-8' );
|
|
|
|
const source = fs.readFileSync( `test/generator/${dir}/main.html`, 'utf-8' );
|
|
|
@ -79,6 +80,8 @@ describe( 'generate', () => {
|
|
|
|
throw err;
|
|
|
|
throw err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let unintendedError = null;
|
|
|
|
|
|
|
|
|
|
|
|
return env()
|
|
|
|
return env()
|
|
|
|
.then( window => {
|
|
|
|
.then( window => {
|
|
|
|
// Put the constructor on window for testing
|
|
|
|
// Put the constructor on window for testing
|
|
|
@ -91,6 +94,11 @@ describe( 'generate', () => {
|
|
|
|
data: config.data
|
|
|
|
data: config.data
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( config.error ) {
|
|
|
|
|
|
|
|
unintendedError = true;
|
|
|
|
|
|
|
|
throw new Error( 'Expected a runtime error' );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( config.html ) {
|
|
|
|
if ( config.html ) {
|
|
|
|
assert.htmlEqual( target.innerHTML, config.html );
|
|
|
|
assert.htmlEqual( target.innerHTML, config.html );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -103,8 +111,14 @@ describe( 'generate', () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch( err => {
|
|
|
|
.catch( err => {
|
|
|
|
if ( !config.show ) console.log( addLineNumbers( code ) ); // eslint-disable-line no-console
|
|
|
|
if ( config.error && !unintendedError ) {
|
|
|
|
throw err;
|
|
|
|
config.error( assert, err );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
if ( !config.show ) console.log( addLineNumbers( code ) ); // eslint-disable-line no-console
|
|
|
|
|
|
|
|
throw err;
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|