Skip to content

Commit

Permalink
Make tests pass + tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Jul 4, 2022
1 parent aaa9c36 commit 10f99f9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 26 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '20 2 * * 1'

jobs:
analyze:
uses: voxpelli/ghatemplates/.github/workflows/codeql-analysis.yml@main
11 changes: 11 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Dependency Review'

on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
uses: voxpelli/ghatemplates/.github/workflows/dependency-review.yml@main

21 changes: 0 additions & 21 deletions .github/workflows/ts.yml

This file was deleted.

7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ var versionGuard = function (filePath, minMajor, minMinor) {
if (typeof minMajor !== 'number') throw new TypeError('Expected minMajor to be a number');
if (minMinor !== undefined && typeof minMinor !== 'number') throw new TypeError('Expected minMinor to be undefined or a number');

var mainPath = (require.main || {}).path || '';
var mainFile = (require.main || {}).filename || '';

if (mainPath === '') {
throw new Error('Missing mainPath, indication this is run directly, it should not be, failing');
if (mainFile === '') {
throw new Error('Missing mainFile, indication this is run directly, it should not be, failing');
}

var mainPath = path.dirname(mainFile);
var pkgPath = path.resolve(mainPath, './package.json');
/** @type {{ [key: string]: any } | undefined} */
var pkgJson;
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
"check": "run-s clean && run-p check:*",
"clean:declarations": "rm -rf $(find . -maxdepth 2 -type f -name '*.d.ts*')",
"clean": "run-p clean:*",
"prepare": "husky install",
"prepublishOnly": "run-s build",
"test": "run-s check"
"test:run": "node test/run.js",
"test-ci": "run-s test:*",
"test": "run-s check test:*"
},
"keywords": [],
"author": "Pelle Wessman <pelle@kodfabrik.se> (http://kodfabrik.se/)",
Expand All @@ -52,6 +55,7 @@
"eslint-plugin-security": "^1.5.0",
"eslint-plugin-sort-destructure-keys": "^1.4.0",
"eslint-plugin-unicorn": "^42.0.0",
"husky": "^8.0.1",
"installed-check": "^6.0.1",
"npm-run-all2": "^6.0.1",
"type-coverage": "^2.21.2",
Expand Down
1 change: 1 addition & 0 deletions test/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('..')('./guarded.mjs', 16, 0);
1 change: 0 additions & 1 deletion test/test.js

This file was deleted.

0 comments on commit 10f99f9

Please sign in to comment.