Skip to content

Commit 40dba78

Browse files
authored
Merge pull request #18 from xpepermint/master
Fix instanceof issue
2 parents 7288aa1 + 4ae1a29 commit 40dba78

7 files changed

Lines changed: 16 additions & 14 deletions

File tree

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"packages": [
44
"packages/*"
55
],
6-
"version": "0.4.21"
6+
"version": "0.5.0"
77
}

packages/hayspec-cli/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hayspec/cli",
3-
"version": "0.4.21",
3+
"version": "0.5.0",
44
"description": "CLI for Hayspec framework.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -64,10 +64,10 @@
6464
"typescript": "^3.0.1"
6565
},
6666
"dependencies": {
67-
"@hayspec/init": "^0.4.21",
68-
"@hayspec/reporter": "^0.4.21",
69-
"@hayspec/runner": "^0.4.21",
70-
"@hayspec/spec": "^0.4.21",
67+
"@hayspec/init": "^0.5.0",
68+
"@hayspec/reporter": "^0.5.0",
69+
"@hayspec/runner": "^0.5.0",
70+
"@hayspec/spec": "^0.5.0",
7171
"inquirer": "^6.0.0",
7272
"yargs": "^11.0.0"
7373
},

packages/hayspec-init/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hayspec/init",
3-
"version": "0.4.21",
3+
"version": "0.5.0",
44
"description": "Project generator for Hayspec framework.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/hayspec-reporter/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hayspec/reporter",
3-
"version": "0.4.21",
3+
"version": "0.5.0",
44
"description": "Reporter for Hayspec framework.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -65,7 +65,7 @@
6565
"typescript": "^3.0.1"
6666
},
6767
"dependencies": {
68-
"@hayspec/spec": "^0.4.21",
68+
"@hayspec/spec": "^0.5.0",
6969
"chalk": "^2.4.1"
7070
},
7171
"gitHead": "03535c698ebd35ec94c63869f18cdde2380f739f"

packages/hayspec-runner/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hayspec/runner",
3-
"version": "0.4.21",
3+
"version": "0.5.0",
44
"description": "Tests runner for Hayspec framework.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -65,7 +65,7 @@
6565
"typescript": "^3.0.1"
6666
},
6767
"dependencies": {
68-
"@hayspec/spec": "^0.4.21",
68+
"@hayspec/spec": "^0.5.0",
6969
"fast-glob": "^2.2.2"
7070
},
7171
"gitHead": "03535c698ebd35ec94c63869f18cdde2380f739f"

packages/hayspec-runner/src/core/runner.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ export class Runner {
6262

6363
/**
6464
*
65+
* NOTE: Due to different NPM package managers, the `instanceof` check my be
66+
* inconsistent thus the function checks for presence of the `test` method.
6567
*/
6668
protected async loadSpec(file: string) {
6769
const spec = require(file);
6870

69-
if (spec instanceof Spec) {
71+
if (typeof spec.test !== 'undefined') {
7072
this.results.push({ file, spec });
71-
} else if (spec.default instanceof Spec) {
73+
} else if (spec.default && typeof spec.default.test !== 'undefined') {
7274
this.results.push({ file, spec: spec.default });
7375
}
7476
}

packages/hayspec-spec/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hayspec/spec",
3-
"version": "0.4.21",
3+
"version": "0.5.0",
44
"description": "Core logic for Hayspec framework.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

0 commit comments

Comments
 (0)