Skip to content

Commit

Permalink
Release v1.0.6 (#18)
Browse files Browse the repository at this point in the history
- ci: update with shared GHA workflows
- move .eslintrc.json -> .yaml
- test: replace nodeunit with mocha
- doc(README): update CI badge URLs
  • Loading branch information
msimerson authored Jun 6, 2022
1 parent abeb4f7 commit 8cf5224
Show file tree
Hide file tree
Showing 15 changed files with 160 additions and 153 deletions.
4 changes: 2 additions & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
engines:
eslint:
enabled: true
channel: "eslint-4"
channel: "eslint-8"
config:
config: ".eslintrc.json"
config: ".eslintrc.yaml"

ratings:
paths:
Expand Down
13 changes: 0 additions & 13 deletions .eslintrc.json

This file was deleted.

11 changes: 11 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
env:
node: true
es6: true
mocha: true
es2020: true


plugins:
- haraka

extends: [ "eslint:recommended", "plugin:haraka/recommended" ]
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
allow:
- dependency-type: production
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on: [ push ]

env:
CI: true

jobs:

lint:
uses: haraka/.github/.github/workflows/lint.yml@master

coverage:
uses: haraka/.github/.github/workflows/coverage.yml@master
secrets: inherit

test:
needs: [ lint, get-lts ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test

get-lts:
runs-on: ubuntu-latest
steps:
- id: get
uses: msimerson/node-lts-versions@v1
outputs:
active: ${{ steps.get.outputs.active }}
lts: ${{ steps.get.outputs.lts }}
14 changes: 14 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: CodeQL

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '18 7 * * 4'

jobs:
codeql:
uses: haraka/.github/.github/workflows/codeql.yml@master
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: publish

on:
push:
branches:
- master
paths:
- package.json

env:
CI: true

jobs:
publish:
uses: haraka/.github/.github/workflows/publish.yml@master
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ node_modules
.node_repl_history

package-lock.json
haraka-update.sh
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".release"]
path = .release
url = [email protected]:msimerson/.release.git
1 change: 1 addition & 0 deletions .release
Submodule .release added at 9be2b2
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const constants = require('haraka-constants');
```


[ci-img]: https://travis-ci.org/haraka/haraka-constants.svg?branch=master
[ci-url]: https://travis-ci.org/haraka/haraka-constants
[ci-img]: https://github.com/haraka/haraka-constants/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/haraka/haraka-constants/actions/workflows/ci.yml
[cov-img]: https://codecov.io/github/haraka/haraka-constants/coverage.svg
[cov-url]: https://codecov.io/github/haraka/haraka-constants?branch=master
[clim-img]: https://codeclimate.com/github/haraka/haraka-constants/badges/gpa.svg
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "haraka-constants",
"license": "MIT",
"description": "Haraka constants",
"version": "1.0.5",
"version": "1.0.6",
"homepage": "http://haraka.github.io",
"repository": {
"type": "git",
Expand All @@ -16,17 +16,17 @@
"dependencies": {},
"optionalDependencies": {},
"devDependencies": {
"eslint": ">=6",
"eslint": ">=8",
"eslint-plugin-haraka": ">=1.0.10",
"nodeunit": "*"
"mocha": "*"
},
"bugs": {
"mail": "[email protected]",
"url": "https://github.com/haraka/haraka-constants/issues"
},
"scripts": {
"lint": "./node_modules/.bin/eslint *.js test/*.js",
"lintfix": "./node_modules/.bin/eslint --fix *.js test/*.js",
"test": "./run_tests"
"lint": "npx eslint *.js test",
"lintfix": "npx eslint --fix *.js test",
"test": "npx mocha"
}
}
33 changes: 0 additions & 33 deletions run_tests

This file was deleted.

132 changes: 53 additions & 79 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,41 @@

const assert = require('assert')

const node_const = require('constants');

const constants = require('../index');
const write_excl_val = node_const.O_CREAT | node_const.O_TRUNC | node_const.O_WRONLY | node_const.O_EXCL;

exports.constants = {
'cont' (test) {
test.expect(1);
test.equal(constants.cont, 900);
test.done();
},
'CONT' (test) {
test.expect(1);
test.equal(constants.CONT, 900);
test.done();
},
'stop' (test) {
test.expect(1);
test.equal(constants.stop, 901);
test.done();
},
'deny' (test) {
test.expect(1);
test.equal(constants.deny, 902);
test.done();
},
'DENY' (test) {
test.expect(1);
test.equal(constants.DENY, 902);
test.done();
},
'WRITE_EXCL' (test) {
test.expect(1);
test.equal(constants.WRITE_EXCL, write_excl_val);
test.done();
}
}
describe('constants', function () {
it('cont', function () {
assert.equal(constants.cont, 900);
})
it('CONT', function () {
assert.equal(constants.CONT, 900);
})
it('stop', function () {
assert.equal(constants.stop, 901);
})
it('deny', function () {
assert.equal(constants.deny, 902);
})
it('DENY', function () {
assert.equal(constants.DENY, 902);
})
it('WRITE_EXCL', function () {
assert.equal(constants.WRITE_EXCL, write_excl_val);
})
})

exports.import = {
'exists as function' (test) {
test.expect(1);
test.equal(typeof constants.import, 'function');
test.done();
},
'populates an object' (test) {
test.expect(1);
describe('import', function () {
it('exists as function', function () {
assert.equal(typeof constants.import, 'function');
})
it('populates an object', function () {
const newObj = {};
constants.import(newObj);
delete newObj.connection;
test.deepEqual(newObj,
assert.deepEqual(newObj,
{
CONT: 900,
STOP: 901,
Expand All @@ -63,43 +50,30 @@ exports.import = {
WRITE_EXCL: write_excl_val
}
);
test.done();
}
};
})
})

exports.translate = {
'converts num to str' (test) {
test.expect(2);
test.equal('CONT', constants.translate(900));
test.equal('DENY', constants.translate(902));
test.done();
},
'UNKNOWN' (test) {
test.expect(1);
test.equal('UNKNOWN', constants.translate(800));
test.done();
},
};
describe('translate', function () {
it('converts num to str', function () {
assert.equal('CONT', constants.translate(900));
assert.equal('DENY', constants.translate(902));
})
it('UNKNOWN', function () {
assert.equal('UNKNOWN', constants.translate(800));
})
})

exports.connection = {
'has connection state CMD' (test) {
test.expect(1);
test.equal(constants.connection.state.CMD, 1);
test.done();
},
'has connection state STATE_CMD' (test) {
test.expect(1);
test.equal(constants.connection.state.STATE_CMD, 1);
test.done();
},
'has connection state DISCONNECTED' (test) {
test.expect(1);
test.equal(constants.connection.state.DISCONNECTED, 100);
test.done();
},
'has connection state STATE_DISCONNECTED' (test) {
test.expect(1);
test.equal(constants.connection.state.STATE_DISCONNECTED, 100);
test.done();
},
}
describe('connection', function () {
it('has connection state CMD', function () {
assert.equal(constants.connection.state.CMD, 1);
})
it('has connection state STATE_CMD', function () {
assert.equal(constants.connection.state.STATE_CMD, 1);
})
it('has connection state DISCONNECTED', function () {
assert.equal(constants.connection.state.DISCONNECTED, 100);
})
it('has connection state STATE_DISCONNECTED', function () {
assert.equal(constants.connection.state.STATE_DISCONNECTED, 100);
})
})

0 comments on commit 8cf5224

Please sign in to comment.