Skip to content

Commit

Permalink
chore: remove testutils (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
tripodsan authored Oct 21, 2024
1 parent d04e12f commit ca068b9
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"docs": "jsdoc2md --files src/*.js -t README.md.hbs -d 3 > README.md",
"semantic-release": "semantic-release",
"semantic-release-dry": "semantic-release --dry-run --no-ci --branches $CI_BRANCH",
"prepare": "husky install"
"prepare": "husky"
},
"exports": {
".": "./src/index.js",
Expand Down Expand Up @@ -46,7 +46,6 @@
},
"devDependencies": {
"@adobe/eslint-config-helix": "2.0.8",
"@adobe/helix-testutils": "0.4.17",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"c8": "9.1.0",
Expand Down
2 changes: 1 addition & 1 deletion test/conditions.integration.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-env mocha */
import assert from 'assert';
import { condit } from '@adobe/helix-testutils';
import nock from 'nock';
import f from '../src/index.js';
import { condit } from './utils.js';

describe('#integration condition updates', () => {
let fastly;
Expand Down
2 changes: 1 addition & 1 deletion test/edgedict.integration.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-env mocha */
import assert, { AssertionError } from 'assert';
import { condit } from '@adobe/helix-testutils';
import nock from 'nock';

import f from '../src/index.js';
import { condit } from './utils.js';

describe('#integration edge dictionary updates', () => {
let fastly;
Expand Down
2 changes: 1 addition & 1 deletion test/package.integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import assert from 'assert';
import path from 'path';
import fs from 'fs/promises';
import nock from 'nock';
import { condit } from '@adobe/helix-testutils';
import f from '../src/index.js';
import { condit } from './utils.js';

describe('#integration compute@edge packages', () => {
let fastly;
Expand Down
35 changes: 35 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
/* eslint-env mocha */
export function condit(name, condition, mochafn) {
if (condition()) {
return it(name, mochafn);
}
return it.skip(`${name} (${condition.description || 'condition not met'})`, mochafn);
}

condit.hasenv = (name) => {
const fn = function env() {
return !!process.env[name];
};
fn.description = `env var ${name} must be set`;
return fn;
};

condit.hasenvs = (names) => {
const fn = function envs() {
return names.reduce((p, c) => p && !!process.env[c], true);
};

fn.description = `env vars ${names.join(', ')} must be set`;
return fn;
};

0 comments on commit ca068b9

Please sign in to comment.