This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ chai.use(dirtyChai)
88
99module . exports . expect = chai . expect
1010
11+ const isObject = ( o ) => Object . prototype . toString . call ( o ) === '[object Object]'
12+
1113// Get a "describe" function that is optionally 'skipped' or 'onlyed'
1214// If skip/only are boolean true, or an object with a reason property, then we
1315// want to skip/only the whole suite
@@ -16,7 +18,9 @@ function getDescribe (config) {
1618 if ( config . only === true ) return describe . only
1719 if ( config . skip === true ) return describe . skip
1820
19- if ( config . skip && typeof config . skip === 'object' && config . skip . reason ) {
21+ if ( isObject ( config . skip ) ) {
22+ if ( ! config . skip . reason ) return describe . skip
23+
2024 const _describe = ( name , impl ) => {
2125 describe . skip ( `${ name } (${ config . skip . reason } )` , impl )
2226 }
@@ -44,7 +48,7 @@ function getIt (config) {
4448 const _it = ( name , impl ) => {
4549 if ( Array . isArray ( config . skip ) ) {
4650 const skip = config . skip
47- . map ( ( s ) => s && typeof s === 'object' ? s : { name : s } )
51+ . map ( ( s ) => isObject ( s ) ? s : { name : s } )
4852 . find ( ( s ) => s . name === name )
4953
5054 if ( skip ) {
Original file line number Diff line number Diff line change 11'use strict'
22
3+ const isObject = ( o ) => Object . prototype . toString . call ( o ) === '[object Object]'
4+
35function createSuite ( tests , parent ) {
46 const suite = ( createCommon , options ) => {
57 Object . keys ( tests ) . forEach ( t => {
@@ -8,7 +10,7 @@ function createSuite (tests, parent) {
810
911 if ( Array . isArray ( opts . skip ) ) {
1012 const skip = opts . skip
11- . map ( ( s ) => s && typeof s === 'object' ? s : { name : s } )
13+ . map ( ( s ) => isObject ( s ) ? s : { name : s } )
1214 . find ( ( s ) => s . name === suiteName )
1315
1416 if ( skip ) {
You can’t perform that action at this time.
0 commit comments