UNPKG

tea-time

Version:
1,756 lines (1,273 loc) 1.35 MB
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.createTeaTime = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ (function (process,global){(function (){ /* Tea Time! Copyright (c) 2015 - 2021 Cédric Ronvel The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ "use strict" ; // Browser is not supported ATM, because of the require.extensions['.js'] trick if ( process.browser ) { return ; } const falafel = require( '@cronvel/falafel' ) ; const fs = require( 'fs' ) ; //const escape = require( 'string-kit/lib/escape.js' ) ; function Cover( options ) { Object.defineProperties( this , { directoryWhiteList: { value: null , writable: true , enumerable: true } , pathBlackList: { value: null , writable: true , enumerable: true } , ecmaVersion: { value: 9 , writable: true , enumerable: true } , currentFile: { value: null , writable: true , enumerable: true } , tracking: { value: {} , writable: true , enumerable: true } , trackingArea: { value: [] , writable: true , enumerable: true } , isTracking: { value: false , writable: true , enumerable: true } , package: { value: null , writable: true , enumerable: true } , warningComments: { value: {} , writable: true , enumerable: true } , warningCommentCount: { value: 0 , writable: true , enumerable: true } } ) ; // Tmp: var rootDir = process.cwd() ; // Require the package.json (mandatory) try { this.package = require( rootDir + '/package.json' ) ; } catch ( error ) { if ( error.code === 'MODULE_NOT_FOUND' ) { throw new Error( "[Cover] No package.json found" ) ; } else { throw new Error( "[Cover] Error in the package.json: " + error ) ; } } if ( this.package.config && this.package.config['tea-time'] ) { if ( Array.isArray( this.package.config['tea-time'].coverDir ) ) { this.directoryWhiteList = this.package.config['tea-time'].coverDir.map( ( whiteDirPath ) => { return rootDir + '/' + whiteDirPath + '/' ; } ) ; } if ( Array.isArray( this.package.config['tea-time'].coverIgnore ) ) { this.pathBlackList = this.package.config['tea-time'].coverIgnore.map( ( blackPath ) => { return rootDir + '/' + blackPath ; } ) ; } } require.extensions['.js'] = this.requireJs.bind( this ) ; global[ coverVarName ] = this ; } //Cover.prototype = Object.create( NGEvents.prototype ) ; //Cover.prototype.constructor = Cover ; module.exports = Cover ; // Backward compatibility Cover.create = ( ... args ) => new Cover( ... args ) ; var nodeRequireJs = require.extensions['.js'] ; var nodeToTrack = [ "ExpressionStatement" , "BreakStatement" , "ContinueStatement" , "VariableDeclaration" , "ReturnStatement" , "ThrowStatement" , "TryStatement" , "FunctionDeclaration" , "IfStatement" , "WhileStatement" , "DoWhileStatement" , "ForStatement" , "ForInStatement" , "ForOfStatement" , "SwitchStatement" , "WithStatement" ] ; var nodeNeedingBraces = [ "IfStatement" , "WhileStatement" , "DoWhileStatement" , "ForStatement" , "ForInStatement" , "ForOfStatement" , "WithStatement" ] ; var coverVarName = '__TEA_TIME_COVER__' ; // This is the replacement for JS extension require Cover.prototype.requireJs = function requireJs( localModule , filePath ) { var isTrackingBkup = this.isTracking ; if ( ( ! this.directoryWhiteList || ! this.directoryWhiteList.length ) && ( ! this.pathBlackList || ! this.pathBlackList.length ) ) { return nodeRequireJs( localModule , filePath ) ; } if ( this.directoryWhiteList && this.directoryWhiteList.length ) { if ( ! this.directoryWhiteList.some( ( whiteDirPath ) => filePath.indexOf( whiteDirPath ) === 0 ) ) { //console.log( ">>>>>>>>>>>> Normal requireJs (not white-listed)" , filePath ) ; return nodeRequireJs( localModule , filePath ) ; } } if ( this.pathBlackList && this.pathBlackList.length ) { if ( this.pathBlackList.some( ( blackPath ) => filePath === blackPath ) ) { //console.log( ">>>>>>>>>>>> Normal requireJs (black-listed)" , filePath ) ; return nodeRequireJs( localModule , filePath ) ; } } //console.log( ">>>>>>>>>>>> Hi-jacked requireJs" , filePath ) ; // This is the original require.extensions['.js'] function, as of node v6: /* var content = fs.readFileSync( filePath , 'utf8' ) ; module._compile( internalModule.stripBOM( content ) , filePath ) ; */ var content = fs.readFileSync( filePath , 'utf8' ) ; var instrumentedContent = this.instrument( content , filePath ) ; //console.log( "Instrumented content:\n" + instrumentedContent + "\n\n\n" ) ; // Force the tracking activation during module loading: // tests cannot re-trigger global/top-level module exec, // if not, it would always report low coverage this.isTracking = true ; localModule._compile( instrumentedContent , filePath ) ; this.isTracking = isTrackingBkup ; } ; // instrument the file synchronously // `next` is optional callback which will be called // with instrumented code when present Cover.prototype.instrument = function instrument( content , filePath /*, config , next */ ) { this.tracking[ filePath ] = { area: [] , //charCount: content.length , sourceLines: content.split( '\n' ) } ; this.currentFile = filePath ; // Remove shebang: not needed anymore since allowHashBang option exists in acorn //content = content.replace( /^\#\!.*/ , '' ) ; var instrumented = falafel( content , { locations: true , comment: true , ecmaVersion: this.ecmaVersion , allowHashBang: true , //sourceType: 'module' , allowReturnOutsideFunction: true , // important or conditional tracking may fail with code like: // if ( var1 && ( var2 = expression ) ) preserveParens: true , onComment: this.onComment.bind( this ) } , this.injectTrackingCode.bind( this , filePath ) ) ; this.currentFile = null ; return instrumented ; } ; Cover.prototype.start = function start() { this.isTracking = true ; } ; Cover.prototype.stop = function stop() { this.isTracking = false ; } ; // Get warning comment, starting with Cover.prototype.onComment = function onComment( blockComment , content , startOffset , endOffset , start , end ) { var match = content.match( /^(\s*\/!\\\s*)+(.+?)(\s*\/!\\\s*)*$/m ) ; if ( ! match ) { return ; } if ( ! this.warningComments[ this.currentFile ] ) { this.warningComments[ this.currentFile ] = [] ; } this.warningComments[ this.currentFile ].push( { comment: match[ 2 ] , line: start.line } ) ; this.warningCommentCount ++ ; } ; Cover.prototype.track = function track( index ) { if ( ! this.isTracking ) { return ; } this.trackingArea[ index ].count ++ ; //console.log( "Tracked:" , filePath , this.tracking[ filePath ].area[ index ].location.start.line ) ; } ; Cover.prototype.initTracking = function initTracking( filePath , node ) { var index = this.trackingArea.length ; // Falafel/Acorn start lines and columns at 1, not 0, and that's troublesome. // Fix that now! this.trackingArea[ index ] = { count: 0 , location: { start: { line: node.loc.start.line - 1 , column: node.loc.start.column - 1 } , end: { line: node.loc.end.line - 1 , column: node.loc.end.column - 1 } } } ; this.tracking[ filePath ].area[ this.tracking[ filePath ].area.length ] = this.trackingArea[ index ] ; return index ; } ; Cover.prototype.injectTrackingCode = function injectTrackingCode( filePath , node ) { //console.log( "node type ["+filePath+"]:" , node.type ) ; // This is from the Blanket source code, but does it really happen? if ( ! node.loc || ! node.loc.start || ! node.loc.end ) { throw new Error( "Node without location" ) ; } this.injectBraces( node ) ; //this.injectBlockTrackingCode( filePath , node ) ; this.injectStatementTrackingCode( filePath , node ) ; this.injectConditionTrackingCode( filePath , node ) ; } ; Cover.prototype.injectBraces = function injectBraces( node ) { var index ; if ( nodeNeedingBraces.indexOf( node.type ) !== -1 ) { if ( node.consequent && node.consequent.type !== "BlockStatement" ) { // The 'then' statement node.consequent.update( "{\n" + node.consequent.source() + "}\n" ) ; } else if ( node.body && node.body.type !== "BlockStatement" ) { // Dunno what node.body is supposed to be... node.body.update( "{\n" + node.body.source() + "}\n" ) ; } //if ( node.alternate && node.alternate.type !== "BlockStatement" && node.alternate.type !== "IfStatement" ) if ( node.alternate && node.alternate.type !== "BlockStatement" ) { // The 'else/else if' node node.alternate.update( "{\n" + node.alternate.source() + "}\n" ) ; } } return false ; } ; Cover.prototype.injectStatementTrackingCode = function injectStatementTrackingCode( filePath , node ) { var index ; if ( nodeToTrack.indexOf( node.type ) !== -1 && node.parent.type !== 'LabeledStatement' ) { if ( // Do not track variable declaration inside for and for in ( node.type === "VariableDeclaration" && ( node.parent.type === "ForStatement" || node.parent.type === "ForInStatement" || node.parent.type === "ForOfStatement" ) ) || // Do not track "use strict" ( node.type === "ExpressionStatement" && node.parent.type === "Program" && node.expression.type === "Literal" && node.expression.value === "use strict" ) ) { return false ; } index = this.initTracking( filePath , node ) ; node.update( //'/*' + node.type + '*/' + coverVarName + ".track( " + index + " ) ; " + node.source() ) ; return true ; } return false ; } ; Cover.prototype.injectConditionTrackingCode = function injectConditionTrackingCode( filePath , node ) { var index ; if ( node.type === 'LogicalExpression' && ( node.operator === '&&' || node.operator === '||' ) ) { //console.log( "#######" , node ) ; if ( node.left.type !== 'LogicalExpression' ) { index = this.initTracking( filePath , node.left ) ; node.left.update( //'/*' + node.type + '/' + node.left.type + '*/' + '(' + coverVarName + ".track( " + index + " ) || " + node.left.source() + ')' ) ; } if ( node.right.type !== 'LogicalExpression' ) { index = this.initTracking( filePath , node.right ) ; node.right.update( //'/*' + node.type + '/' + node.right.type + '*/' + '(' + coverVarName + ".track( " + index + " ) || " + node.right.source() + ')' ) ; } return true ; } return false ; } ; Cover.prototype.injectBlockTrackingCode = function injectBlockTrackingCode( filePath , node ) { var index ; if ( node.type === "Program" ) { index = this.initTracking( filePath , node ) ; node.update( //'/*' + node.type + '*/' + coverVarName + ".track( " + index + " ) ; " + node.source() ) ; return true ; } else if ( node.type === "BlockStatement" ) { index = this.initTracking( filePath , node ) ; node.update( '{' + //'/*' + node.type + '*/' + coverVarName + ".track( " + index + " ) ; " + node.source().slice( 1 ) ) ; return true ; } return false ; } ; Cover.prototype.getCoverage = function getCoverage() { var filePath , i , iMax , j , oneData , col , max ; var coverage = { uncoveredFiles: {} , lineCount: 0 , uncoveredLineCount: 0 , areaCount: 0 , uncoveredAreaCount: 0 , warningCommentCount: this.warningCommentCount , warningComments: this.warningComments } ; for ( filePath in this.tracking ) { //charCount += this.tracking[ filePath ].charCount ; coverage.lineCount += this.tracking[ filePath ].sourceLines.length ; coverage.areaCount += this.tracking[ filePath ].area.length ; for ( i = 0 , iMax = this.tracking[ filePath ].area.length ; i < iMax ; i ++ ) { oneData = this.tracking[ filePath ].area[ i ] ; if ( ! oneData.count ) { if ( ! coverage.uncoveredFiles[ filePath ] ) { coverage.uncoveredFiles[ filePath ] = { source: this.tracking[ filePath ].sourceLines , lines: [] , areaCount: this.tracking[ filePath ].area.length , uncoveredAreaCount: 0 } ; } coverage.uncoveredAreaCount ++ ; coverage.uncoveredFiles[ filePath ].uncoveredAreaCount ++ ; //* if ( oneData.location.start.line === oneData.location.end.line ) { // Flags the line as partially uncovered col = coverage.uncoveredFiles[ filePath ].lines[ oneData.location.start.line ] = [] ; for ( j = oneData.location.start.column ; j <= oneData.location.end.column ; j ++ ) { col[ j ] = true ; } } else { // Flags the starting line as partially uncovered col = coverage.uncoveredFiles[ filePath ].lines[ oneData.location.start.line ] = [] ; max = this.tracking[ filePath ].sourceLines[ oneData.location.start.line ].length ; for ( j = oneData.location.start.column ; j < max ; j ++ ) { col[ j ] = true ; } // Flags the ending line as partially uncovered col = coverage.uncoveredFiles[ filePath ].lines[ oneData.location.end.line ] = [] ; for ( j = 0 ; j <= oneData.location.end.column ; j ++ ) { col[ j ] = true ; } } for ( j = oneData.location.start.line + 1 ; j < oneData.location.end.line ; j ++ ) { // Flags the whole middle lines as uncovered coverage.uncoveredFiles[ filePath ].lines[ j ] = true ; } //*/ /* console.log( "\n\n>>> Not covered:" , filePath , i , oneData , "\nline:" , oneData.location.start.line , '\n' + escape.control( this.tracking[ filePath ].sourceLines[ oneData.location.start.line - 1 ] ) , '\n' + escape.control( this.tracking[ filePath ].sourceLines[ oneData.location.start.line ] ) , '\n' + escape.control( this.tracking[ filePath ].sourceLines[ oneData.location.start.line + 1 ] ) ) ; */ } } if ( coverage.uncoveredFiles[ filePath ] ) { coverage.uncoveredFiles[ filePath ].rate = 1 - coverage.uncoveredFiles[ filePath ].uncoveredAreaCount / coverage.uncoveredFiles[ filePath ].areaCount ; coverage.uncoveredLineCount += coverage.uncoveredFiles[ filePath ].lines.reduce( ( accu , element ) => { return accu + ( element ? 1 : 0 ) ; } , 0 ) ; } } // The first is more accurate, the last count comments, blank lines, etc... coverage.rate = 1 - coverage.uncoveredAreaCount / coverage.areaCount ; //coverage.rate = 1 - coverage.uncoveredLineCount / coverage.lineCount ; return coverage ; } ; }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"@cronvel/falafel":9,"_process":87,"fs":35}],2:[function(require,module,exports){ (function (global){(function (){ /* Tea Time! Copyright (c) 2015 - 2021 Cédric Ronvel The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ "use strict" ; // It should load before anything else, // so nothing can get a timer function without it being patched const NGEvents = require( 'nextgen-events' ) ; const asyncTryCatch = require( 'async-try-catch' ) ; asyncTryCatch.substitute() ; const asyncTry = asyncTryCatch.try ; const Promise = require( 'seventh' ) ; const Cover = require( './Cover.js' ) ; const Logfella = require( 'logfella' ) ; const log = Logfella.global.use( 'test' ) ; function TeaTime( options ) { this.timeout = options.timeout || 2000 ; this.slowTime = options.slowTime || 75 ; this.suite = TeaTime.createSuite() ; this.grep = Array.isArray( options.grep ) ? options.grep : [] ; this.igrep = Array.isArray( options.igrep ) ? options.igrep : [] ; this.allowConsole = !! options.allowConsole ; this.huntConsole = !! options.huntConsole ; this.bail = !! options.bail ; this.showDiff = options.showDiff !== false ; this.skipOptional = !! options.skipOptional ; this.cover = options.cover && Cover.create( options.cover ) ; this.registeredTestOptions = [] ; this.testOptions = options.testOptions || {} ; this.token = options.token || null ; // for slave instance this.acceptTokens = options.acceptTokens || null ; // for master instance this.startTime = 0 ; this.testCount = 0 ; this.done = 0 ; this.ok = 0 ; this.fail = 0 ; this.optionalFail = 0 ; this.skip = 0 ; this.assertionOk = 0 ; this.assertionFail = 0 ; this.errors = [] ; this.orphanError = null ; this.onceUncaughtException = options.onceUncaughtException ; this.offUncaughtException = options.offUncaughtException ; this.registerStack = [ this.suite ] ; this.cliManager = options.cliManager || null ; } TeaTime.prototype = Object.create( NGEvents.prototype ) ; TeaTime.prototype.constructor = TeaTime ; module.exports = TeaTime ; // Backward compatibility TeaTime.create = ( ... args ) => new TeaTime( ... args ) ; TeaTime.reporterAliases = { "oneline": "one-line" , "one": "one-line" , "error": "error-report" , "err": "error-report" , "coverage": "coverage-report" , "cov": "coverage-report" , "cov-sum": "coverage-summary" , "wcom": "warning-comments-report" , "wcom-sum": "warning-comments-summary" , "pan": "panel" , "bar": "progress" , "vocal": "voice" } ; // CLI and browser share the same args TeaTime.populateOptionsWithArgs = function( options , args ) { var i , iMax , v ; options.cover = args.cover ; options.showDiff = args.diff !== false ; if ( ! options.reporters ) { if ( options.cover ) { options.reporters = [ 'classic' , 'coverage-report' , 'warning-comments-summary' ] ; } else { options.reporters = [ 'classic' ] ; } } if ( ! options.clientReporters ) { options.clientReporters = [ 'classic' ] ; } if ( args.huntConsole !== undefined ) { options.huntConsole = args.huntConsole ; } else if ( args.console !== undefined ) { options.allowConsole = args.console ; } if ( args.bail ) { options.bail = true ; } if ( args.skipOptional ) { options.skipOptional = true ; } if ( args.timeout && ( v = parseInt( args.timeout , 10 ) ) ) { options.timeout = v ; } if ( args.slow && ( v = parseInt( args.slow , 10 ) ) ) { options.slowTime = v ; } if ( args.opt ) { options.testOptions = args.opt ; } if ( args.reporter ) { options.reporters = args.reporter ; } if ( args.addReporter ) { options.reporters.push( ... args.addReporter ) ; } // Manage reporter aliases options.reporters = options.reporters.map( ( r ) => { return TeaTime.reporterAliases[ r ] || r ; } ) ; if ( args.clientReporter ) { options.clientReporters = args.clientReporter ; } // Turn string into regexp for the "grep" feature options.grep = [] ; options.sourceGrep = [] ; if ( ! args.grep ) { args.grep = [] ; } for ( i = 0 , iMax = args.grep.length ; i < iMax ; i ++ ) { options.grep.push( new RegExp( args.grep[ i ] , 'i' ) ) ; options.sourceGrep.push( args.grep[ i ] ) ; } // Turn string into regexp for the "igrep" feature options.igrep = [] ; options.sourceIGrep = [] ; if ( ! args.igrep ) { args.igrep = [] ; } for ( i = 0 , iMax = args.igrep.length ; i < iMax ; i ++ ) { options.igrep.push( new RegExp( args.igrep[ i ] , 'i' ) ) ; options.sourceIGrep.push( args.igrep[ i ] ) ; } if ( args.token ) { options.token = args.token ; } } ; TeaTime.prototype.init = function() { // Register to global global.asyncTry = asyncTry ; global.suite = global.describe = global.context = TeaTime.registerSuite.bind( this ) ; global.test = global.it = global.specify = TeaTime.registerTest.bind( this ) ; global.test.skip = TeaTime.registerSkipTest.bind( this ) ; global.test.optional = TeaTime.registerOptionalTest.bind( this ) ; global.test.opt = TeaTime.registerOptionalTest.bind( this ) ; global.test.next = TeaTime.registerOptionalTest.bind( this ) ; global.setup = global.beforeEach = TeaTime.registerHook.bind( this , 'setup' ) ; global.teardown = global.afterEach = TeaTime.registerHook.bind( this , 'teardown' ) ; global.suiteSetup = global.before = TeaTime.registerHook.bind( this , 'suiteSetup' ) ; global.suiteTeardown = global.after = TeaTime.registerHook.bind( this , 'suiteTeardown' ) ; // Built-in assertion lib, provided by Doormen.expect global.expect = require( 'doormen/lib/expect.js' ).factory( { ok: () => this.assertionOkHook() , fail: () => this.assertionFailHook() } ) ; global.testOption = TeaTime.registerTestOption.bind( this ) ; global.getTestOption = key => this.testOptions[ key ] ; global.log = ( ... args ) => log.hdebug( ... args ) ; if ( this.huntConsole ) { TeaTime.huntConsole() ; } else if ( ! this.allowConsole ) { TeaTime.disableConsole() ; } } ; TeaTime.registerTestOption = function( ... testOptions ) { this.registeredTestOptions.push( ... testOptions ) ; } ; TeaTime.disableConsole = function() { Object.keys( console ).forEach( key => { if ( typeof console[ key ] === 'function' ) { console[ key ] = function() {} ; } } ) ; } ; TeaTime.huntConsole = function() { Object.keys( console ).forEach( key => { if ( typeof console[ key ] === 'function' ) { console[ key ] = () => { throw new ConsoleError( key ) ; } ; } } ) ; } ; // Custom ConsoleError function ConsoleError( from ) { this.message = "The console." + from + "() function was used!" ; from = console[ from ] ; if ( Error.captureStackTrace ) { Error.captureStackTrace( this , from ) ; } else { Object.defineProperty( this , 'stack' , { value: Error().stack , enumerable: true , configurable: true } ) ; } } ConsoleError.prototype = Object.create( Error.prototype ) ; ConsoleError.prototype.constructor = ConsoleError ; ConsoleError.prototype.name = 'ConsoleError' ; TeaTime.createSuite = function( title ) { var suite = [] ; suite.title = title ; suite.parent = null ; suite.suiteSetup = [] ; suite.suiteTeardown = [] ; suite.setup = [] ; suite.teardown = [] ; suite.order = 0 ; return suite ; } ; TeaTime.sortSuite = function( suite ) { suite.sort( ( a , b ) => { var va = Array.isArray( a ) ? 1 : 0 ; var vb = Array.isArray( b ) ? 1 : 0 ; if ( va - vb ) { return va - vb ; } return a.order - b.order ; } ) ; } ; TeaTime.prototype.run = async function() { var duration , coverage ; TeaTime.sortSuite( this.suite ) ; // Wait for everything to be ready await this.waitForEmit( 'ready' ) ; this.emit( 'start' , this.testCount ) ; // Start coverage tracking NOW! if ( this.cover ) { this.cover.start() ; } this.startTime = Date.now() ; try { await this.runSuite( this.suite , 0 ) ; } catch ( dontCare ) {} duration = Date.now() - this.startTime ; if ( this.cover ) { coverage = this.cover.getCoverage() ; } this.emit( 'report' , { ok: this.ok , fail: this.fail , optionalFail: this.optionalFail , skip: this.skip , assertionOk: this.assertionOk , assertionFail: this.assertionFail , coverageRate: coverage && coverage.rate , duration: duration } ) ; if ( this.fail + this.optionalFail ) { this.emit( 'errorReport' , this.errors ) ; } if ( this.cover ) { this.emit( 'coverageReport' , coverage ) ; } this.emit( 'end' ) ; return Promise.timeLimit( 10000 , this.waitForEmit( 'exit' ) ) ; } ; TeaTime.prototype.runSuite = async function( suite , depth ) { if ( depth ) { this.emit( 'enterSuite' , { title: suite.title , depth: depth - 1 } ) ; } // Run setup hooks try { await this.runHooks( suite.suiteSetup , depth ) ; } catch ( suiteSetupError ) { this.patchError( suiteSetupError ) ; this.errors.push( { title: suiteSetupError.hookFn.title + '[' + suiteSetupError.hookFn.hookType + ']' , type: suiteSetupError.hookFn.hookType , fn: suiteSetupError.hookFn , error: suiteSetupError } ) ; this.failSuite( suite , depth , 'suiteSetup' , suiteSetupError.hookFn , suiteSetupError ) ; // Run teardown anyway? try { await this.runHooks( suite.suiteTeardown , depth ) ; } catch ( suiteTeardownError ) {} if ( depth ) { this.emit( 'exitSuite' , { title: suite.title , depth: depth - 1 } ) ; } throw suiteSetupError ; } // Run tests try { await this.runSuiteTests( suite , depth ) ; } catch ( suiteTestsError ) { // Run teardown try { await this.runHooks( suite.suiteTeardown , depth ) ; } catch ( suiteTeardownError ) {} if ( depth ) { this.emit( 'exitSuite' , { title: suite.title , depth: depth - 1 } ) ; } throw suiteTestsError ; } // Run teardown try { await this.runHooks( suite.suiteTeardown , depth ) ; } catch ( suiteTeardownError ) { this.patchError( suiteTeardownError ) ; this.errors.push( { title: suiteTeardownError.hookFn.title + '[' + suiteTeardownError.hookFn.hookType + ']' , type: suiteTeardownError.hookFn.hookType , fn: suiteTeardownError.hookFn , error: suiteTeardownError } ) ; if ( depth ) { this.emit( 'exitSuite' , { title: suite.title , depth: depth - 1 } ) ; } throw suiteTeardownError ; } } ; TeaTime.prototype.runSuiteTests = async function( suite , depth ) { return Promise.forEach( suite , async ( item ) => { try { if ( Array.isArray( item ) ) { await this.runSuite( item , depth + 1 ) ; } else { await this.runTest( suite , depth , item ) ; } } catch ( error ) { if ( this.bail ) { throw error ; } } } ) ; } ; TeaTime.prototype.failSuite = function( suite , depth , errorType , errorFn , error ) { var i , iMax , testFn , data ; for ( i = 0 , iMax = suite.length ; i < iMax ; i ++ ) { if ( Array.isArray( suite[ i ] ) ) { this.failSuite( suite[ i ] , depth + 1 , errorType , errorFn , error ) ; } this.done ++ ; this.fail ++ ; testFn = suite[ i ] ; data = { title: testFn.title , type: testFn.name , optional: testFn.optional , depth: depth , fn: testFn , errorType: errorType , error: error , errorFn: errorFn } ; this.emit( 'fail' , data ) ; } } ; TeaTime.prototype.runTest = async function( suite , depth , testFn ) { // /!\ Useful? this.testInProgress = testFn ; var data = { title: testFn.title , type: testFn.name , optional: testFn.optional , depth: depth , fn: testFn , duration: null , slow: null , error: null , errorType: null , errorFn: null } ; // Early exit, if the functions should be skipped if ( typeof testFn !== 'function' ) { this.done ++ ; this.skip ++ ; this.emit( 'skip' , data ) ; return ; } // Inherit parent's setup/teardown var ancestor = suite , setup = suite.setup , teardown = suite.teardown ; while ( ancestor.parent ) { ancestor = ancestor.parent ; setup = ancestor.setup.concat( setup ) ; teardown = ancestor.teardown.concat( teardown ) ; } // Finishing var testFailed = error => { this.done ++ ; this.patchError( error ) ; this.errors.push( { title: ( error.hookFn ? error.hookFn.title + '[' + error.hookFn.hookType + '] ' : '' ) + data.title , type: data.errorType , fn: testFn , optional: data.optional , error: error } ) ; if ( data.optional ) { this.optionalFail ++ ; this.emit( 'optionalFail' , data ) ; } else { this.fail ++ ; this.emit( 'fail' , data ) ; } if ( this.bail ) { throw error ; } } ; var testOk = () => { this.done ++ ; this.ok ++ ; this.emit( 'ok' , data ) ; } ; try { await this.runHooks( setup , depth ) ; } catch ( setupError ) { data.errorType = 'setup' ; data.error = setupError ; data.errorFn = setupError.hookFn ; // Run teardown anyway? try { await this.runHooks( teardown , depth ) ; } catch ( teardownError ) {} testFailed( setupError ) ; return ; } this.orphanError = null ; this.emit( 'enterTest' , data ) ; try { Object.assign( data , await this.runTestFn( testFn ) ) ; } catch ( testError ) { Object.assign( data , testError.data ) ; data.error = testError ; data.errorType = 'test' ; data.errorFn = testFn ; this.emit( 'exitTest' , data ) ; // Run teardown try { await this.runHooks( teardown , depth ) ; } catch ( teardownError ) {} testFailed( testError ) ; return ; } this.emit( 'exitTest' , data ) ; // Run teardown try { await this.runHooks( teardown , depth ) ; } catch ( teardownError ) { data.errorType = 'teardown' ; data.error = teardownError ; data.errorFn = teardownError.hookFn ; testFailed( teardownError ) ; return ; } testOk() ; } ; TeaTime.prototype.runTestFn = function( testFn_ ) { var startTime , finishTriggered = false , timer = null , testFn , slowTime = this.slowTime ; var promise = new Promise() ; var context = { timeout: timeout => { if ( finishTriggered ) { return ; } if ( timer !== null ) { clearTimeout( timer ) ; timer = null ; } timer = setTimeout( () => { if ( this.orphanError ) { finish( this.orphanError ) ; return ; } var timeoutError = new Error( 'Test timeout (local)' ) ; timeoutError.testTimeout = true ; finish( timeoutError ) ; } , timeout ) ; } , slow: slowTime_ => { slowTime = slowTime_ ; } } ; if ( testFn_.length ) { testFn = () => { return new Promise( ( resolve , reject ) => { var returnValue = testFn_.call( context , error => { return error ? reject( error ) : resolve() ; } ) ; if ( Promise.isThenable( returnValue ) ) { reject( new Error( "Bad test: mixing the Promise/thenable and the callback interface" ) ) ; } } ) ; } ; } else { testFn = testFn_ ; } var finish = error => { // Immediately, before checking if already called: var duration = Date.now() - startTime ; this.offUncaughtException( uncaughtExceptionHandler ) ; if ( finishTriggered ) { return ; } finishTriggered = true ; // Stop coverage tracking if ( this.cover ) { this.cover.stop() ; } if ( timer !== null ) { clearTimeout( timer ) ; timer = null ; } var data = { duration , slow: Math.floor( duration / slowTime ) } ; if ( error ) { error.data = data ; promise.reject( error ) ; } else { promise.resolve( data ) ; } } ; var uncaughtExceptionHandler = error => { error.uncaught = true ; finish( error ) ; } ; // Should come before running the test, or it would override the user-set timeout timer = setTimeout( () => { if ( this.orphanError ) { finish( this.orphanError ) ; return ; } var timeoutError = new Error( 'Test timeout' ) ; timeoutError.testTimeout = true ; finish( timeoutError ) ; } , this.timeout ) ; this.onceUncaughtException( uncaughtExceptionHandler ) ; asyncTry( () => { // Start coverage tracking NOW! if ( this.cover ) { this.cover.start() ; } startTime = Date.now() ; var returnValue = testFn.call( context ) ; if ( Promise.isThenable( returnValue ) ) { Promise.resolve( returnValue ).callback( finish ) ; return ; } finish() ; } ) .catch( ( error ) => { if ( finishTriggered ) { this.orphanError = error ; } finish( error ) ; } ) ; return promise ; } ; TeaTime.prototype.runHooks = function( hookList , depth ) { return Promise.forEach( hookList , hookFn => { var data = { hookType: hookFn.hookType , title: hookFn.title , depth: depth , fn: hookFn } ; this.emit( 'enterHook' , data ) ; return this.runHookFn( hookFn ).then( () => { this.emit( 'exitHook' , data ) ; } , error => { error.hookFn = hookFn ; this.emit( 'exitHook' , data ) ; throw error ; } ) ; } ) ; } ; TeaTime.prototype.runHookFn = function( hookFn_ ) { var hookFn , finishTriggered = false ; var promise = new Promise() ; if ( hookFn_.length ) { hookFn = () => { return new Promise( ( resolve , reject ) => { var returnValue = hookFn_( error => { return error ? reject( error ) : resolve() ; } ) ; if ( Promise.isThenable( returnValue ) ) { reject( new Error( "Bad test: mixing the Promise/thenable and the callback interface" ) ) ; } } ) ; } ; } else { hookFn = hookFn_ ; } var finish = error => { // Immediately, before checking if already called: this.offUncaughtException( uncaughtExceptionHandler ) ; if ( finishTriggered ) { return ; } finishTriggered = true ; if ( error ) { promise.reject( error ) ; } else { promise.resolve() ; } } ; var uncaughtExceptionHandler = error => { error.uncaught = true ; finish( error ) ; } ; this.onceUncaughtException( uncaughtExceptionHandler ) ; asyncTry( () => { var returnValue = hookFn() ; if ( Promise.isThenable( returnValue ) ) { Promise.resolve( returnValue ).callback( finish ) ; return ; } finish() ; } ) .catch( ( error ) => { if ( finishTriggered ) { this.orphanError = error ; } finish( error ) ; } ) ; return promise ; } ; TeaTime.prototype.assertionOkHook = function() { this.assertionOk ++ ; this.emit( 'assertionOk' ) ; } ; TeaTime.prototype.assertionFailHook = function() { this.assertionFail ++ ; this.emit( 'assertionFail' ) ; } ; /* User-land global functions */ // suite(), describe(), context() TeaTime.registerSuite = function( title , fn ) { if ( ! title || typeof title !== 'string' || typeof fn !== 'function' ) { throw new Error( "Usage is suite( title , fn )" ) ; } var parentSuite = this.registerStack[ this.registerStack.length - 1 ] ; var suite = TeaTime.createSuite( title ) ; this.registerStack.push( suite ) ; fn() ; this.registerStack.pop() ; // Only add this suite to its parent if it is not empty if ( ! suite.length ) { return ; } suite.order = parentSuite.length ; suite.parent = parentSuite ; TeaTime.sortSuite( suite ) ; parentSuite.push( suite ) ; } ; // test(), it(), specify() TeaTime.registerTest = function( title , fn , optional ) { var i , iMax , j , jMax , found , parentSuite ; if ( ! title || typeof title !== 'string' ) { throw new Error( "Usage is test( title , [fn] , [optional] )" ) ; } parentSuite = this.registerStack[ this.registerStack.length - 1 ] ; // Filter out tests that are not relevant, // each grep should either match the test title or anyone of the ancestor parent suite. for ( i = 0 , iMax = this.grep.length ; i < iMax ; i ++ ) { found = false ; if ( title.match( this.grep[ i ] ) ) { continue ; } for ( j = 1 , jMax = this.registerStack.length ; j < jMax ; j ++ ) { if ( this.registerStack[ j ].title.match( this.grep[ i ] ) ) { found = true ; break ; } } if ( ! found ) { return ; } } // Filter out tests that are not relevant, // each igrep should not match the test title or anyone of the ancestor parent suite. for ( i = 0 , iMax = this.igrep.length ; i < iMax ; i ++ ) { if ( title.match( this.igrep[ i ] ) ) { return ; } for ( j = 1 , jMax = this.registerStack.length ; j < jMax ; j ++ ) { if ( this.registerStack[ j ].title.match( this.igrep[ i ] ) ) { return ; } } } this.testCount ++ ; if ( typeof fn !== 'function' ) { fn = {} ; } fn.title = title ; fn.optional = !! optional ; fn.order = parentSuite.length ; parentSuite.push( fn ) ; } ; // test.skip(), it.skip(), specify.skip() TeaTime.registerSkipTest = function( title /*, fn */ ) { return TeaTime.registerTest.call( this , title ) ; } ; // test.next(), it.next(), specify.next() TeaTime.registerOptionalTest = function( title , fn ) { return this.skipOptional ? TeaTime.registerTest.call( this , title ) : TeaTime.registerTest.call( this , title , fn , true ) ; } ; // setup(), suiteSetup(), teardown(), suiteTeardown(), before(), beforeEach(), after(), afterEach() TeaTime.registerHook = function( type , title , fn ) { var parentSuite ; if ( typeof title === 'function' ) { fn = title ; title = undefined ; } else if ( typeof fn !== 'function' ) { throw new Error( "Usage is hook( [title] , fn )" ) ; } fn.title = title || fn.name || '[no name]' ; fn.hookType = type ; parentSuite = this.registerStack[ this.registerStack.length - 1 ] ; parentSuite[ type ].push( fn ) ; } ; /* Misc functions */ // Remove the framework from the stack trace TeaTime.prototype.patchError = function( error ) { var i , iMax , stack ; if ( ! error.stack ) { return ; } stack = error.stack ; if ( ! Array.isArray( stack ) ) { stack = error.stack.split( '\n' ) ; } for ( i = 0 , iMax = stack.length ; i < iMax ; i ++ ) { // This is a bit hacky, but well... if ( stack[ i ].match( /(^|\/)tea-time\.(min\.)?js/ ) ) { stack = stack.slice( 0 , i ) ; break ; } } error.stack = stack.join( '\n' ) ; } ; }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./Cover.js":1,"async-try-catch":31,"doormen/lib/expect.js":48,"logfella":75,"nextgen-events":78,"seventh":100}],3:[function(require,module,exports){ /* Tea Time! Copyright (c) 2015 - 2021 Cédric Ronvel The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ "use strict" ; //const Report = require( './report.js' ) ; //const ErrorReport = require( './error-report.js' ) ; const dotPath = require( 'tree-kit/lib/dotPath.js' ) ; function Reporter( teaTime , self ) { if ( ! self ) { self = Object.create( Reporter.prototype , { teaTime: { value: teaTime , enumerable: true } } ) ; } document.querySelector( 'body' ) .insertAdjacentHTML( 'beforeend' , '<div class="tea-time-classic-reporter" style="background-color:black;color:white"></div>' ) ; self.container = document.querySelector( 'div.tea-time-classic-reporter' ) ; self.teaTime.on( 'enterSuite' , Reporter.enterSuite.bind( self ) ) ; self.teaTime.on( 'ok' , Reporter.ok.bind( self ) ) ; self.teaTime.on( 'fail' , Reporter.fail.bind( self ) ) ; self.teaTime.on( 'optionalFail' , Reporter.optionalFail.bind( self ) ) ; self.teaTime.on( 'skip' , Reporter.skip.bind( self ) ) ; self.teaTime.on( 'report' , Reporter.report.bind( self ) ) ; self.teaTime.on( 'errorReport' , Reporter.errorReport.bind( self ) ) ; return self ; } module.exports = Reporter ; function scrollDown() { ( document.querySelector( 'div.tea-time-classic-reporter p:last-child' ) || document.querySelector( 'div.tea-time-classic-reporter h4:last-child' ) || document.querySelector( 'div.tea-time-classic-reporter pre:last-child' ) ) .scrollIntoView() ; } function indentStyle( depth ) { return 'margin-left:' + ( 1 + 2 * depth ) + '%;' ; } const durationStyle = "color:grey;" ; const passingStyle = "color:green;" ; const failingStyle = "color:red;" ; const optionalFailingStyle = "color:brown;" ; const pendingStyle = "color:blue;" ; const coverageStyle = "color:magenta;" ; const fastStyle = "color:grey;" ; const slowStyle = "color:yellow;" ; const slowerStyle = "color:red;" ; const optionalErrorStyle = "color:brown;font-weight:bold;" ; const errorStyle = "color:red;font-weight:bold;" ; const hookErrorStyle = "background-color:red;color:white;font-weight:bold;" ; const expectationPathStyle = "background-color:grey;color:white;" ; const expectedStyle = "background-color:green;color:white;font-weight:bold;" ; const actualStyle = "background-color:red;color:white;font-weight:bold;" ; Reporter.enterSuite = function enterSuite( data ) { this.container.insertAdjacentHTML( 'beforeend' , '<h4 class="tea-time-classic-reporter" style="' + indentStyle( data.depth ) + '">' + data.title + '</h4>' ) ; scrollDown() ; } ; Reporter.ok = function ok( data ) { var content = '✔ ' + data.title ; if ( ! data.slow ) { content += ' <span style="' + fastStyle + '">(' + data.duration + 'ms)</span>' ; } else if ( data.slow === 1 ) { content += ' <span style="' + slowStyle + '">(' + data.duration + 'ms)</span>' ; } else { content += ' <span style="' + slowerStyle + '">(' + data.duration + 'ms)</span>' ; } this.container.insertAdjacentHTML( 'beforeend' , '<p class="tea-time-classic-reporter" style="' + passingStyle + indentStyle( data.depth ) + '">' + content + '</p>' ) ; scrollDown() ; } ; Reporter.fail = function fail( data ) { var content = '✘ ' + data.title ; if ( data.duration !== undefined ) { if ( ! data.slow ) { content += ' <span style="' + fastStyle + '">(' + data.duration + 'ms)</span>' ; } else if ( data.slow === 1 ) { content += ' <span style="' + slowStyle + '">(' + data.duration + 'ms)</span>' ; } else { content += ' <span style="' + slowerStyle + '">(' + data.duration + 'ms)</span>' ; } } this.container.insertAdjacentHTML( 'beforeend' , '<p class="tea-time-classic-reporter" style="' + failingStyle + indentStyle( data.depth ) + '">' + content + '</p>' ) ; scrollDown() ; } ; Reporter.optionalFail = function optionalFail( data ) { var content = '✘ ' + data.title ; if ( data.duration !== undefined ) { if ( ! data.slow ) { content += ' <span style="' + fastStyle + '">(' + data.duration + 'ms)</span>' ; } else if ( data.slow === 1 ) { content += ' <span style="' + slowStyle + '">(' + data.duration + 'ms)</span>' ; } else { content += ' <span style="' + slowerStyle + '">(' + data.duration + 'ms)</span>' ; } } this.container.insertAdjacentHTML( 'beforeend' , '<p class="tea-time-classic-reporter" style="' + optionalFailingStyle + indentStyle( data.depth ) + '">' + content + '</p>' ) ; scrollDown() ; } ; Reporter.skip = function skip( data ) { var content = '· ' + data.title ; this.container.insertAdjacentHTML( 'beforeend' , '<p class="tea-time-classic-reporter" style="' + pendingStyle + indentStyle( data.depth ) + '">' + content + '</p>' ) ; scrollDown() ; } ; Reporter.report = function report( data ) { this.container.insertAdjacentHTML( 'beforeend' , '<hr />' + '<p class="tea-time-classic-reporter" style="font-weight:bold;' + passingStyle + indentStyle( 1 ) + '">' + data.ok + ( data.assertionOk ? '|' + data.assertionOk : '' ) + ' passing ' + ( data.duration < 2000 ? '<span style="' + durationStyle + '">(' + Math.floor( data.duration ) + 'ms)</span>' : '<span style="' + durationStyle + '">(' + Math.floor( data.duration / 1000 ) + '.' + Math.floor( data.duration % 1000 ) + 's)</span>' ) + '</p>' + '<p class="tea-time-classic-reporter" style="font-weight:bold;' + failingStyle + indentStyle( 1 ) + '">' + data.fail + ( data.assertionFail ? '|' + data.assertionFail : '' ) + ' failing</p>' + ( data.optionalFail ? '<p class="tea-time-classic-reporter" style="font-weight:bold;' + optionalFailingStyle + indentStyle( 1 ) + '">' + data.optionalFail + ' opt failing</p>' : '' ) + ( data.skip ? '<p class="tea-time-classic-reporter" style="font-weight:bold;' + pendingStyle + indentStyle( 1 ) + '">' + data.skip + ' pending</p>' : '' ) + ( data.coverageRate !== undefined ? '<p class="tea-time-classic-reporter" style="font-weight:bold;' + data.coverageStyle + indentStyle( 1 ) + '">' + Math.round( data.coverageRate * 100 ) + '% coverage</p>' : '' ) ) ; scrollDown() ; } ; Reporter.errorReport = function errorReport( errors ) { var i , error , content = '' ; content += '<h4 class="tea-time-classic-reporter" style="' + errorStyle + indentStyle( 0 ) + '">== Errors ==</h4>' ; for ( i = 0 ; i < errors.length ; i ++ ) { error = errors[ i ] ; content += '<p class="tea-time-classic-reporter" style="' + ( error.optional ? optionalErrorStyle : errorStyle ) + indentStyle( 1 ) + '">' + ( i + 1 ) + ' ) ' ; switch ( error.type ) { case 'test' : if ( error.error.testTimeout ) { content += '<span style="' + hookErrorStyle + '">TEST TIMEOUT</span> ' ; } break ; case 'setup' : content += '<span style="' + hookErrorStyle + '">SETUP HOOK</span> ' ; break ; case 'teardown' : content += '<span style="' + hookErrorStyle + '">TEARDOWN HOOK</span> ' ; break ; case 'suiteSetup' : content += '<span style="' + hookErrorStyle + '">SUITE SETUP HOOK</span> ' ; break ; case 'suiteTeardown' : content += '<span style="' + hookErrorStyle + '">SUITE TEARDOWN HOOK</span> ' ; break ; } if ( error.error.uncaught ) { content += '<span style="' + hookErrorStyle + '">UNCAUGHT EXCEPTION</span> ' ; } content += error.title ; content += '</p>' ; content += this.reportOneError( error.error ) ; } this.container.insertAdjacentHTML( 'beforeend' , '<hr />' + content ) ; scrollDown() ; } ; Reporter.prototype.reportOneError = function reportOneError( error ) { var content = '' ; if ( error.showDiff === true || ( error.showDiff === undefined && ( 'expected' in error ) && ( 'actual' in error ) ) ) { content += '<p class="tea-time-classic-reporter" style="' + indentStyle( 2 ) + '">' + '<span style="' + expectedStyle + '">expected</span><span style="' + actualStyle + '">actual</span>' + '</p>' ; content += '<pre class="tea-time-classic-reporter"; style="' + indentStyle( 2 ) + '">' ; content += this.teaTime.htmlColorDiff( error.actual , error.expected ) ; content += '</pre>' ; } if ( typeof error.expectationPath === 'string' && ( error.showPathDiff === true || ( error.showPathDiff === undefined && ( 'expected' in error ) && ( 'actual' in error ) ) ) ) { content += '<p class="tea-time-classic-reporter" style="' + indentStyle( 2 ) + '">' + '<span style="' + expectationPathStyle + '">at [.' + error.expectationPath + ']</span> ' + '<span style="' + expectedStyle + '">expected</span><span style="' + actualStyle + '">actual</span>' + '</p>' ; content += '<pre class="tea-time-classic-reporter"; style="' + indentStyle( 2 ) + '">' ; content += this.teaTime.htmlColorDiff( dotPath.get( error.actual , error.expectationPath ) , dotPath.get( error.expected , error.expectationPath ) ) ; content += '</pre>' ; } content += '<pre class="tea-time-classic-reporter" style="' + indentStyle( 2 ) + '">' + this.teaTime.inspect.inspectError( { style: 'html' } , error ) + '</pre>' ; return content ; } ; },{"tree-kit/lib/dotPath.js":122}],4:[function(require,module,exports){ /* Tea Time! Copyright (c) 2015 - 2021 Cédric Ronvel The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WI