Skip to content

Commit

Permalink
added node helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza committed May 6, 2022
1 parent 2eb5603 commit 6f073fe
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
"it_only_db": true,
"it_only_mongodb_version": true,
"it_only_postgres_version": true,
"it_only_node_version": true,
"fit_only_mongodb_version": true,
"fit_only_node_version": true,
"it_exclude_mongodb_version": true,
"it_exclude_postgres_version": true,
"fit_exclude_mongodb_version": true,
"fit_exclude_node_version": true,
"it_exclude_dbs": true,
"describe_only_db": true,
"describe_only": true,
Expand All @@ -31,11 +34,10 @@
"jequal": true,
"create": true,
"arrayContains": true,
"expectAsync": true,
"databaseAdapter": true
"databaseAdapter": true,
},
"rules": {
"no-console": [0],
"no-var": "error"
"no-var": "error",
}
}
36 changes: 36 additions & 0 deletions spec/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,15 @@ global.it_only_postgres_version = version => {
}
};

global.it_only_node_version = version => {
const envVersion = process.env.NODE_VERSION;
if (!envVersion || semver.satisfies(envVersion, version)) {
return it;
} else {
return xit;
}
};

global.fit_only_mongodb_version = version => {
const envVersion = process.env.MONGODB_VERSION;
if (!envVersion || semver.satisfies(envVersion, version)) {
Expand All @@ -470,6 +479,15 @@ global.fit_only_mongodb_version = version => {
}
};

global.fit_only_node_version = version => {
const envVersion = process.env.NODE_VERSION;
if (!envVersion || semver.satisfies(envVersion, version)) {
return fit;
} else {
return xit;
}
};

global.it_exclude_mongodb_version = version => {
const envVersion = process.env.MONGODB_VERSION;
if (!envVersion || !semver.satisfies(envVersion, version)) {
Expand All @@ -488,6 +506,15 @@ global.it_exclude_postgres_version = version => {
}
};

global.it_exclude_node_version = version => {
const envVersion = process.env.NODE_VERSION;
if (!envVersion || !semver.satisfies(envVersion, version)) {
return it;
} else {
return xit;
}
};

global.fit_exclude_mongodb_version = version => {
const envVersion = process.env.MONGODB_VERSION;
if (!envVersion || !semver.satisfies(envVersion, version)) {
Expand All @@ -497,6 +524,15 @@ global.fit_exclude_mongodb_version = version => {
}
};

global.fit_exclude_node_version = version => {
const envVersion = process.env.NODE_VERSION;
if (!envVersion || !semver.satisfies(envVersion, version)) {
return fit;
} else {
return xit;
}
};

global.fit_exclude_dbs = excluded => {
if (excluded.indexOf(process.env.PARSE_SERVER_TEST_DB) >= 0) {
return xit;
Expand Down

0 comments on commit 6f073fe

Please sign in to comment.